Commit d3d09eb7 authored by Vitaly Lipatov's avatar Vitaly Lipatov

release_upgrade: move set trap to a common place

parent e7581632
...@@ -308,8 +308,7 @@ __switch_alt_to_distro() ...@@ -308,8 +308,7 @@ __switch_alt_to_distro()
local FROM="$1" local FROM="$1"
info info
__save_alt_repo_lists try_change_alt_repo
trap __restore_alt_repo_lists EXIT
case "$*" in case "$*" in
"p6"|"p6 p7"|"t6 p7"|"c6 c7") "p6"|"p6 p7"|"t6 p7"|"c6 c7")
...@@ -458,12 +457,12 @@ __switch_alt_to_distro() ...@@ -458,12 +457,12 @@ __switch_alt_to_distro()
else else
warning "Unknown distro version. Have no idea how to switch from $DISTRNAME $FROM to $DISTRNAME $TO." warning "Unknown distro version. Have no idea how to switch from $DISTRNAME $FROM to $DISTRNAME $TO."
fi fi
trap - EXIT end_change_alt_repo
info "Try run f.i. '# epm release-upgrade p10' or '# epm release-downgrade p9' or '# epm release-upgrade Sisyphus'" info "Try run f.i. '# epm release-upgrade p10' or '# epm release-downgrade p9' or '# epm release-upgrade Sisyphus'"
info "Also possible you need install altlinux-release-p? package for correct distro version detecting" info "Also possible you need install altlinux-release-p? package for correct distro version detecting"
return 1 return 1
esac esac
trap - EXIT end_change_alt_repo
epm clean epm clean
info "Note: Also you can try '# epm autoremove' and '# epm autoorphans' commands to remove obsoleted and unused packages." info "Note: Also you can try '# epm autoremove' and '# epm autoorphans' commands to remove obsoleted and unused packages."
} }
......
...@@ -52,6 +52,16 @@ __restore_alt_repo_lists() ...@@ -52,6 +52,16 @@ __restore_alt_repo_lists()
done done
} }
try_change_alt_repo()
{
__save_alt_repo_lists
trap __restore_alt_repo_lists EXIT
}
end_change_alt_repo()
{
trap - EXIT
}
epm_reposave() epm_reposave()
......
...@@ -43,7 +43,7 @@ epm_upgrade() ...@@ -43,7 +43,7 @@ epm_upgrade()
# install only installed packages (simulate upgrade packages) # install only installed packages (simulate upgrade packages)
installlist="$(get_only_installed_packages "$installlist")" installlist="$(get_only_installed_packages "$installlist")"
[ -n "$verbose" ] && info "Packages to upgrade: $installlist" [ -n "$verbose" ] && info "Packages to upgrade: $installlist"
(pkg_names="$installlist" epm_Install) (pkg_names="$installlist" epm_Install) || fatal "Can't update repo"
epm_removerepo "$@" epm_removerepo "$@"
return return
fi fi
......
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