Commit 3e86f9dd authored by Vitaly Lipatov's avatar Vitaly Lipatov

serv: check anyservice support against anyservice version 0.3

parent 93839cdd
...@@ -99,24 +99,15 @@ is_active_systemd && CMD="systemd" ...@@ -99,24 +99,15 @@ is_active_systemd && CMD="systemd"
SERVICETYPE=$CMD SERVICETYPE=$CMD
ANYSERVICE=$(which anyservice 2>/dev/null) ANYSERVICE=$(which anyservice 2>/dev/null)
ANYSERVDIR="/etc/systemd-lite"
ANYSYSDDIR="/lib/systemd/system"
} }
# TODO: done it on anyservice part # TODO: done it on anyservice part
is_anyservice() is_anyservice()
{ {
local SERVICE="$1" [ -n "$ANYSERVICE" ] || return
# not, if we have no anyservice at all # check if anyservice is exists and checkd returns true
[ -n "$ANYSERVICE" ] || return 1 $ANYSERVICE "$1" checkd 2>/dev/null
# not, if there is regular service with the name
[ -d "$INITDIR/$SERVICE" ] && return 1
# yes, the service is anyservice driven
[ -r "$ANYSERVDIR/$SERVICE.service" ] && return 0
# yes, the service can be anyservice driven
[ -r "$ANYSYSDDIR/$SERVICE.service" ] && return 0
return 1
} }
......
...@@ -40,7 +40,7 @@ serv_list() ...@@ -40,7 +40,7 @@ serv_list()
done done
# TODO: только запущенные # TODO: только запущенные
if [ -n "$ANYSERVICE" ] ; then if [ -n "$ANYSERVICE" ] ; then
sudocmd anyservice list sudocmd $ANYSERVICE list
return return
fi fi
;; ;;
......
...@@ -49,9 +49,8 @@ is_service_autostart() ...@@ -49,9 +49,8 @@ is_service_autostart()
case $SERVICETYPE in case $SERVICETYPE in
service-chkconfig|service-upstart) service-chkconfig|service-upstart)
if is_anyservice $1; then if is_anyservice $SERVICE; then
# HACK: if is registered, assume it is autostarted $ANYSERVICE $SERVICE isautostarted
[ -r "$ANYSERVDIR/$SERVICE.service" ]
return return
fi fi
......
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