Commit 6d64a7be authored by Vitaly Lipatov's avatar Vitaly Lipatov

backported to p7 as 1.6.4-alt0.M70P.1 (with rpmbph script)

parents aeac7c5d a8d9deb8
......@@ -38,7 +38,7 @@ epm_checksystem_ALTLinux()
epm_checksystem()
{
[ -n "$SUDO" ] || fatal "Do not use checksystem under root"
[ $EFFUID = "0" ] && fatal "Do not use checksystem under root"
case $DISTRNAME in
ALTLinux)
......
#!/bin/sh
#
# Copyright (C) 2013 Etersoft
# Copyright (C) 2013 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2013, 2016 Etersoft
# Copyright (C) 2013, 2016 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -17,18 +17,65 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
__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"
confirm "Are these correct changes?" || fatal "Exiting"
for i in /etc/apt/sources.list /etc/apt/sources.list.d/*.list ; do
[ -s "$i" ] || continue
# TODO: only for uncommended strings
#sed -i -r -e "s!$1/branch!$2/branch!g" $i
regexp_subst "/^ *#/! s!$1/branch!$2/branch!g" $i
# TODO: start with improve to [p8] - install some package firstly?
regexp_subst "/^ *#/! s s!\[$1\]![alt]/branch!g" $i
done
docmd apt-repo list
}
__update_alt_repo_to_next_distro()
{
case "$DISTRVERSION" in
p6)
__replace_alt_version_in_repo p6 p7
info "Run epm release-upgrade again for update to p8"
;;
p7)
__replace_alt_version_in_repo p7 p8
;;
*)
info "Have no idea how to update from $DISTRNAME $DISTRVERSION"
return 1
esac
}
epm_release_upgrade()
{
assure_root
info "Starting upgrade whole system to the next release"
info "Check also http://wiki.etersoft.ru/Admin/UpdateLinux"
case $PMTYPE in
apt-rpm)
case $DISTRNAME in
ALTLinux)
docmd epm update
docmd epm install apt rpm
showcmd "TODO: change repo"
pkg_filenames= epm_repofix
__update_alt_repo_to_next_distro || exit
docmd epm Upgrade
docmd epm update-kernel
return
;;
*)
;;
esac
case $PMTYPE in
apt-rpm)
docmd epm update
info "Have no idea how to upgrade $DISTRNAME"
;;
*-dpkg)
sudocmd do-release-upgrade -d
......@@ -74,5 +121,4 @@ epm_release_upgrade()
;;
esac
sudocmd $CMD $pkg_filenames
}
......@@ -18,14 +18,18 @@
#
# FIXME
SUBST_ALT_RULE='s!^([^#].*)[/ ](ALTLinux|LINUX\@Etersoft)[/ ](Sisyphus|p7[/ ]branch|p6[/ ]branch)[/ ](x86_64|i586|x86_64-i586|noarch) !\1 \2/\3/\4 !gi'
SUBST_ALT_RULE='s!^([^#].*)[/ ](ALTLinux|LINUX\@Etersoft)[/ ](Sisyphus|p8[/ ]branch|p7[/ ]branch|p6[/ ]branch)[/ ](x86_64|i586|x86_64-i586|noarch) !\1 \2/\3/\4 !gi'
__fix_apt_sources_list()
{
[ -n "$SUDO" ] && fatal "run only under root"
local i
assure_root
for i in "$@" ; do
[ -s "$i" ] || continue
perl -i.bak -pe "$SUBST_ALT_RULE" $i
#perl -i.bak -pe "$SUBST_ALT_RULE" $i
# TODO: only for uncommented strings
#sed -i -r -e "$SUBST_ALT_RULE" $i
regexp_subst "/^ *#/! $SUBST_ALT_RULE" $i
done
}
......
......@@ -304,6 +304,33 @@ __get_package_for_command()
esac
}
# TODO:
confirm() {
local response
# call with a prompt string or use a default
read -r -p "${1:-Are you sure? [y/N]} " response
case $response in
[yY][eE][sS]|[yY])
true
;;
*)
false
;;
esac
}
assure_root()
{
[ "$EFFUID" = 0 ] || fatal "run me only under root"
}
regexp_subst()
{
local expression="$1"
shift
sed -i -r -e "$expression" "$@"
}
# TODO: we we can't use epm directly?
assure_exists()
{
......
# This spec is backported to ALTLinux p7 automatically by rpmbph script from etersoft-build-utils.
#
Name: eepm
Version: 1.6.3
Version: 1.6.4
Release: alt0.M70P.1
Summary: Etersoft EPM package manager
......@@ -67,9 +67,15 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}*
%_sysconfdir/bash_completion.d/cerv
%changelog
* Thu Apr 07 2016 Vitaly Lipatov <lav@altlinux.ru> 1.6.3-alt0.M70P.1
* Fri Apr 15 2016 Vitaly Lipatov <lav@altlinux.ru> 1.6.4-alt0.M70P.1
- backport to ALTLinux p7 (by rpmbph script)
* Fri Apr 15 2016 Vitaly Lipatov <lav@altlinux.ru> 1.6.4-alt1
- epm-repofix: use sed -r instead perl -pi
- pack_in_onefile: fix run positional load_helper
- initial support for upgrade ALT Linux release to p7 / p8
- fix repofix code
* Tue Apr 05 2016 Vitaly Lipatov <lav@altlinux.ru> 1.6.3-alt1
- epm-checksystem: add assure_exists time
- check_updated_repo fix epm update
......
......@@ -41,7 +41,7 @@ get_version()
filter_out()
{
grep -v "^load_helper " | sed -e 's|DISTRVENDOR=$PROGDIR/distr_info|DISTRVENDOR=internal_distr_info|g' | \
grep -v "^ *load_helper " | sed -e 's|DISTRVENDOR=$PROGDIR/distr_info|DISTRVENDOR=internal_distr_info|g' | \
sed -e "s|@VERSION@|$(get_version)|g"
}
......
......@@ -1033,7 +1033,6 @@ update_repo_if_needed()
cd /
if ! __is_repo_info_downloaded || ! __is_repo_info_uptodate ; then
load_helper epm-update
pkg_filenames= epm_update
fi
cd - >/dev/null
......@@ -1307,7 +1306,6 @@ epm_download()
__alt_local_content_filelist()
{
load_helper epm-sh-altlinux
local CI="$(get_local_alt_contents_index)"
......@@ -1848,7 +1846,6 @@ epm_install_files()
sudocmd pm install $@
return ;;
emerge)
load_helper epm-install-emerge
sudocmd epm_install_emerge $@
return ;;
pacman)
......@@ -2920,7 +2917,6 @@ epm_query_file()
[ -n "$pkg_filenames" ] || fatal "Run query without file names"
load_helper epm-search_file
for pkg in $pkg_filenames ; do
__do_query_real_file "$pkg"
......@@ -3332,7 +3328,8 @@ __fix_apt_sources_list()
[ -n "$SUDO" ] && fatal "run only under root"
for i in "$@" ; do
[ -s "$i" ] || continue
perl -i.bak -pe "$SUBST_ALT_RULE" $i
#perl -i.bak -pe "$SUBST_ALT_RULE" $i
sed -i -e -r "$SUBST_ALT_RULE" $i
done
}
......@@ -3686,7 +3683,6 @@ epm_search()
__alt_local_content_search()
{
load_helper epm-sh-altlinux
local CI="$(get_local_alt_contents_index)"
......@@ -3757,7 +3753,6 @@ docmd $CMD $pkg_filenames
get_local_alt_contents_index()
{
load_helper epm-repolist
epm_repolist | grep "rpm.*file:/" | sed -e "s|^rpm.*file:||g" | while read URL ARCH other ; do
test -d "$URL/$ARCH" || continue # fatal "Local mirror is not accessible via $URL/$ARCH"
......
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