mirror of
https://github.com/novatiq/packages.git
synced 2026-06-27 07:40:27 +01:00
bb1b12733e
Backport and squash the following commits from master:5790053ebnut: Add missing conffilesceff68837nut: Reorganize nut-server to clarify nut-driverf6a2a97d2nut: Use 'real' procd init for nut-monitor918a62f91nut: Make FSD really worka2f64b3banut: Reduce user error with POWERDOWNFLAG461393810nut: Use quotes around filenames1b6dbe7a7nut: Remove duplicate/extraneous lines0a49d0ffbnut: Fix checking for path before it exists3b5a8eee8nut: Various startup fixes for monitor and server44e57d4bdnut: Fix variables for NUT drivers36fd59dc7nut: Fix extraneous config_get192b0f164nut: Fix a typo in setting a driver parameterf48b060fanut: Fix upsd runs as root And bump PKG_RELEASE Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
45 lines
827 B
Bash
Executable File
45 lines
827 B
Bash
Executable File
#!/bin/sh /etc/rc.common
|
|
# Copyright © 2012 OpenWrt.org
|
|
#
|
|
# This is free software, licensed under the GNU General Public License v2.
|
|
# See /LICENSE for more information.
|
|
#
|
|
START=51
|
|
|
|
DEFAULT=/etc/default/nut
|
|
UPSCGI_C=/var/etc/nut/hosts.conf
|
|
|
|
nut_upscgi_add() {
|
|
local cfg="$1"
|
|
local upsname
|
|
local hostname
|
|
local port
|
|
local displayname
|
|
|
|
config_get upsname "$cfg" upsname
|
|
config_get hostname "$cfg" hostname localhost
|
|
config_get port "$cfg" port
|
|
config_get pass "$cfg" password
|
|
system="$upsname@$hostname"
|
|
if [ -n "$port" ]; then
|
|
system="$system:$port";
|
|
fi
|
|
config_get displayname "$cfg" displayname
|
|
echo "MONITOR $system \"$displayname\"" >> "$UPSCGI_C"
|
|
}
|
|
|
|
start() {
|
|
rm -f $UPSCGI_C
|
|
|
|
config_load nut_cgi
|
|
|
|
config_foreach nut_upscgi_add host
|
|
|
|
chmod 640 /var/etc/nut/hosts.conf
|
|
}
|
|
|
|
stop() {
|
|
rm -f $UPSCGI_C
|
|
}
|
|
|