Commit 3e30ebdb authored by Gleb F-Malinovskiy's avatar Gleb F-Malinovskiy Committed by Michael Shigorin

simply: simplify 50services script

parent 4e28b094
#!/bin/sh -x #!/bin/sh
# see also m-p-d::profiles/live/image-scripts.d/init3-services
SYSTEMCTL=/bin/systemctl #[ -x /bin/systemctl ] || exit 0
CHKCONFIG=/sbin/chkconfig #[ -x /bin/systemctl ] || exit 0
turn_on() { ENABLE="
if [ -x $SYSTEMCTL ]; then network
$SYSTEMCTL enable ${*}.service NetworkManager
else if [ -x $CHKCONFIG ]; then lvm2-monitor
$CHKCONFIG $* on mdadm
else "
exit 0
fi
fi
}
turn_off() { # NB: dnsmasq: https://bugzilla.altlinux.org/show_bug.cgi?id=18799
if [ -x $SYSTEMCTL ]; then # NB: sshd might be needed for some particular cases
$SYSTEMCTL disable ${*}.service DISABLE="
else if [ -x $CHKCONFIG ]; then sshd
$CHKCONFIG $* off "
else
exit 0
fi
fi
}
SERVICES_TO_ENABLE="NetworkManager" for i in $ENABLE; do
SERVICES_TO_DISABLE= [ -x /bin/systemctl ] && /bin/systemctl enable ${i}.service
[ -x /sbin/chkconfig ] && /sbin/chkconfig $i on
for i in $SERVICES_TO_ENABLE; do
turn_on $i;
done done
for i in $SERVICES_TO_DISABLE; do for i in $DISABLE; do
turn_off $i; [ -x /bin/systemctl ] && /bin/systemctl disable ${i}.service
[ -x /sbin/chkconfig ] && /sbin/chkconfig $i off
done done
: :
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