Commit 89086cd1 authored by Vitaly Lipatov's avatar Vitaly Lipatov

release-upgrade: small logic improvements

parent 7c0b368b
...@@ -58,7 +58,7 @@ __replace_alt_version_in_repo() ...@@ -58,7 +58,7 @@ __replace_alt_version_in_repo()
assure_exists apt-repo assure_exists apt-repo
#echo "Upgrading $DISTRNAME from $1 to $2 ..." #echo "Upgrading $DISTRNAME from $1 to $2 ..."
docmd apt-repo list | sed -e "s|\($1\)|{\1}->{$2}|g" | egrep --color -- "$1" docmd apt-repo list | sed -e "s|\($1\)|{\1}->{$2}|g" | egrep --color -- "$1"
confirm "Are these correct changes?" || fatal "Exiting" confirm "Are these correct changes? [y/N]" || fatal "Exiting"
__replace_text_in_alt_repo "/^ *#/! s!$1!$2!g" __replace_text_in_alt_repo "/^ *#/! s!$1!$2!g"
docmd apt-repo list docmd apt-repo list
} }
...@@ -66,7 +66,8 @@ __replace_alt_version_in_repo() ...@@ -66,7 +66,8 @@ __replace_alt_version_in_repo()
__alt_repofix() __alt_repofix()
{ {
load_helper epm-repofix load_helper epm-repofix
pkg_filenames= epm_repofix showcmd epm repofix
quiet=1 pkg_filenames= epm_repofix >/dev/null
__replace_text_in_alt_repo "/^ *#/! s!\[p[6-9]\]![updates]!g" __replace_text_in_alt_repo "/^ *#/! s!\[p[6-9]\]![updates]!g"
} }
...@@ -106,9 +107,6 @@ __update_to_the_distro() ...@@ -106,9 +107,6 @@ __update_to_the_distro()
Sisyphus) Sisyphus)
docmd epm update || fatal docmd epm update || fatal
docmd epm install apt rpm apt-conf-sisyphus altlinux-release-sisyphus || fatal "Check an error and run again" docmd epm install apt rpm apt-conf-sisyphus altlinux-release-sisyphus || fatal "Check an error and run again"
#__replace_text_in_alt_repo "/^ *#/! s!\[updates\]![alt]!g"
__alt_repofix
docmd epm update || fatal
docmd epm upgrade || fatal "Check an error and run epm release-upgrade again" docmd epm upgrade || fatal "Check an error and run epm release-upgrade again"
docmd epm update-kernel || fatal docmd epm update-kernel || fatal
info "Done." info "Done."
...@@ -138,19 +136,21 @@ __update_alt_to_next_distro() ...@@ -138,19 +136,21 @@ __update_alt_to_next_distro()
info "Downgrade $DISTRNAME from Sisyphus to p8 ..." info "Downgrade $DISTRNAME from Sisyphus to p8 ..."
docmd epm install apt-conf-branch || fatal docmd epm install apt-conf-branch || fatal
__replace_alt_version_in_repo Sisyphus/ p8/branch/ __replace_alt_version_in_repo Sisyphus/ p8/branch/
__replace_text_in_alt_repo "/^ *#/! s!\[alt\]![p8]!g"
__update_to_the_distro p8 __update_to_the_distro p8
;; ;;
"p8 Sisyphus") "p8 Sisyphus")
info "Upgrade $DISTRNAME from p8 to Sisyphus ..." info "Upgrade $DISTRNAME from p8 to Sisyphus ..."
docmd epm install apt-conf-branch || fatal docmd epm install apt-conf-branch || fatal
docmd epm upgrade || fatal docmd epm upgrade || fatal
__alt_repofix
__replace_alt_version_in_repo p8/branch/ Sisyphus/ __replace_alt_version_in_repo p8/branch/ Sisyphus/
__alt_repofix
__replace_text_in_alt_repo "/^ *#/! s!\[updates\]![alt]!g"
__update_to_the_distro Sisyphus __update_to_the_distro Sisyphus
;; ;;
*) *)
warning "Have no idea how to update from $DISTRNAME $DISTRVERSION." warning "Have no idea how to update from $DISTRNAME $DISTRVERSION."
info "Try run f.i. # epm release-upgrade p8" info "Try run f.i. # epm release-upgrade p8 or # epm release-upgrade Sisyphus"
return 1 return 1
esac esac
} }
...@@ -163,7 +163,6 @@ epm_release_upgrade() ...@@ -163,7 +163,6 @@ epm_release_upgrade()
case $DISTRNAME in case $DISTRNAME in
ALTLinux) ALTLinux)
__alt_repofix
docmd epm update docmd epm update
docmd epm install apt rpm docmd epm install apt rpm
...@@ -173,6 +172,8 @@ epm_release_upgrade() ...@@ -173,6 +172,8 @@ epm_release_upgrade()
[ "$DISTRVERSION" != "Sisyphus" ] && info "Detected running $DISTRNAME $DISTRVERSION (according to using repos)" [ "$DISTRVERSION" != "Sisyphus" ] && info "Detected running $DISTRNAME $DISTRVERSION (according to using repos)"
fi fi
__alt_repofix
# check forced target # check forced target
if [ -n "$pkg_filenames" ] ; then if [ -n "$pkg_filenames" ] ; then
[ "$(__wcount $pkg_filenames)" = "1" ] || fatal "Too many args: $pkg_filenames" [ "$(__wcount $pkg_filenames)" = "1" ] || fatal "Too many args: $pkg_filenames"
......
...@@ -33,10 +33,10 @@ __fix_apt_sources_list() ...@@ -33,10 +33,10 @@ __fix_apt_sources_list()
# add signs # add signs
local br local br
for br in $DISTRVERSION ; do for br in $DISTRVERSION ; do
# sed -r -e "/ALTLinux\/p8\/branch/s/rpm *([fhr])/rpm [p8] \1/"
regexp_subst "/ALTLinux\/$br\/branch/s/^rpm *([fhr])/rpm [$br] \1/" $i regexp_subst "/ALTLinux\/$br\/branch/s/^rpm *([fhr])/rpm [$br] \1/" $i
regexp_subst "/Etersoft\/$br\/branch/s/^rpm *([fhr])/rpm [etersoft] \1/" $i regexp_subst "/Etersoft\/$br\/branch/s/^rpm *([fhr])/rpm [etersoft] \1/" $i
done done
regexp_subst "/ALTLinux\/Sisyphus/s/^rpm *([fhr])/rpm [alt] \1/" $i
done done
} }
...@@ -48,7 +48,7 @@ epm_repofix() ...@@ -48,7 +48,7 @@ epm_repofix()
case $PMTYPE in case $PMTYPE in
apt-rpm) apt-rpm)
assure_exists apt-repo assure_exists apt-repo
docmd apt-repo list [ -n "$quiet" ] || docmd apt-repo list
__fix_apt_sources_list /etc/apt/sources.list __fix_apt_sources_list /etc/apt/sources.list
__fix_apt_sources_list /etc/apt/sources.list.d/*.list __fix_apt_sources_list /etc/apt/sources.list.d/*.list
docmd apt-repo list docmd apt-repo list
......
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