Commit b1a0ca36 authored by Vitaly Lipatov's avatar Vitaly Lipatov

backported to M60P as 1.1.2-alt0.M60P.1 (with rpmbph script)

parents 41047965 ff094632
......@@ -5,13 +5,14 @@
#
_service_list()
{
COMPREPLY=( $( serv list-all 2>/dev/null ) )
COMPREPLY=( $( serv list-all 2>/dev/null ; echo "list list-all list-startup" ) )
COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
}
_service_usage_list()
{
COMPREPLY=( $( compgen -W '`serv ${prev##*/} 2>/dev/null | sed -e "y/|/ /" -ne "s/^.*\(U\|msg_u\)sage.*{\(.*\)}.*$/\2/p" `' -- "$cur" ) )
local USLIST=$(serv ${prev##*/} usage 2>/dev/null | sed -e "y/|/ /" -ne "s/^.*\(u\|U\|msg_u\)sage.*{\(.*\)}.*$/\2/p")
COMPREPLY=( $( compgen -W '$USLIST' -- "$cur" ) )
}
......
......@@ -20,15 +20,18 @@
# Start service
serv_start()
{
local SERVICE="$1"
shift
case $SERVICETYPE in
service-chkconfig|service-upstart)
sudocmd service $1 start
sudocmd service $SERVICE start "$@"
;;
service-initd|service-update)
sudocmd /etc/init.d/$1 start
sudocmd /etc/init.d/$SERVICE start "$@"
;;
systemd)
sudocmd systemctl start $1
sudocmd systemctl start "$SERVICE" "$@"
;;
*)
fatal "Do not known command for $SERVICETYPE"
......
......@@ -20,15 +20,18 @@
# Stop service
serv_stop()
{
local SERVICE="$1"
shift
case $SERVICETYPE in
service-chkconfig|service-upstart)
sudocmd service $1 stop
sudocmd service $SERVICE stop "$@"
;;
service-initd|service-update)
sudocmd /etc/init.d/$1 stop
sudocmd /etc/init.d/$SERVICE stop "$@"
;;
systemd)
sudocmd systemctl stop $1
sudocmd systemctl stop $SERVICE "$@"
;;
*)
fatal "Do not known command for $SERVICETYPE"
......
......@@ -22,17 +22,20 @@ load_helper serv-status
# Try restart service (if it is running)
serv_try_restart()
{
local SERVICE="$1"
shift
case $SERVICETYPE in
service-chkconfig|service-upstart)
is_service_running $1 || return 0
sudocmd service $1 restart
is_service_running $SERVICE || return 0
sudocmd service $SERVICE restart "$@"
;;
service-initd|service-update)
is_service_running $1 || return 0
sudocmd /etc/init.d/$1 restart
is_service_running $SERVICE || return 0
sudocmd /etc/init.d/$SERVICE restart "$@"
;;
systemd)
sudocmd systemctl try-restart $1
sudocmd systemctl try-restart $SERVICE "$@"
;;
*)
fatal "Do not known command for $SERVICETYPE"
......
......@@ -17,6 +17,11 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
_print_additional_usage()
{
echo "serv addition usage: {on|off|try-restart|usage}"
}
# Print usage of the service
serv_usage()
{
......@@ -40,4 +45,6 @@ serv_usage()
;;
esac
_print_additional_usage
}
# This spec is backported to ALTLinux p6 automatically by rpmbph script. Do not edit it.
#
Name: eepm
Version: 1.1.1
Version: 1.1.2
Release: alt0.M60P.1
Summary: Etersoft EPM package manager
......@@ -39,7 +39,7 @@ See detailed description here: http://wiki.etersoft.ru/EPM
%setup
%build
%__subst "s|@VERSION@|%version-%release|g" bin/epm
%__subst "s|@VERSION@|%version-%release|g" bin/epm bin/serv
%install
# install to datadir and so on
......@@ -60,9 +60,14 @@ install -m 0644 bash_completion/serv %buildroot%_sysconfdir/bash_completion.d/se
%_sysconfdir/bash_completion.d/serv
%changelog
* Tue Dec 11 2012 Vitaly Lipatov <lav@altlinux.ru> 1.1.1-alt0.M60P.1
* Thu Dec 13 2012 Vitaly Lipatov <lav@altlinux.ru> 1.1.2-alt0.M60P.1
- backport to ALTLinux p6 (by rpmbph script)
* Thu Dec 13 2012 Vitaly Lipatov <lav@altlinux.ru> 1.1.2-alt1
- serv: allow additional params for start, stop and try_restart
- spec: replace @VERSION@ in serv too
- add print our commands to bash completion, to print usage
* Mon Dec 10 2012 Vitaly Lipatov <lav@altlinux.ru> 1.1.1-alt1
- serv: add usage command
- add README
......
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