With a LuCI app (of which I have one written) ucification makes sense (and is in fact needed), so ucify the initscripts. Also, rather than making selection of things to include an image a matter of selecting compile-time config options, make optional things into seperate packages that are built in default builds, and leave selection of what to include or not up to the user (e.g. using ImageBuilder, or adding packages via opkg). Signed-off-by: Daniel Dickinson <lede@cshore.thecshore.com>
44 lines
825 B
Bash
Executable file
44 lines
825 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
|
|
}
|
|
|