* 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:
Jean-Philippe Pialasse 2025-05-17 01:11:29 -04:00
parent 4e61b36891
commit 21fed495e6
4 changed files with 39 additions and 19 deletions

View File

@ -5,7 +5,7 @@
# then traditionnal services2adjust # then traditionnal services2adjust
# enumerate / configure drivers # enumerate / configure drivers
/usr/libexec/nut-driver-enumerator.sh /usr/libexec/nut-driver-enumerator.sh 2>/dev/null
event=$1 event=$1
@ -17,6 +17,7 @@ if [[ $i == "bootstrap-console-save" ]] ; then
exit 0 exit 0
fi fi
# if disabled stop them
if [[ $(/sbin/e-smith/config getprop nut status || echo "disabled") == "disabled" ]] ; then if [[ $(/sbin/e-smith/config getprop nut status || echo "disabled") == "disabled" ]] ; then
# if disabled stop them # if disabled stop them
for OUTPUT in $(/sbin/e-smith/config keys|grep nut-driver) for OUTPUT in $(/sbin/e-smith/config keys|grep nut-driver)
@ -26,6 +27,17 @@ if [[ $(/sbin/e-smith/config getprop nut status || echo "disabled") == "disabled
exit 0 exit 0
fi fi
# if netclient stop them
if [[ $(/sbin/e-smith/config getprop nut Mode || echo "netclient") == "netclient" ]] ; then
# if disabled stop them
for OUTPUT in $(/sbin/e-smith/config keys|grep nut-driver)
do
/usr/bin/systemctl stop $OUTPUT 2>/dev/null
done
exit 0
fi
# if we are there we want to restart / start them # if we are there we want to restart / start them
for OUTPUT in $(/sbin/e-smith/config keys|grep nut-driver) for OUTPUT in $(/sbin/e-smith/config keys|grep nut-driver)
do do

View File

@ -3,6 +3,8 @@
foreach my $ups ( sort {$a cmp $b} @upses ) foreach my $ups ( sort {$a cmp $b} @upses )
{ {
my $nnut = ${$ups}; my $nnut = ${$ups};
my $status = $nnut{status} || "disabled";
next if $status eq "disabled";
my ($name )= $ups =~ /^nut-driver\@(.*)$/ ; my ($name )= $ups =~ /^nut-driver\@(.*)$/ ;
my $model = $nnut{Model} || "usbhid-ups"; my $model = $nnut{Model} || "usbhid-ups";
my $device = $nnut{Device} || "auto"; #"/var/lib/ups/hiddev0"; my $device = $nnut{Device} || "auto"; #"/var/lib/ups/hiddev0";

View File

@ -247,7 +247,7 @@ sub get_model_options {
sub get_ups_status { sub get_ups_status {
my $c = shift; my $c = shift;
$cdb = esmith::ConfigDB->open() || die("Couldn't open config db"); $cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
my $nutmode = $cdb->get_prop('nut', 'Mode','standalone'); my $nutmode = $cdb->get_prop('nut', 'Mode') || 'standalone';
if ($cdb->get_prop('nut', 'status', 'disabled') eq 'disabled'){ if ($cdb->get_prop('nut', 'status', 'disabled') eq 'disabled'){
return $c->l('nut_status_is_disabled') return $c->l('nut_status_is_disabled')
} elsif ($nutmode eq 'netclient'){ } elsif ($nutmode eq 'netclient'){

View File

@ -45,6 +45,12 @@
</span><br> </span><br>
--> -->
<span class=label>
%=l('nut_Nut_mode')
</span><span class=data>
%= $nut_data->{Nutmode}
</span><br>
% if ($nut_data->{Nutmode} eq "nutserver") { % if ($nut_data->{Nutmode} eq "nutserver") {
<div class=secondaryups> <div class=secondaryups>
<p><span class=label> <p><span class=label>