Commit 2d38b639 authored by Vitaly Lipatov's avatar Vitaly Lipatov

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

parents 7b2ff647 cd55c5d7
FIXME: epm-install need realpath, missed on some systems
Lock a Specific Package
# zypper al ypbind
Remove Lock from a Package
# zypper rl ypbind
[18:21:12] <danil> Вот так можно:
RED='\033[0;31m' ; NC='\033[0m' b="b" ; echo -e "aba" | sed -e "s|${b}|\\${RED}${b}\\${NC}|g" | xargs -0 printf
[18:23:40] <danil> > Ты знаешь способы?
......
......@@ -240,6 +240,9 @@ check_command()
kernel-update|kernel-upgrade|update-kernel|upgrade-kernel) # HELPCMD: update system kernel to the last repo version
epm_cmd=kernel_update
;;
remove-old-kernels|remove-old-kernel) # HELPCMD: remove old system kernels (exclude current or last two kernels)
epm_cmd=remove_old_kernels
;;
# Other commands
clean) # HELPCMD: clean local package cache
......
......@@ -43,7 +43,7 @@ case $PMTYPE in
apt-dpkg|aptitude-dpkg)
assure_exists deborphan
showcmd deborphan
a= deborphan | sudocmd epm remove
a= deborphan | docmd epm remove
;;
#aura)
# sudocmd aura -Oj
......@@ -81,9 +81,15 @@ case $PMTYPE in
#pkgng)
# sudocmd pkg autoremove
# ;;
#zypper-rpm)
# sudocmd zypper clean
# ;;
zypper-rpm)
# https://www.linux.org.ru/forum/desktop/11931830
assure_exists zypper zypper 1.9.2
# For zypper < 1.9.2: zypper se -si | grep 'System Packages'
sudocmd zypper packages --orphaned
# FIXME: x86_64/i586 are duplicated
local PKGLIST=$(zypper packages --orphaned | tail -n +5 | cut -d \| -f 3 | sort -u)
sudocmd zypper remove --clean-deps $PKGLIST
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
......
......@@ -64,13 +64,12 @@ epm_autoremove()
case $DISTRNAME in
ALTLinux)
__epm_autoremove_altrpm
assure_exists remove-old-kernels update-kernel 0.9.9
sudocmd remove-old-kernels
docmd epm remove-old-kernels
if which nvidia-clean-driver 2>/dev/null ; then
sudocmd nvidia-clean-driver
fi
return
;;
*)
......@@ -120,9 +119,14 @@ case $PMTYPE in
pkgng)
sudocmd pkg autoremove
;;
#zypper-rpm)
# sudocmd zypper clean
# ;;
zypper-rpm)
# https://www.linux.org.ru/forum/desktop/11931830
assure_exists zypper zypper 1.9.3
sudocmd zypper packages --unneeded
# FIXME: x86_64/i586 are duplicated
local PKGLIST=$(zypper packages --unneeded | tail -n +5 | cut -d \| -f 3 | sort -u)
sudocmd zypper remove --clean-deps $PKGLIST
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
......
#!/bin/sh
#
# Copyright (C) 2012,2014 Etersoft
# Copyright (C) 2012,2014 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012,2014,2016 Etersoft
# Copyright (C) 2012,2014,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
......@@ -43,15 +43,15 @@ epm_clean()
case $PMTYPE in
apt-rpm)
sudocmd apt-get clean
__remove_alt_apt_cache_file
[ -n "$force" ] && __remove_alt_apt_cache_file
;;
apt-dpkg)
sudocmd apt-get clean
__remove_deb_apt_cache_file
[ -n "$force" ] && __remove_deb_apt_cache_file
;;
aptitude-dpkg)
sudocmd aptitude clean
__remove_deb_apt_cache_file
[ -n "$force" ] && __remove_deb_apt_cache_file
;;
yum-rpm)
sudocmd yum clean all
......
......@@ -28,6 +28,7 @@ __alt_local_content_filelist()
load_helper epm-sh-altlinux
local CI="$(get_local_alt_contents_index)"
[ -n "$CI" ] || fatal "Have no local contents index"
# TODO: safe way to use less
#local OUTCMD="less"
......@@ -35,7 +36,7 @@ __alt_local_content_filelist()
OUTCMD="cat"
{
[ -n "$USETTY" ] && echo "Search in $CI for $1..."
[ -n "$USETTY" ] && info "Search in $CI for $1..."
grep -h -- ".*$1$" $CI | sed -e "s|\(.*\)\t\(.*\)|\1|g"
} | $OUTCMD
}
......
......@@ -194,7 +194,7 @@ epm_ni_install_names()
sudocmd apt-get -y $noremove --force-yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" $APTOPTIONS install $@
return ;;
aptitude-dpkg)
sudocmd aptitde -y install $@
sudocmd aptitude -y install $@
return ;;
yum-rpm)
sudocmd yum -y $YUMOPTIONS install $@
......
......@@ -30,7 +30,7 @@ epm_kernel_update()
fi
assure_exists update-kernel update-kernel 0.9.9
sudocmd update-kernel $pkg_filenames || return
sudocmd remove-old-kernels $pkg_filenames
docmd epm remove-old-kernels $pkg_filenames || fatal
return ;;
esac
......
......@@ -93,7 +93,7 @@ epm_remove_names()
sudocmd snappy uninstall $@
return ;;
zypper-rpm)
sudocmd zypper remove $@
sudocmd zypper remove --clean-deps $@
return ;;
mpkg)
sudocmd mpkg remove $@
......@@ -160,7 +160,7 @@ epm_remove_nonint()
sudocmd yum -y remove $@
return ;;
zypper-rpm)
sudocmd zypper --non-interactive remove $@
sudocmd zypper --non-interactive remove --clean-deps $@
return ;;
slackpkg)
sudocmd /usr/sbin/slackpkg -batch=on -default_answer=yes remove $@
......
#!/bin/sh
#
# Copyright (C) 2016 Etersoft
# Copyright (C) 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
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
epm_remove_old_kernels()
{
case $DISTRNAME in
ALTLinux)
load_helper epm-query_package
if ! __epm_query_package kernel-image >/dev/null ; then
info "No installed kernel packages, skipping cleaning"
return
fi
assure_exists update-kernel update-kernel 0.9.9
sudocmd remove-old-kernels $pkg_filenames
return ;;
Ubuntu)
load_helper epm-query_package
if ! __epm_query_package linux-image >/dev/null ; then
info "No installed kernel packages, skipping cleaning"
return
fi
info "Note: it is enough to use eepm autoremove for old kernel removing..."
info "Check also http://ubuntuhandbook.org/index.php/2016/05/remove-old-kernels-ubuntu-16-04/"
# http://www.opennet.ru/tips/2980_ubuntu_apt_clean_kernel_packet.shtml
case $DISTRVERSION in
10.04|12.04|14.04|15.04|15.10)
assure_exists purge-old-kernels bikeshed
;;
*)
# since Ubuntu 16.04
assure_exists purge-old-kernels byobu
;;
esac
sudocmd purge-old-kernels $pkg_filenames
return ;;
Gentoo)
sudocmd emerge -P gentoo-sources
return ;;
esac
case $PMTYPE in
*)
fatal "Have no suitable command for $PMTYPE"
;;
esac
}
......@@ -22,13 +22,13 @@ __alt_local_content_search()
load_helper epm-sh-altlinux
local CI="$(get_local_alt_contents_index)"
[ -n "$CI" ] || fatal "Have no local contents index"
#local OUTCMD="less"
#[ -n "$USETTY" ] || OUTCMD="cat"
OUTCMD="cat"
{
[ -n "$USETTY" ] && echo "Search in $CI for $1..."
[ -n "$USETTY" ] && info "Search in $CI for $1..."
# note! tabulation below!
grep -h -- ".*$1.* " $CI | sed -e "s|\(.*\)\t\(.*\)|\2: \1|g"
} | $OUTCMD
......
......@@ -98,8 +98,22 @@ is_active_systemd && CMD="systemd"
SERVICETYPE=$CMD
ANYSERVICE=$(which anyservice 2>/dev/null >/dev/null)
ANYSERVDIR="/etc/systemd-lite"
ANYSYSDDIR="/lib/systemd/system"
}
is_anyservice()
{
local SERVICE="$1"
# not, if we have no anyservice at all
[ -n "$ANYSERVICE" ] || return 1
# not, if there is regular service with the name
[ -d "$INITDIR/$SERVICE" ] && return 1
# yes, if the service is anyservice driven
[ -r "$ANYSERVDIR/$SERVICE.service" ]
}
phelp()
......
......@@ -24,6 +24,9 @@ serv_common()
shift
case $SERVICETYPE in
service-chkconfig|service-upstart)
if is_anyservice $SERVICE ; then
fatal "Have no idea how to call anyservice service with args"
fi
sudocmd service $SERVICE "$@"
;;
service-initd|service-update)
......
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012, 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
......@@ -28,6 +28,10 @@ serv_disable()
case $SERVICETYPE in
service-chkconfig|service-upstart)
if is_anyservice $SERVICE ; then
sudocmd anyservice $SERVICE off
return
fi
sudocmd chkconfig $1 off
;;
service-initd|service-update)
......
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012, 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
......@@ -28,6 +28,11 @@ serv_enable()
case $SERVICETYPE in
service-chkconfig)
# can't use is_anyservice here
if [ ! -d "$INITDIR/$SERVICE" ] && [ -n "$ANYSERVICE" ] && [ -r "$ANYSYSDDIR/$SERVICE.service" ] ; then
sudocmd anyservice $SERVICE on
return
fi
sudocmd chkconfig --add $1 || return
sudocmd chkconfig $1 on
;;
......
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012, 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
......@@ -38,6 +38,11 @@ serv_list()
for i in $(serv_list_all) ; do
is_service_running $i >/dev/null && echo $i
done
# TODO: только запущенные
if [ -n "$ANYSERVICE" ] ; then
sudocmd anyservice list
return
fi
;;
esac
}
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012,2016 Etersoft
# Copyright (C) 2012,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
......@@ -24,6 +24,11 @@ serv_list_all()
service-chkconfig|service-upstart)
# service --status-all for Ubuntu/Fedora
sudocmd chkconfig --list | cut -f1
if [ -n "$ANYSERVICE" ] ; then
sudocmd anyservice list
return
fi
;;
service-initd|service-update)
sudocmd ls $INITDIR/ | grep -v README
......
......@@ -20,4 +20,5 @@
serv_print()
{
echo "Detected init system: $SERVICETYPE"
[ -n "$ANYSERVICE" ] && echo "anyservice is detected too"
}
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012, 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
......@@ -27,6 +27,10 @@ serv_restart()
case $SERVICETYPE in
service-chkconfig|service-upstart)
if is_anyservice $SERVICE ; then
sudocmd anyservice $SERVICE restart
return
fi
sudocmd service $SERVICE restart "$@"
;;
service-initd|service-update)
......
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012, 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
......@@ -25,6 +25,10 @@ serv_start()
case $SERVICETYPE in
service-chkconfig|service-upstart)
if is_anyservice $SERVICE ; then
sudocmd anyservice $SERVICE start
return
fi
sudocmd service $SERVICE start "$@"
;;
service-initd|service-update)
......
#!/bin/sh
#
# Copyright (C) 2012, 2013 Etersoft
# Copyright (C) 2012, 2013 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2013, 2016 Etersoft
# Copyright (C) 2012, 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
......@@ -22,6 +22,10 @@ is_service_running()
{
case $SERVICETYPE in
service-chkconfig|service-upstart)
if is_anyservice $SERVICE ; then
$SUDO anyservice $1 status >/dev/null
return
fi
$SUDO service $1 status >/dev/null
;;
service-initd|service-update)
......@@ -41,7 +45,11 @@ is_service_autostart()
{
case $SERVICETYPE in
service-chkconfig|service-upstart)
# FIXME: check for current runlevel
if is_anyservice $SERVICE ; then
# if is registered, assume it is autostarted
return 0
fi
# FIXME: check for current runlevel
LANG=C $SUDO chkconfig $1 --list | grep -q "[35]:on"
;;
service-initd|service-update)
......@@ -65,6 +73,10 @@ serv_status()
case $SERVICETYPE in
service-chkconfig|service-upstart)
if is_anyservice $SERVICE ; then
sudocmd anyservice $SERVICE status
return
fi
sudocmd service $SERVICE status "$@"
;;
service-update)
......
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012, 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
......@@ -25,6 +25,10 @@ serv_stop()
case $SERVICETYPE in
service-chkconfig|service-upstart)
if is_anyservice $SERVICE ; then
sudocmd anyservice $SERVICE stop
return
fi
sudocmd service $SERVICE stop "$@"
;;
service-initd|service-update)
......
......@@ -28,7 +28,7 @@ serv_try_restart()
case $SERVICETYPE in
service-chkconfig|service-upstart)
is_service_running $SERVICE || return 0
sudocmd service $SERVICE restart "$@"
docmd serv $SERVICE restart "$@"
;;
service-initd|service-update)
is_service_running $SERVICE || return 0
......
# This spec is backported to ALTLinux p8 automatically by rpmbph script from etersoft-build-utils.
#
Name: eepm
Version: 1.8.6
Version: 1.8.7
Release: alt0.M80P.1
Summary: Etersoft EPM package manager
......@@ -67,9 +67,16 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}*
%_sysconfdir/bash_completion.d/cerv
%changelog
* Tue Jul 19 2016 Vitaly Lipatov <lav@altlinux.ru> 1.8.6-alt0.M80P.1
* Sun Aug 14 2016 Vitaly Lipatov <lav@altlinux.ru> 1.8.7-alt0.M80P.1
- backport to ALTLinux p8 (by rpmbph script)
* Sun Aug 14 2016 Vitaly Lipatov <lav@altlinux.ru> 1.8.7-alt1
- realize autoorphans/autoremove for zypper >= 1.9.2 in SUSE
- introduce epm remove-old-kernels command
- epm clean: clean local repo cache only with --force
- serv: add anyservice support
- small fixes
* Tue Jul 19 2016 Vitaly Lipatov <lav@altlinux.ru> 1.8.6-alt1
- epm-sh-functions: fix sudo -- detection
- distr_info: add AstraLinux support
......
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