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()
local FROM="$1"
info
__save_alt_repo_lists
trap __restore_alt_repo_lists EXIT
try_change_alt_repo
case "$*" in
"p6"|"p6 p7"|"t6 p7"|"c6 c7")
......@@ -458,12 +457,12 @@ __switch_alt_to_distro()
else
warning "Unknown distro version. Have no idea how to switch from $DISTRNAME $FROM to $DISTRNAME $TO."
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 "Also possible you need install altlinux-release-p? package for correct distro version detecting"
return 1
esac
trap - EXIT
end_change_alt_repo
epm clean
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()
done
}
try_change_alt_repo()
{
__save_alt_repo_lists
trap __restore_alt_repo_lists EXIT
}
end_change_alt_repo()
{
trap - EXIT
}
epm_reposave()
......
......@@ -43,7 +43,7 @@ epm_upgrade()
# install only installed packages (simulate upgrade packages)
installlist="$(get_only_installed_packages "$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 "$@"
return
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