Commit 1841bca5 authored by Vitaly Lipatov's avatar Vitaly Lipatov

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

parents f207ecba ba7c9b33
--dump-options for write simple bash completition
add epm site / epmurl in replace to rpmurl
yum remove $(package-cleanup --orphans
......
......@@ -58,7 +58,7 @@ print_version()
{
echo "EPM package manager version @VERSION@"
echo "Running on $($DISTRVENDOR) ('$PMTYPE' package manager uses '$PKGFORMAT' package format)"
echo "Copyright (c) Etersoft 2012-2014"
echo "Copyright (c) Etersoft 2012-2015"
echo "This program may be freely redistributed under the terms of the GNU AGPLv3."
}
......@@ -246,7 +246,7 @@ check_command()
downgrade) # HELPCMD: downgrade [all] packages to the repo state
epm_cmd=downgrade
;;
download) # HELPCMD: download package(s) file to the current dir
download) # HELPCMD: download package(s) file to the current dir
epm_cmd=download
;;
simulate) # HELPCMD: simulate install with check requires
......@@ -255,6 +255,9 @@ check_command()
audit) # HELPCMD: audits installed packages against known vulnerabilities
epm_cmd=audit
;;
site|url) # HELPCMD: open package's site in a browser (use -p for open packages.altlinux.org site)
epm_cmd=site
;;
-V|checkpkg|integrity) # HELPCMD: check package file integrity (checksum)
epm_cmd=checkpkg
;;
......
......@@ -47,9 +47,9 @@ __epm_assure()
{
if is_dirpath "$1" ; then
if [ -r "$1" ] ; then
if [ -e "$1" ] ; then
if [ -n "$verbose" ] ; then
info "File $1 is exists."
info "File or directory $1 is already exists."
epm qf "$1"
fi
return 0
......@@ -57,7 +57,6 @@ __epm_assure()
[ -n "$2" ] || fatal "You need run with package name param when use with absolute path"
# TODO: below we install in some semimanual way
docmd epm --auto --skip-installed install "$2"
return
fi
......@@ -74,18 +73,13 @@ __epm_assure()
# TODO: use package name normalization
info "Installing appropriate package for $1 command..."
# TODO: why we can't use epm install here? it can be non interactive and skip-installed
# QUESTION: how we can this package is installed if its not?
load_helper epm-install
local PACKAGE="$2"
[ -n "$PACKAGE" ] || PACKAGE="$1"
#epm install $2
# copied from epm_install
local names="$(echo "$PACKAGE" | filter_out_installed_packages)"
local PACKAGEVERSION="$3"
warning "TODO: check for PACKAGEVERSION is missed"
non_interactive=1 epm_install_names $names
docmd epm --auto --skip-installed install "$PACKAGE"
}
......@@ -94,5 +88,5 @@ epm_assure()
[ -n "$pkg_filenames" ] || fatal "Assure: Missing params. Check $0 --help for info."
# use helper func for extract separate params
__epm_assure $pkg_filenames
__epm_assure $(eval echo $quoted_args)
}
#!/bin/sh
#
# Copyright (C) 2014 Etersoft
# Copyright (C) 2014 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2014, 2015 Etersoft
# Copyright (C) 2014, 2015 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,8 @@ __is_repo_info_download()
if [ -r /var/cache/apt ] ; then
# FIXME: only if root permissions
test -r /var/cache/apt/pkgcache.bin || return
# if repo older than 1 day, return false
test -n "$(find /var/cache/apt/pkgcache.bin -ctime +1)" || return
fi
;;
*)
......
......@@ -19,17 +19,15 @@
# copied from etersoft-build-utils/bin/rpmqf
# use and modify TOFILE recursively
__do_query_real_file()
{
local LINKTO1 LINKTO
local TOFILE
# get canonical path
if [ -e "$1" ] ; then
TOFILE=$1
TOFILE="$1"
else
TOFILE=`which $1 2>/dev/null || echo $1`
TOFILE=$(which "$1" 2>/dev/null || echo "$1")
if [ "$TOFILE" != "$1" ] ; then
info "Note: $1 is placed as $TOFILE"
fi
......@@ -37,10 +35,12 @@ __do_query_real_file()
# get value of symbolic link
if [ -L "$TOFILE" ] ; then
__do_query $TOFILE
LINKTO=`readlink "$TOFILE"`
local LINKTO
__do_query "$TOFILE"
LINKTO=$(readlink -f "$TOFILE")
info "Note: $TOFILE is link to $LINKTO"
__do_query_real_file "$LINKTO"
return
fi
FULLFILEPATH="$TOFILE"
......@@ -158,7 +158,7 @@ epm_query_file()
for pkg in $pkg_filenames ; do
__do_query_real_file "$pkg"
__do_query $FULLFILEPATH || pkg_filenames=$FULLFILEPATH epm_search_file
__do_query "$FULLFILEPATH" || pkg_filenames="$FULLFILEPATH" epm_search_file
done
}
......@@ -36,8 +36,7 @@ __check_yum_result()
{
grep "^No package" $1 && return 1
grep "^Complete!" $1 && return 0
grep "^Exiting on user Command" $1 && return 0
grep "^Exiting on user command" $1 && return 0
grep "Exiting on user [Cc]ommand" $1 && return 0
# dnf issue
grep "^Operation aborted." $1 && return 0
# return default result by default
......
#!/bin/sh
#
# Copyright (C) 2015 Etersoft
# Copyright (C) 2015 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/>.
#
load_helper epm-query
run_command_if_exists()
{
local CMD="$1"
shift
if which "$CMD" 2>/dev/null >/dev/null ; then
docmd "$CMD" "$@"
return 0
fi
return 1
}
open_browser()
{
local i
for i in xdg-open firefox chromium links ; do
run_command_if_exists $i "$@" && return
done
}
# FIXME: Copied from etersoft-build-utils
# Query variables from rpm package
querypackage()
{
local FORMAT="%{$2}"
local INSTALLED="-p"
# if name empty, use third param as format string
[ -n "$2" ] || FORMAT="$3"
# if not file, drop -p for get from rpm base
[ -e "$1" ] || INSTALLED=""
rpmquery $INSTALLED --queryformat "$FORMAT" $1
}
# FIXME: Copied from etersoft-build-utils
# return source package name by binary rpm package file
get_sourcepkg_name()
{
local FILE="$1"
local PKGVERSION=$(querypackage "$FILE" VERSION)
querypackage "$FILE" sourcerpm | sed -e "s|-$PKGVERSION.*||g"
}
query_package_url()
{
local URL
case $PMTYPE in
*-rpm)
querypackage "$1" URL
#LANG=C epm info "$1"
return
;;
esac
fatal "rpm based distro supported only. TODO: Realize via web service?"
}
get_locale()
{
local loc
loc=$(a= natspec --locale 2>/dev/null)
[ -n "$loc" ] || loc=$LANG
echo $loc
}
get_pao_url()
{
local loc
loc=$(get_locale | cut -c1-2)
case $loc in
en|ru|uk|br)
loc=$loc
;;
*)
loc=en
esac
echo "http://packages.altlinux.org/$loc/Sisyphus/srpms"
}
query_altlinux_url()
{
local URL
case $PMTYPE in
*-rpm)
local srpm=$(get_sourcepkg_name "$1")
[ -n "$srpm" ] || fatal "Can't get source name for $1"
echo "$(get_pao_url)/$srpm"
return
;;
esac
fatal "rpm based distro supported only. TODO: Realize via web service?"
}
epm_site()
{
[ -n "$pkg_filenames" ] || fatal "Info: missing package(s) name"
PAO=
for f in $pkg_names $pkg_files ; do
[ "$f" = "-p" ] && PAO="$f" && continue
if [ -n "$PAO" ] ; then
pkg_url=$(query_altlinux_url $f)
else
pkg_url=$(query_package_url $f)
fi
[ -n "$pkg_url" ] && open_browser "$pkg_url" && continue
warning "Can't get URL for $f package"
done
#for f in $pkg_names ; do
# LANG=C epm info $f
#done
# TODO: -p for p.a.o (see rpmurl)
}
# This spec is backported to ALTLinux p7 automatically by rpmbph script. Do not edit it.
#
Name: eepm
Version: 1.5.13
Version: 1.5.16
Release: alt0.M70P.1
Summary: Etersoft EPM package manager
......@@ -67,9 +67,21 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}*
%_sysconfdir/bash_completion.d/cerv
%changelog
* Tue Jul 21 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.13-alt0.M70P.1
* Sun Aug 16 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.16-alt0.M70P.1
- backport to ALTLinux p7 (by rpmbph script)
* Sun Aug 16 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.16-alt1
- run update if repo info older than 1 day
- epm-query_file: fix read link
- add epm url|site command (with -p arg for open at packages.altlinux.org)
* Wed Aug 12 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.15-alt1
- epm-assure: fix for dir checking support
- epm query file: fix recursion result and more quoting
* Fri Jul 24 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.14-alt1
- simulate: allow Exiting on user Command in any place of the line
* Tue Jul 21 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.13-alt1
- epm-assure: add support for checking any path on a file system
- small fixes
......
......@@ -306,7 +306,7 @@ assure_exists()
eget()
{
$PROGDIR/tools-eget "$@"
$SHAREDIR/tools-eget "$@"
}
get_package_type()
......@@ -400,7 +400,7 @@ case $DISTRNAME in
;;
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific)
CMD="yum-rpm"
#which dnf 2>/dev/null >/dev/null && CMD=dnf-rpm
which dnf 2>/dev/null >/dev/null && test -d /var/lib/dnf/yumdb && CMD=dnf-rpm
;;
Slackware)
CMD="slackpkg"
......@@ -484,10 +484,37 @@ __check_command_in_path()
}
rhas()
{
echo "$1" | egrep -q -- "$2"
}
is_dirpath()
{
[ "$1" = "." ] && return $?
rhas "$1" "/"
}
__epm_assure()
{
if is_dirpath "$1" ; then
if [ -e "$1" ] ; then
if [ -n "$verbose" ] ; then
info "File or directory $1 is already exists."
epm qf "$1"
fi
return 0
fi
[ -n "$2" ] || fatal "You need run with package name param when use with absolute path"
docmd epm --auto --skip-installed install "$2"
return
fi
if __check_command_in_path "$1" >/dev/null ; then
if [ -n "$verbose" ] ; then
local compath="$(__check_command_in_path "$1")"
......@@ -500,16 +527,13 @@ __epm_assure()
# TODO: use package name normalization
info "Installing appropriate package for $1 command..."
load_helper epm-install
local PACKAGE="$2"
[ -n "$PACKAGE" ] || PACKAGE="$1"
#epm install $2
# copied from epm_install
local names="$(echo "$PACKAGE" | filter_out_installed_packages)"
local PACKAGEVERSION="$3"
warning "TODO: check for PACKAGEVERSION is missed"
non_interactive=1 epm_install_names $names
docmd epm --auto --skip-installed install "$PACKAGE"
}
......@@ -518,7 +542,7 @@ epm_assure()
[ -n "$pkg_filenames" ] || fatal "Assure: Missing params. Check $0 --help for info."
# use helper func for extract separate params
__epm_assure $pkg_filenames
__epm_assure $(eval echo $quoted_args)
}
# File bin/epm-audit:
......@@ -536,6 +560,64 @@ esac
}
# File bin/epm-autoorphans:
epm_autoorphans()
{
case $PMTYPE in
#apt-rpm)
# ALT Linux only
#__epm_autoremove_altrpm
# ALT Linux only
#assure_exists remove-old-kernels
#sudocmd remove-old-kernels
# ;;
apt-dpkg|aptitude-dpkg)
assure_exists deborphan
showcmd deborphan
deborphan | sudocmd epm remove
;;
#aura)
# sudocmd aura -Oj
# ;;
yum-rpm)
showcmd package-cleanup --orphans
local PKGLIST=$(package-cleanup --orphans)
sudocmd epm remove $PKGLIST
;;
urpm-rpm)
showcmd urpmq --auto-orphans
sudocmd urpme --auto-orphans
;;
#emerge)
# sudocmd emerge --depclean
# assure_exists revdep-rebuild
# sudocmd revdep-rebuild
# ;;
pacman)
sudocmd pacman -Qdtq | sudocmd pacman -Rs -
;;
#slackpkg)
# clean-system removes non official packages
#sudocmd slackpkg clean-system
# ;;
#guix)
# sudocmd guix gc
# ;;
#pkgng)
# sudocmd pkg autoremove
# ;;
#zypper-rpm)
# sudocmd zypper clean
# ;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
esac
}
# File bin/epm-autoremove:
__epm_autoremove_altrpm()
......@@ -560,10 +642,11 @@ epm_autoremove()
{
case $PMTYPE in
apt-rpm)
assure_exists remove-old-kernels
# ALT Linux only
__epm_autoremove_altrpm
# ALT Linux only
assure_exists remove-old-kernels
sudocmd remove-old-kernels
;;
apt-dpkg|aptitude-dpkg)
......@@ -582,17 +665,19 @@ case $PMTYPE in
sudocmd yum remove $PKGLIST
done
;;
urpm-rpm)
sudocmd urpme --auto-orphans
;;
# see autoorhans
#urpm-rpm)
# sudocmd urpme --auto-orphans
# ;;
emerge)
sudocmd emerge --depclean
assure_exists revdep-rebuild
sudocmd revdep-rebuild
;;
pacman)
sudocmd pacman -Qdtq | sudocmd pacman -Rs -
;;
# see autoorhans
#pacman)
# sudocmd pacman -Qdtq | sudocmd pacman -Rs -
# ;;
slackpkg)
# clean-system removes non official packages
#sudocmd slackpkg clean-system
......@@ -645,7 +730,7 @@ __epm_changelog_local_names()
[ -z "$*" ] && return
case $PMTYPE in
apt-rpm|yum-rpm|urpm-rpm|zypper-rpm)
apt-rpm|yum-rpm|dnf-rpm|urpm-rpm|zypper-rpm)
docmd_foreach "rpm --changelog" $@ | less
;;
apt-dpkg|aptitude-dpkg)
......@@ -1040,6 +1125,9 @@ epm_downgrade()
# can do update repobase automagically
sudocmd yum downgrade $pkg_filename
;;
dnf-rpm)
sudocmd dnf downgrade $pkg_filename
;;
urpm-rpm)
assure_exists urpm-reposync urpm-tools
sudocmd urpm-reposync -v
......@@ -1050,6 +1138,22 @@ epm_downgrade()
esac
}
# File bin/epm-download:
epm_download()
{
local CMD
case $PMTYPE in
dnf-rpm)
sudocmd dnf download $pkg_filename
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
esac
}
# File bin/epm-filelist:
......@@ -1080,6 +1184,11 @@ __epm_filelist_remote()
# TODO: use RESTful interface to prometeus? See ALT bug #29496
docmd_foreach __alt_local_content_filelist $@
;;
apt-dpkg)
assure_exists apt-file
sudocmd apt-file update
docmd apt-file list $@
;;
*)
fatal "Query filelist for non installed packages does not realized"
;;
......@@ -1161,6 +1270,7 @@ __epm_filelist_name()
# TODO: add less
docmd $CMD $pkg_names && return
# TODO: may be we need check is installed before prev. line?
is_installed $pkg_names || __epm_filelist_remote $pkg_names
}
......@@ -1433,6 +1543,9 @@ epm_ni_install_names()
yum-rpm)
sudocmd yum -y $YUMOPTIONS install $@
return ;;
dnf-rpm)
sudocmd dnf -y $YUMOPTIONS install $@
return ;;
urpm-rpm)
sudocmd urpmi --auto $URPMOPTIONS $@
return ;;
......@@ -1650,12 +1763,17 @@ epm_install()
# Download urls via eget pkg_urls and use eget
# TODO: use optimization (rpm can download packages by url, yum too?)
download_pkg_urls "$pkg_urls"
#[ -n "$pkg_urls" ] && warning "URL using does not realize yet"
#download_pkg_urls "$pkg_urls"
# temp. hack
pkg_files="$pkg_files $pkg_urls"
# TODO: add downloaded files to $pkg_files
[ -z "$pkg_files$pkg_names" ] && info "Skip empty install list" && return 22
[ -z "$pkg_files$pkg_names$pkg_urls" ] && info "Skip empty install list" && return 22
local names="$(echo $pkg_names | filter_out_installed_packages)"
local files="$(echo $pkg_files | filter_out_installed_packages)"
local urls="$(echo $pkg_urls | filter_out_installed_packages)"
[ -z "$files$names" ] && info "Skip empty install list" && return 22
......@@ -1925,6 +2043,7 @@ epm_programs()
epm_provides_files()
{
local pkg_files="$@"
[ -n "$pkg_files" ] || return
local PKGTYPE="$(get_package_type $pkg_files)"
......@@ -1948,6 +2067,7 @@ epm_provides_files()
epm_provides_names()
{
local pkg_names="$@"
local CMD
[ -n "$pkg_names" ] || return
......@@ -2002,8 +2122,8 @@ epm_provides()
{
[ -n "$pkg_filenames" ] || fatal "Provides: missing package(s) name"
epm_provides_files
epm_provides_names
epm_provides_files $pkg_files
epm_provides_names $pkg_names
}
# File bin/epm-query:
......@@ -2177,14 +2297,13 @@ epm_query()
__do_query_real_file()
{
local LINKTO1 LINKTO
local TOFILE
# get canonical path
if [ -e "$1" ] ; then
TOFILE=$1
TOFILE="$1"
else
TOFILE=`which $1 2>/dev/null || echo $1`
TOFILE=$(which "$1" 2>/dev/null || echo "$1")
if [ "$TOFILE" != "$1" ] ; then
info "Note: $1 is placed as $TOFILE"
fi
......@@ -2192,10 +2311,12 @@ __do_query_real_file()
# get value of symbolic link
if [ -L "$TOFILE" ] ; then
__do_query $TOFILE
LINKTO=`readlink "$TOFILE"`
local LINKTO
__do_query "$TOFILE"
LINKTO=$(readlink "$TOFILE")
info "Note: $TOFILE is link to $LINKTO"
__do_query_real_file "$LINKTO"
return
fi
FULLFILEPATH="$TOFILE"
......@@ -2226,7 +2347,7 @@ __do_query()
showcmd dpkg -S $1
dpkg_print_name_version $(dpkg -S $1 | grep -v "^diversion by" | sed -e "s|:.*||")
return ;;
yum-rpm|urpm-rpm)
yum-rpm|dnf-rpm|urpm-rpm)
CMD="rpm -qf"
;;
zypper-rpm)
......@@ -2313,7 +2434,7 @@ epm_query_file()
for pkg in $pkg_filenames ; do
__do_query_real_file "$pkg"
__do_query $FULLFILEPATH || pkg_filenames=$FULLFILEPATH epm_search_file
__do_query "$FULLFILEPATH" || pkg_filenames="$FULLFILEPATH" epm_search_file
done
}
......@@ -2765,6 +2886,7 @@ esac
epm_requires_files()
{
local pkg_files="$@"
[ -n "$pkg_files" ] || return
local PKGTYPE="$(get_package_type $pkg_files)"
......@@ -2786,6 +2908,7 @@ epm_requires_files()
epm_requires_names()
{
local pkg_names="$@"
local CMD
[ -n "$pkg_names" ] || return
......@@ -2844,8 +2967,8 @@ docmd $CMD $pkg_names
epm_requires()
{
[ -n "$pkg_filenames" ] || fatal "Requires: missing package(s) name"
epm_requires_files
epm_requires_names
epm_requires_files $pkg_files
epm_requires_names $pkg_names
}
# File bin/epm-search:
......@@ -3091,8 +3214,9 @@ __check_yum_result()
{
grep "^No package" $1 && return 1
grep "^Complete!" $1 && return 0
grep "^Exiting on user Command" $1 && return 0
grep "^Exiting on user command" $1 && return 0
grep "Exiting on user [Cc]ommand" $1 && return 0
# dnf issue
grep "^Operation aborted." $1 && return 0
# return default result by default
return $2
}
......@@ -3133,6 +3257,12 @@ EOF
RES=$?
clean_store_output
return $RES ;;
dnf-rpm)
LC_ALL=C store_output sudocmd dnf --assumeno install $filenames
__check_yum_result $RC_STDOUT $?
RES=$?
clean_store_output
return $RES ;;
urpm-rpm)
CMD="urpmi --test --auto"
;;
......@@ -3223,7 +3353,12 @@ case $PMTYPE in
sudocmd aptitude update || exit
;;
yum-rpm)
sudocmd yum check-update
info "update command is stubbed for yum"
#sudocmd yum check-update
;;
dnf-rpm)
info "update command is stubbed for dnf"
#sudocmd dnf check-update
;;
urpm-rpm)
sudocmd urpmi.update -a
......@@ -3763,9 +3898,9 @@ $(get_help HELPOPT)
print_version()
{
echo "EPM package manager version 1.5.10"
echo "EPM package manager version 1.5.15"
echo "Running on $($DISTRVENDOR) ('$PMTYPE' package manager uses '$PKGFORMAT' package format)"
echo "Copyright (c) Etersoft 2012-2014"
echo "Copyright (c) Etersoft 2012-2015"
echo "This program may be freely redistributed under the terms of the GNU AGPLv3."
}
......@@ -3941,6 +4076,9 @@ check_command()
autoremove) # HELPCMD: auto remove unneeded package(s)
epm_cmd=autoremove
;;
autoorphans|--orphans) # HELPCMD: remove all packages not from the repository
epm_cmd=autoorphans
;;
upgrade|dist-upgrade) # HELPCMD: performs upgrades of package software distributions
epm_cmd=upgrade
;;
......@@ -3950,6 +4088,9 @@ check_command()
downgrade) # HELPCMD: downgrade [all] packages to the repo state
epm_cmd=downgrade
;;
download) # HELPCMD: download package(s) file to the current dir
epm_cmd=download
;;
simulate) # HELPCMD: simulate install with check requires
epm_cmd=simulate
;;
......@@ -4023,7 +4164,7 @@ check_filenames()
elif [ -d "$opt" ] ; then
pkg_dirs="$pkg_dirs $opt"
elif echo "$opt" | grep -q "://" ; then
pkg_urls="$pkg_names $opt"
pkg_urls="$pkg_urls $opt"
else
pkg_names="$pkg_names $opt"
fi
......@@ -4051,10 +4192,11 @@ fi
pkg_files=$(strip_spaces "$pkg_files")
pkg_dirs=$(strip_spaces "$pkg_dirs")
pkg_names=$(strip_spaces "$pkg_names")
# in common case dirs equals to names only suddenly
pkg_names=$(strip_spaces "$pkg_names $pkg_dirs")
pkg_urls=$(strip_spaces "$pkg_urls")
pkg_filenames=$(strip_spaces "$pkg_files $pkg_dirs $pkg_names")
pkg_filenames=$(strip_spaces "$pkg_files $pkg_names")
# Just debug
#echover "command: $epm_cmd"
......
......@@ -304,7 +304,7 @@ assure_exists()
eget()
{
$PROGDIR/tools-eget "$@"
$SHAREDIR/tools-eget "$@"
}
get_package_type()
......@@ -398,7 +398,7 @@ case $DISTRNAME in
;;
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific)
CMD="yum-rpm"
#which dnf 2>/dev/null >/dev/null && CMD=dnf-rpm
which dnf 2>/dev/null >/dev/null && test -d /var/lib/dnf/yumdb && CMD=dnf-rpm
;;
Slackware)
CMD="slackpkg"
......@@ -574,6 +574,30 @@ serv_list_startup()
esac
}
# File bin/serv-restart:
serv_restart()
{
local SERVICE="$1"
shift
case $SERVICETYPE in
service-chkconfig|service-upstart)
sudocmd service $SERVICE restart "$@"
;;
service-initd|service-update)
sudocmd $INITDIR/$SERVICE restart "$@"
;;
systemd)
sudocmd systemctl restart $SERVICE "$@"
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
esac
}
# File bin/serv-start:
serv_start()
......@@ -1147,7 +1171,7 @@ $(get_help HELPOPT)
print_version()
{
echo "Service manager version 1.5.10"
echo "Service manager version 1.5.15"
echo "Running on $($DISTRVENDOR)"
echo "Copyright (c) Etersoft 2012, 2013"
echo "This program may be freely redistributed under the terms of the GNU AGPLv3."
......@@ -1182,7 +1206,9 @@ check_command()
serv_cmd=usage
withoutservicename=1
;;
#restart) # HELPCMD: restart service
restart) # HELPCMD: restart service
serv_cmd=restart
;;
#reload) # HELPCMD: reload service
start) # HELPCMD: start service
serv_cmd=start
......
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