Commit 124f5362 authored by Vitaly Lipatov's avatar Vitaly Lipatov

improve release_upgrade, automate altlinux-release-p8 install

parent 88144126
......@@ -80,12 +80,23 @@ __alt_repofix()
__replace_text_in_alt_repo "/^ *#/! s!\[[tp][6-9]\]![updates]!g"
}
__get_conflict_release_pkg()
{
epmqf --quiet --short /etc/fedora-release | head -n1
}
get_fix_release_pkg()
{
# TODO: check for version incompatibilities
if epmqf /etc/altlinux-release | grep -q sisyphus ; then
echo altlinux-release-$1
fi
# workaround against
# file /etc/fedora-release from install of altlinux-release-p8-20160414-alt1 conflicts with file from package branding-simply-linux-release-8.2.0-alt1
# problem
if __get_conflict_release_pkg | grep -q -v "^altlinux-release" ; then
echo altlinux-release-$1 $(__get_conflict_release_pkg)-
fi
}
__update_to_the_distro()
......@@ -105,7 +116,7 @@ __update_to_the_distro()
docmd epm update || fatal
if ! docmd epm install apt rpm apt-conf-branch "$(get_fix_release_pkg "$TO")" ; then
# Hack for error: execution of %post scriptlet from glibc-core-2.23-alt1.eter1
docmd rpm -ev glibc-core-2.17 || fatal "Check an error and run epm release-upgrade again"
#docmd rpm -ev glibc-core-2.17 || fatal "Check an error and run epm release-upgrade again"
docmd epm install apt rpm apt-conf-branch "$(get_fix_release_pkg "$TO")" || fatal "Check an error and run epm release-upgrade again"
fi
__alt_repofix
......@@ -118,21 +129,24 @@ __update_to_the_distro()
;;
Sisyphus)
docmd epm update || fatal
docmd epm install apt rpm librpm7 librpm apt-conf-sisyphus altlinux-release-sisyphus || fatal "Check an error and run again"
docmd epm install apt rpm librpm7 librpm apt-conf-sisyphus altlinux-release-sisyphus $(__get_conflict_release_pkg) || fatal "Check an error and run again"
docmd epm upgrade || fatal "Check an error and run epm release-upgrade again"
;;
*)
esac
}
__update_alt_to_next_distro()
{
local TO=""
local TO="$2"
local FROM="$1"
[ -n "$TO" ] || TO="$FROM"
info
case "$*" in
"p6"|"p6 p7"|"t6 p7")
"p6"|"p6 p7"|"t6 p7"|"c6 c7")
TO="p7"
docmd epm install apt rpm
info "Upgrade $DISTRNAME from $FROM to $TO ..."
docmd epm install apt-conf-branch || fatal
__replace_alt_version_in_repo "$FROM/branch/" "$TO/branch/"
......@@ -141,8 +155,9 @@ __update_alt_to_next_distro()
info "Done."
info "Run epm release-upgrade again for update to p8"
;;
"p7"|"p7 p8"|"t7 p8")
"p7"|"p7 p8"|"t7 p8"|"c7 c8"|"p8 p8")
TO="p8"
docmd epm install apt rpm
info "Upgrade $DISTRNAME from $FROM to $TO ..."
docmd epm install apt-conf-branch "$(get_fix_release_pkg "$FROM")" || fatal
__replace_alt_version_in_repo $FROM/branch/ $TO/branch/
......@@ -152,6 +167,7 @@ __update_alt_to_next_distro()
;;
"Sisyphus p8")
TO="p8"
docmd epm install apt rpm
info "Downgrade $DISTRNAME from $FROM to $TO ..."
docmd epm install apt-conf-branch || fatal
__replace_alt_version_in_repo "$FROM/" "$FROM/branch/"
......@@ -162,6 +178,7 @@ __update_alt_to_next_distro()
;;
"p8 Sisyphus")
TO="Sisyphus"
docmd epm install apt rpm
info "Upgrade $DISTRNAME from $FROM to $TO ..."
docmd epm install apt-conf-branch || fatal
docmd epm upgrade || fatal
......@@ -173,7 +190,11 @@ __update_alt_to_next_distro()
info "Done."
;;
*)
warning "Have no idea how to update from $DISTRNAME $FROM to $DISTRNAME $TO."
if [ "$FROM" = "$TO" ] ; then
info "It seems your system is already updated to newest $DISTRNAME $TO"
else
warning "Have no idea how to update from $DISTRNAME $FROM to $DISTRNAME $TO."
fi
info "Try run f.i. # epm release-upgrade p8 or # epm release-upgrade Sisyphus"
info "Also possible you need install altlinux-release-p? package for correct distro version detecting"
return 1
......@@ -186,10 +207,12 @@ epm_release_upgrade()
info "Starting upgrade whole system to the next release"
info "Check also http://wiki.etersoft.ru/Admin/UpdateLinux"
# TODO: it is possible eatmydata does not do his work
export EPMNOEATMYDATA=1
case $DISTRNAME in
ALTLinux)
docmd epm update
docmd epm install apt rpm
# try to detect current release by repo
if [ "$DISTRVERSION" = "Sisyphus" ] || [ -z "$DISTRVERSION" ] ; then
......@@ -208,6 +231,7 @@ epm_release_upgrade()
[ "$(__wcount $pkg_filenames)" = "1" ] || fatal "Too many args: $pkg_filenames"
fi
# TODO: ask before upgrade
__update_alt_to_next_distro $DISTRVERSION $pkg_filenames
return
;;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment