34 lines
806 B
Plaintext
Raw Normal View History

#!/bin/bash
# another script is called before template-expand to set services
# this script is called to run /usr/libexec/nut-driver-enumerator.sh and start/stop drivers
# then traditionnal services2adjust
# enumerate / configure drivers
/usr/libexec/nut-driver-enumerator.sh
event=$1
if [[ $i == "post-upgrade" ]] ; then
exit 0
fi
if [[ $i == "bootstrap-console-save" ]] ; then
exit 0
fi
if [[ $(/sbin/e-smith/config getprop nut status || echo "disabled") == "disabled" ]] ; then
# if disabled stop them
for OUTPUT in $(/sbin/e-smith/config keys|grep nut-driver)
do
/usr/bin/systemctl stop $OUTPUT
done
exit 0
fi
# if we are there we want to restart / start them
for OUTPUT in $(/sbin/e-smith/config keys|grep nut-driver)
do
/usr/bin/systemctl restart $OUTPUT
done