Commit fb9f9658 authored by Vitaly Lipatov's avatar Vitaly Lipatov

backported to p8 as 1.7.3-alt0.M80P.1 (with rpmbph script)

parents 6c95f142 7c0b368b
......@@ -227,7 +227,7 @@ check_command()
removerepo|rr) # HELPCMD: remove package repo
epm_cmd=removerepo
;;
release-upgrade) # HELPCMD: update whole system to the next release
release-upgrade|upgrade-release) # HELPCMD: update whole system to the next release
epm_cmd=release_upgrade
;;
kernel-update|kernel-upgrade|update-kernel|upgrade-kernel) # HELPCMD: update system kernel to the last repo version
......
......@@ -28,28 +28,56 @@ __replace_text_in_alt_repo()
done
}
__wcount()
{
echo "$*" | wc -w
}
__detect_alt_release_by_repo()
{
local BRD=$(cat /etc/apt/sources.list /etc/apt/sources.list.d/*.list | \
grep -v "^#" | grep "p[5-9]/branch/" | sed -e "s|.*\(p[5-9]\)/branch.*|\1|g" | sort -u )
if [ $(__wcount $BRD) = "1" ] ; then
echo "$BRD"
return
fi
local BRD=$(cat /etc/apt/sources.list /etc/apt/sources.list.d/*.list | \
grep -v "^#" | grep "Sisyphus/" | sed -e "s|.*\(Sisyphus\).*|\1|g" | sort -u )
if [ $(__wcount $BRD) = "1" ] ; then
echo "$BRD"
return
fi
return 1
}
__replace_alt_version_in_repo()
{
local i
assure_exists apt-repo
echo "Upgrading $DISTRNAME from $1 to $2 ..."
docmd apt-repo list | sed -e "s|\($1/branch\)|{\1}->{$2/branch}|g" | egrep --color -- "$1/branch"
#echo "Upgrading $DISTRNAME from $1 to $2 ..."
docmd apt-repo list | sed -e "s|\($1\)|{\1}->{$2}|g" | egrep --color -- "$1"
confirm "Are these correct changes?" || fatal "Exiting"
__replace_text_in_alt_repo "/^ *#/! s!$1/branch!$2/branch!g"
__replace_text_in_alt_repo "/^ *#/! s!$1!$2!g"
docmd apt-repo list
}
__update_alt_repo_to_next_distro()
__alt_repofix()
{
case "$DISTRVERSION" in
p6)
docmd epm install apt-conf-branch || fatal
load_helper epm-repofix
pkg_filenames= epm_repofix
__replace_alt_version_in_repo p6 p7
__replace_text_in_alt_repo "/^ *#/! s!\[p6\]![updates]!g"
load_helper epm-repofix
pkg_filenames= epm_repofix
__replace_text_in_alt_repo "/^ *#/! s!\[p[6-9]\]![updates]!g"
}
__update_to_the_distro()
{
__alt_repofix
case "$1" in
p7)
docmd epm update || fatal
docmd epm install apt rpm apt-conf-branch || fatal "Check an error and run epm release-upgrade again"
docmd epm install apt rpm apt-conf-branch altlinux-release-p7 || fatal "Check an error and run epm release-upgrade again"
__alt_repofix
__replace_text_in_alt_repo "/^ *#/! s!\[updates\]![p7]!g"
docmd epm update || fatal
docmd epm upgrade || fatal "Check an error and run epm release-upgrade again"
......@@ -57,14 +85,14 @@ __update_alt_repo_to_next_distro()
info "Done."
info "Run epm release-upgrade again for update to p8"
;;
p7)
docmd epm install apt-conf-branch || fatal
load_helper epm-repofix
pkg_filenames= epm_repofix
__replace_alt_version_in_repo p7 p8
__replace_text_in_alt_repo "/^ *#/! s!\[p7\]![updates]!g"
p8)
docmd epm update || fatal
docmd epm install apt rpm apt-conf-branch || fatal "Check an error and run epm release-upgrade again"
if ! docmd epm install apt rpm apt-conf-branch altlinux-release-p8 ; then
# error: execution of %post scriptlet from glibc-core-2.23-alt1.eter1
docmd epm erase glibc-core-2.17 || fatal "Check an error and run epm release-upgrade again"
docmd epm install apt rpm apt-conf-branch altlinux-release-p8 || fatal "Check an error and run epm release-upgrade again"
fi
__alt_repofix
__replace_text_in_alt_repo "/^ *#/! s!\[updates\]![p8]!g"
docmd epm update || fatal
if is_installed systemd && is_active_systemd systemd ; then
......@@ -75,8 +103,54 @@ __update_alt_repo_to_next_distro()
docmd epm update-kernel || fatal
info "Done."
;;
Sisyphus)
docmd epm update || fatal
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 update-kernel || fatal
info "Done."
;;
*)
info "Have no idea how to update from $DISTRNAME $DISTRVERSION. Try install branding-simply-linux-release package before."
esac
}
__update_alt_to_next_distro()
{
local FROMTO=$(echo "$*" | sed -e "s| | to |")
info
case "$*" in
"p6"|"p6 p7")
info "Upgrade $DISTRNAME from p6 to p7 ..."
docmd epm install apt-conf-branch || fatal
__replace_alt_version_in_repo p6/branch/ p7/branch/
__update_to_the_distro p7
;;
"p7"|"p7 p8")
info "Upgrade $DISTRNAME from p7 to p8 ..."
docmd epm install apt-conf-branch altlinux-release-p7 || fatal
__replace_alt_version_in_repo p7/branch/ p8/branch/
__update_to_the_distro p8
;;
"Sisyphus p8")
info "Downgrade $DISTRNAME from Sisyphus to p8 ..."
docmd epm install apt-conf-branch || fatal
__replace_alt_version_in_repo Sisyphus/ p8/branch/
__update_to_the_distro p8
;;
"p8 Sisyphus")
info "Upgrade $DISTRNAME from p8 to Sisyphus ..."
docmd epm install apt-conf-branch || fatal
docmd epm upgrade || fatal
__alt_repofix
__replace_alt_version_in_repo p8/branch/ Sisyphus/
__update_to_the_distro Sisyphus
;;
*)
warning "Have no idea how to update from $DISTRNAME $DISTRVERSION."
info "Try run f.i. # epm release-upgrade p8"
return 1
esac
}
......@@ -89,9 +163,22 @@ epm_release_upgrade()
case $DISTRNAME in
ALTLinux)
__alt_repofix
docmd epm update
docmd epm install apt rpm
__update_alt_repo_to_next_distro
# try to detect current release by repo
if [ "$DISTRVERSION" = "Sisyphus" ] || [ -z "$DISTRVERSION" ] ; then
DISTRVERSION="$(__detect_alt_release_by_repo)"
[ "$DISTRVERSION" != "Sisyphus" ] && info "Detected running $DISTRNAME $DISTRVERSION (according to using repos)"
fi
# check forced target
if [ -n "$pkg_filenames" ] ; then
[ "$(__wcount $pkg_filenames)" = "1" ] || fatal "Too many args: $pkg_filenames"
fi
__update_alt_to_next_distro $DISTRVERSION $pkg_filenames
return
;;
*)
......
......@@ -29,8 +29,10 @@ __fix_apt_sources_list()
# TODO: only for uncommented strings
#sed -i -r -e "$SUBST_ALT_RULE" $i
regexp_subst "/^ *#/! $SUBST_ALT_RULE" $i
# add signs
local br
for br in p6 p7 p8 ; 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 "/Etersoft\/$br\/branch/s/^rpm *([fhr])/rpm [etersoft] \1/" $i
......
# This spec is backported to ALTLinux p8 automatically by rpmbph script from etersoft-build-utils.
#
Name: eepm
Version: 1.7.2
Version: 1.7.3
Release: alt0.M80P.1
Summary: Etersoft EPM package manager
......@@ -67,9 +67,14 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}*
%_sysconfdir/bash_completion.d/cerv
%changelog
* Fri Apr 22 2016 Vitaly Lipatov <lav@altlinux.ru> 1.7.2-alt0.M80P.1
* Sat Apr 23 2016 Vitaly Lipatov <lav@altlinux.ru> 1.7.3-alt0.M80P.1
- backport to ALTLinux p8 (by rpmbph script)
* Sat Apr 23 2016 Vitaly Lipatov <lav@altlinux.ru> 1.7.3-alt1
- epm release-upgrade: check for glibc-core-2.17
- release-upgrade: add detect current system by apt repo
- release-upgrade: rewrite to support p8 -> Sisyphus and vice versa
* Wed Apr 20 2016 Vitaly Lipatov <lav@altlinux.ru> 1.7.2-alt1
- distr_info: fix os-release detection
......
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