summaryrefslogtreecommitdiffstats
path: root/source/a/sysvinit-scripts
diff options
context:
space:
mode:
Diffstat (limited to 'source/a/sysvinit-scripts')
-rw-r--r--source/a/sysvinit-scripts/scripts/rc.638
-rw-r--r--source/a/sysvinit-scripts/scripts/rc.M32
-rwxr-xr-xsource/a/sysvinit-scripts/sysvinit-scripts.SlackBuild2
3 files changed, 44 insertions, 28 deletions
diff --git a/source/a/sysvinit-scripts/scripts/rc.6 b/source/a/sysvinit-scripts/scripts/rc.6
index 21b5c4782..5fec619c0 100644
--- a/source/a/sysvinit-scripts/scripts/rc.6
+++ b/source/a/sysvinit-scripts/scripts/rc.6
@@ -323,27 +323,33 @@ fi
# This is to ensure all processes have completed on SMP machines:
wait
-if [ -x /sbin/genpowerd -a -z "$container" ]; then
- # See if this is a powerfail situation:
- if grep -E -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then
- # Signal UPS to shut off the inverter:
- /sbin/genpowerd -k
- if [ ! $? = 0 ]; then
- echo
- echo "There was an error signaling the UPS."
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"
- echo "the serial line and UPS type."
- # Wasting 15 seconds of precious power:
- /bin/sleep 15
- fi
- fi
-fi
-
if [ "$container" = "lxc" ]; then
# Confirm successful shutdown of the container:
echo "LXC container stopped."
fi
+# NUT UPS inverter shutdown support:
+# If we see a file /etc/killpower, that means we want to shut off the UPS
+# inverter on the way down. This will save as much battery power as possible
+# and avoid unnecessary full-drain/full-recharge cycles.
+if [ -e /etc/killpower -a -z "$container" ]; then
+ # First we need to restart udev or we won't be able to contact the UPS:
+ echo "Restarting udev to be able to shut the UPS inverter off..."
+ /etc/rc.d/rc.udev start
+ # Wasting precious battery power:
+ sleep 10
+ echo "Shutting down UPS inverter..."
+ upsdrvctl shutdown
+ # The power should shut off during the following sleep, but we'll give a
+ # bit of notice otherwise. Also, be sure to set your machine to start when
+ # the power resumes in the BIOS settings so that it doesn't stay off.
+ sleep 45
+ echo "The UPS power should have stopped by now, but has not."
+ echo "It's possible that the power came back during the shutdown process."
+ echo "Otherwise, check communication with the UPS."
+ sleep 15
+fi
+
# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.
if [ "$shutdown_command" = "reboot" ]; then
echo "Rebooting."
diff --git a/source/a/sysvinit-scripts/scripts/rc.M b/source/a/sysvinit-scripts/scripts/rc.M
index fc63ce083..d5bc169a8 100644
--- a/source/a/sysvinit-scripts/scripts/rc.M
+++ b/source/a/sysvinit-scripts/scripts/rc.M
@@ -298,17 +298,27 @@ if [ -x /etc/rc.d/rc.smartd -a -z "$container" ]; then
/etc/rc.d/rc.smartd start
fi
-# Monitor the UPS with genpowerd.
-# To use this, uncomment this section and edit your settings in
-# /etc/genpowerd.conf (serial device, UPS type, etc). For more information,
-# see "man genpowerd" or the extensive documentation in the
-# /usr/doc/genpower-*/ directory.
-# You'll also need to configure a similar block in /etc/rc.d/rc.6 if you want
-# support for stopping the UPS's inverter after the machine halts.
-#if [ -x /sbin/genpowerd -a -z "$container" ]; then
-# echo "Starting genpowerd daemon..."
-# /sbin/genpowerd
-#fi
+# Load model-specific drivers for NUT (Network Uninterruptible power supply
+# Tools). This should be started on the machine that controls the UPS. See
+# the /etc/nut/ directory for configuration files.
+# If you manage your UPS using a serial port, you'll need to add the nut user
+# to the "dialout" group.
+if [ -x /etc/rc.d/rc.nut-drvctl -a -z "$container" ]; then
+ /etc/rc.d/rc.nut-drvctl start
+fi
+
+# Start the NUT UPS information server. This should be started on the machine
+# that controls the UPS. See the /etc/nut/ directory for configuration files.
+if [ -x /etc/rc.d/rc.nut-upsd -a -z "$container" ]; then
+ /etc/rc.d/rc.nut-upsd start
+fi
+
+# Start the NUT UPS monitor and shutdown controller. This should be run on any
+# machine that is powered by the UPS to monitor the power supply and initiate
+# shutdown if necessary. See the /etc/nut/ directory for configuration files.
+if [ -x /etc/rc.d/rc.nut-upsmon -a -z "$container" ]; then
+ /etc/rc.d/rc.nut-upsmon start
+fi
# Turn on process accounting. To enable process accounting, make sure the
# option for BSD process accounting is enabled in your kernel, and then
diff --git a/source/a/sysvinit-scripts/sysvinit-scripts.SlackBuild b/source/a/sysvinit-scripts/sysvinit-scripts.SlackBuild
index b4ea662e1..8180d4381 100755
--- a/source/a/sysvinit-scripts/sysvinit-scripts.SlackBuild
+++ b/source/a/sysvinit-scripts/sysvinit-scripts.SlackBuild
@@ -25,7 +25,7 @@ cd $(dirname $0) ; CWD=$(pwd)
PKGNAM=sysvinit-scripts
VERSION=${VERSION:-15.1}
ARCH=noarch
-BUILD=${BUILD:-15}
+BUILD=${BUILD:-16}
# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
# the name of the created package would be, and then exit. This information