* Tue Mar 18 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-9.sme

- update config for Nut 2.8.2 [SME: 12657]
  TODO review master/slave mode
  TODO convert master/slave to primary/secondary
  TODO convert to new config data + migrate
  TODO event and action
This commit is contained in:
2025-05-17 00:44:43 -04:00
parent 4743293464
commit 4e61b36891
9 changed files with 154 additions and 71 deletions

View File

@@ -1,18 +1,33 @@
#!/bin/bash
#if MODE = netserver then access should be private
#if MODE = netclient only enable monitor
# calling this script to configure unit and drivers
if [[ $(/sbin/e-smith/config getprop nut status || echo "disabled") == "disabled" ]] ; then
# disable server
# leave monitor as is, we might want to monitor an external ups ?
# get_all_by_prop filter nut-driver@ and foreach $UPS disabled
exit 0;
fi
# nut is enabled
# enable nut-monitor
# enable nut-server "enable nut-server.service\n" if ($master eq 'yes');
# get_all_by_prop filter nut-driver@ and foreach $UPS enable.
# 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