Commit 5923058a authored by Vitaly Lipatov's avatar Vitaly Lipatov

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

parents 6d64a7be c47676e1
...@@ -36,7 +36,7 @@ __is_repo_info_uptodate() ...@@ -36,7 +36,7 @@ __is_repo_info_uptodate()
case $PMTYPE in case $PMTYPE in
apt-rpm) apt-rpm)
# apt-deb do not update lock file date # apt-deb do not update lock file date
if $SUDO [ -r /var/lib/apt/lists ] ; then if $SUDO test -r /var/lib/apt/lists ; then
local LOCKFILE=/var/lib/apt/lists/lock local LOCKFILE=/var/lib/apt/lists/lock
$SUDO test -r $LOCKFILE || return $SUDO test -r $LOCKFILE || return
# if repo older than 1 day, return false # if repo older than 1 day, return false
......
...@@ -31,7 +31,7 @@ __replace_alt_version_in_repo() ...@@ -31,7 +31,7 @@ __replace_alt_version_in_repo()
regexp_subst "/^ *#/! 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? # TODO: start with improve to [p8] - install some package firstly?
regexp_subst "/^ *#/! s s!\[$1\]![alt]/branch!g" $i regexp_subst "/^ *#/! s!\[$1\]![alt]/branch!g" $i
done done
docmd apt-repo list docmd apt-repo list
} }
...@@ -62,6 +62,7 @@ epm_release_upgrade() ...@@ -62,6 +62,7 @@ epm_release_upgrade()
ALTLinux) ALTLinux)
docmd epm update docmd epm update
docmd epm install apt rpm docmd epm install apt rpm
load_helper epm-repofix
pkg_filenames= epm_repofix pkg_filenames= epm_repofix
__update_alt_repo_to_next_distro || exit __update_alt_repo_to_next_distro || exit
docmd epm Upgrade docmd epm Upgrade
......
...@@ -17,11 +17,10 @@ ...@@ -17,11 +17,10 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
# FIXME
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() __fix_apt_sources_list()
{ {
local 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'
local i local i
assure_root assure_root
for i in "$@" ; do for i in "$@" ; do
......
...@@ -261,7 +261,7 @@ set_sudo() ...@@ -261,7 +261,7 @@ set_sudo()
[ $EFFUID = "0" ] && return [ $EFFUID = "0" ] && return
# use sudo if possible # use sudo if possible
which sudo >/dev/null 2>/dev/null && SUDO="sudo" && return which sudo >/dev/null 2>/dev/null && SUDO="sudo --" && return
SUDO="fatal 'Can't find sudo. Please install sudo or run epm under root.'" SUDO="fatal 'Can't find sudo. Please install sudo or run epm under root.'"
} }
......
# This spec is backported to ALTLinux p7 automatically by rpmbph script from etersoft-build-utils. # This spec is backported to ALTLinux p7 automatically by rpmbph script from etersoft-build-utils.
# #
Name: eepm Name: eepm
Version: 1.6.4 Version: 1.6.5
Release: alt0.M70P.1 Release: alt0.M70P.1
Summary: Etersoft EPM package manager Summary: Etersoft EPM package manager
...@@ -67,9 +67,13 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}* ...@@ -67,9 +67,13 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}*
%_sysconfdir/bash_completion.d/cerv %_sysconfdir/bash_completion.d/cerv
%changelog %changelog
* Fri Apr 15 2016 Vitaly Lipatov <lav@altlinux.ru> 1.6.4-alt0.M70P.1 * Fri Apr 15 2016 Vitaly Lipatov <lav@altlinux.ru> 1.6.5-alt0.M70P.1
- backport to ALTLinux p7 (by rpmbph script) - backport to ALTLinux p7 (by rpmbph script)
* Fri Apr 15 2016 Vitaly Lipatov <lav@altlinux.ru> 1.6.5-alt1
- restrict sudo args
- small fixes
* Fri Apr 15 2016 Vitaly Lipatov <lav@altlinux.ru> 1.6.4-alt1 * Fri Apr 15 2016 Vitaly Lipatov <lav@altlinux.ru> 1.6.4-alt1
- epm-repofix: use sed -r instead perl -pi - epm-repofix: use sed -r instead perl -pi
- pack_in_onefile: fix run positional load_helper - pack_in_onefile: fix run positional load_helper
......
...@@ -260,7 +260,7 @@ set_sudo() ...@@ -260,7 +260,7 @@ set_sudo()
[ $EFFUID = "0" ] && return [ $EFFUID = "0" ] && return
# use sudo if possible # use sudo if possible
which sudo >/dev/null 2>/dev/null && SUDO="sudo" && return which sudo >/dev/null 2>/dev/null && SUDO="sudo --" && return
SUDO="fatal 'Can't find sudo. Please install sudo or run epm under root.'" SUDO="fatal 'Can't find sudo. Please install sudo or run epm under root.'"
} }
...@@ -300,6 +300,32 @@ __get_package_for_command() ...@@ -300,6 +300,32 @@ __get_package_for_command()
esac esac
} }
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" "$@"
}
assure_exists() assure_exists()
{ {
load_helper epm-assure load_helper epm-assure
...@@ -968,7 +994,7 @@ epm_checksystem_ALTLinux() ...@@ -968,7 +994,7 @@ epm_checksystem_ALTLinux()
epm_checksystem() epm_checksystem()
{ {
[ -n "$SUDO" ] || fatal "Do not use checksystem under root" [ $EFFUID = "0" ] && fatal "Do not use checksystem under root"
case $DISTRNAME in case $DISTRNAME in
ALTLinux) ALTLinux)
...@@ -1009,7 +1035,7 @@ __is_repo_info_uptodate() ...@@ -1009,7 +1035,7 @@ __is_repo_info_uptodate()
case $PMTYPE in case $PMTYPE in
apt-rpm) apt-rpm)
# apt-deb do not update lock file date # apt-deb do not update lock file date
if $SUDO [ -r /var/lib/apt/lists ] ; then if $SUDO test -r /var/lib/apt/lists ; then
local LOCKFILE=/var/lib/apt/lists/lock local LOCKFILE=/var/lib/apt/lists/lock
$SUDO test -r $LOCKFILE || return $SUDO test -r $LOCKFILE || return
# if repo older than 1 day, return false # if repo older than 1 day, return false
...@@ -2999,20 +3025,67 @@ epm_reinstall() ...@@ -2999,20 +3025,67 @@ epm_reinstall()
} }
# File bin/epm-release-upgrade: # File bin/epm-release_upgrade:
__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() epm_release_upgrade()
{ {
assure_root
info "Starting upgrade whole system to the next release" info "Starting upgrade whole system to the next release"
info "Check also http://wiki.etersoft.ru/Admin/UpdateLinux" info "Check also http://wiki.etersoft.ru/Admin/UpdateLinux"
case $PMTYPE in case $DISTRNAME in
apt-rpm) ALTLinux)
docmd epm update docmd epm update
docmd epm install apt rpm 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 Upgrade
docmd epm update-kernel docmd epm update-kernel
return
;;
*)
;;
esac
case $PMTYPE in
apt-rpm)
docmd epm update
info "Have no idea how to upgrade $DISTRNAME"
;; ;;
*-dpkg) *-dpkg)
sudocmd do-release-upgrade -d sudocmd do-release-upgrade -d
...@@ -3058,7 +3131,6 @@ epm_release_upgrade() ...@@ -3058,7 +3131,6 @@ epm_release_upgrade()
;; ;;
esac esac
sudocmd $CMD $pkg_filenames
} }
# File bin/epm-remove: # File bin/epm-remove:
...@@ -3321,15 +3393,18 @@ esac ...@@ -3321,15 +3393,18 @@ esac
# File bin/epm-repofix: # File bin/epm-repofix:
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() __fix_apt_sources_list()
{ {
[ -n "$SUDO" ] && fatal "run only under root" local i
assure_root
for i in "$@" ; do for i in "$@" ; do
[ -s "$i" ] || continue [ -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 # TODO: only for uncommented strings
#sed -i -r -e "$SUBST_ALT_RULE" $i
regexp_subst "/^ *#/! $SUBST_ALT_RULE" $i
done done
} }
...@@ -4619,7 +4694,7 @@ $(get_help HELPOPT) ...@@ -4619,7 +4694,7 @@ $(get_help HELPOPT)
print_version() print_version()
{ {
echo "EPM package manager version 1.6.3" echo "EPM package manager version 1.6.4"
echo "Running on $($DISTRVENDOR) ('$PMTYPE' package manager uses '$PKGFORMAT' package format)" echo "Running on $($DISTRVENDOR) ('$PMTYPE' package manager uses '$PKGFORMAT' package format)"
echo "Copyright (c) Etersoft 2012-2015" echo "Copyright (c) Etersoft 2012-2015"
echo "This program may be freely redistributed under the terms of the GNU AGPLv3." echo "This program may be freely redistributed under the terms of the GNU AGPLv3."
......
...@@ -258,7 +258,7 @@ set_sudo() ...@@ -258,7 +258,7 @@ set_sudo()
[ $EFFUID = "0" ] && return [ $EFFUID = "0" ] && return
# use sudo if possible # use sudo if possible
which sudo >/dev/null 2>/dev/null && SUDO="sudo" && return which sudo >/dev/null 2>/dev/null && SUDO="sudo --" && return
SUDO="fatal 'Can't find sudo. Please install sudo or run epm under root.'" SUDO="fatal 'Can't find sudo. Please install sudo or run epm under root.'"
} }
...@@ -298,6 +298,32 @@ __get_package_for_command() ...@@ -298,6 +298,32 @@ __get_package_for_command()
esac esac
} }
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" "$@"
}
assure_exists() assure_exists()
{ {
load_helper epm-assure load_helper epm-assure
...@@ -1199,7 +1225,7 @@ $(get_help HELPOPT) ...@@ -1199,7 +1225,7 @@ $(get_help HELPOPT)
print_version() print_version()
{ {
echo "Service manager version 1.6.3" echo "Service manager version 1.6.4"
echo "Running on $($DISTRVENDOR)" echo "Running on $($DISTRVENDOR)"
echo "Copyright (c) Etersoft 2012, 2013, 2016" echo "Copyright (c) Etersoft 2012, 2013, 2016"
echo "This program may be freely redistributed under the terms of the GNU AGPLv3." echo "This program may be freely redistributed under the terms of the GNU AGPLv3."
......
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