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"
SERVICETYPE=$CMD
ANYSERVICE=$(which anyservice 2>/dev/null)
ANYSERVDIR="/etc/systemd-lite"
ANYSYSDDIR="/lib/systemd/system"
}
# TODO: done it on anyservice part
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, 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
[ -n "$ANYSERVICE" ] || return
# check if anyservice is exists and checkd returns true
$ANYSERVICE "$1" checkd 2>/dev/null
}
......
......@@ -40,7 +40,7 @@ serv_list()
done
# TODO: только запущенные
if [ -n "$ANYSERVICE" ] ; then
sudocmd anyservice list
sudocmd $ANYSERVICE list
return
fi
;;
......
......@@ -49,9 +49,8 @@ is_service_autostart()
case $SERVICETYPE in
service-chkconfig|service-upstart)
if is_anyservice $1; then
# HACK: if is registered, assume it is autostarted
[ -r "$ANYSERVDIR/$SERVICE.service" ]
if is_anyservice $SERVICE; then
$ANYSERVICE $SERVICE isautostarted
return
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