aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel F. Dickinson <cshored@thecshore.com>2019-01-06 18:32:52 -0500
committerDaniel F. Dickinson <cshored@thecshore.com>2019-01-08 04:07:01 -0500
commitcb06f0250425d20b9d600b0a6e9002a1c5bc5a75 (patch)
tree9b79373dd9cbbbdbcb214c771bb50146a8cae0eb
parent483c9fceae100dd7c205c614a35907ecc9496965 (diff)
nut: Prevent FSD when not specifically requested
Under certain circumstances nutshutdown was causing a forced shutdown of the UPS even though killpower was not indicated. Prevent that. Also clarify the logic for powering off server by avoiding && || chains. Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
-rw-r--r--net/nut/Makefile2
-rwxr-xr-xnet/nut/files/nutshutdown17
2 files changed, 11 insertions, 8 deletions
diff --git a/net/nut/Makefile b/net/nut/Makefile
index 985feae5d..5dd635c27 100644
--- a/net/nut/Makefile
+++ b/net/nut/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=nut
PKG_VERSION:=2.7.4
-PKG_RELEASE:=13
+PKG_RELEASE:=14
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://www.networkupstools.org/source/2.7/
diff --git a/net/nut/files/nutshutdown b/net/nut/files/nutshutdown
index e4fd962cd..ad1cda2d3 100755
--- a/net/nut/files/nutshutdown
+++ b/net/nut/files/nutshutdown
@@ -16,11 +16,14 @@ stop_instance() {
shutdown_instance() {
local cfg="$1"
config_get driver "$cfg" driver "usbhid-ups"
- /lib/nut/${driver} -a "$cfg" -k
+ # Only FSD if killpower was indicated
+ if [ -f /var/run/killpower ]; then
+ /lib/nut/${driver} -a "$cfg" -k
+ fi
}
-[ -f /var/run/killpower ] && {
- [ -f /etc/config/nut_server ] && {
+if [ -f /var/run/killpower ]; then
+ if [ -f /etc/config/nut_server ]; then
config_load nut_server
# Can't FSD unless drivers are stopped
@@ -33,9 +36,9 @@ shutdown_instance() {
sleep 120
# Uh-oh failed to poweroff UPS
reboot -f
- } || {
+ else
poweroff
- }
-} || {
+ fi
+else
poweroff
-}
+fi