blob: 08a3008c62a1d9b3a81a20b775fe1a8d4583f726 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#!/usr/bin/perl
use strict;
use lib qw(/usr/lib/libDrakX);
use common;
use detect_devices;
use Libconf qw(:functions);
use Libconf::Glueconf::Ups;
#------------------------------------------------------------------
# UPS autoconfig:
my $file = "/etc/ups/ups.conf";
my $struct = Libconf::Glueconf::Ups->new('ups.conf'); #Libconf::Glueconf::ups->new($file, 'ups', '');
detect_devices::probeSerialDevices();
foreach my $ups_device (detect_devices::getUPS()) {
my $str = $ups_device->{name} || $ups_device->{DESCRIPTION};
if (!exists $struct->{$str}) {
$struct->{$str}{port} = $ups_device->{port} || $ups_device->{DEVICE};
$struct->{$str}{driver} = $ups_device->{driver};
}
}
$struct->writeConf($file);
my $drivers_table = glob("/usr/share/doc/nut-*/docs/driver.list");
# driver list from nutupsdrv(8)
my @drivers = qw(apcsmart bcmxcp belkin bestferrups801-807 bestfortress bestuferrups bestups cyberpower dummycons etapro everups fentonups genericups hidups hp isbmex liebert masterguard mge-shut mge-utalk microdowell newapc oneac powercom powernet sec sms snmp-ups tripplite tripplitesu victronups);
|