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