Commit 74d9fb44 authored by Vitaly Lipatov's avatar Vitaly Lipatov

serv: some anyssh fixes

parent c77dec4f
......@@ -104,6 +104,7 @@ ANYSYSDDIR="/lib/systemd/system"
}
# TODO: done it on anyservice part
is_anyservice()
{
local SERVICE="$1"
......@@ -111,8 +112,11 @@ is_anyservice()
[ -n "$ANYSERVICE" ] || return 1
# not, if there is regular service with the name
[ -d "$INITDIR/$SERVICE" ] && return 1
# yes, if the service is anyservice driven
[ -r "$ANYSERVDIR/$SERVICE.service" ]
# 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
}
......
......@@ -29,8 +29,7 @@ __serv_enable()
case $SERVICETYPE in
service-chkconfig)
# can't use is_anyservice here
if [ ! -d "$INITDIR/$SERVICE" ] && [ -n "$ANYSERVICE" ] && [ -r "$ANYSYSDDIR/$SERVICE.service" ] ; then
if is_anyservice $SERVICE ; then
sudocmd anyservice $SERVICE on
return
fi
......
......@@ -49,10 +49,12 @@ is_service_autostart()
case $SERVICETYPE in
service-chkconfig|service-upstart)
if is_anyservice $1 ; then
# if is registered, assume it is autostarted
return 0
if is_anyservice $1; then
# HACK: if is registered, assume it is autostarted
[ -r "$ANYSERVDIR/$SERVICE.service" ]
return
fi
# FIXME: check for current runlevel
LANG=C $SUDO chkconfig $1 --list | grep -q "[35]:on"
;;
......
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