pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/sysutils/ups-nut



Module Name:    pkgsrc
Committed By:   gdt
Date:           Sun Jan  8 01:14:23 UTC 2023

Modified Files:
        pkgsrc/sysutils/ups-nut: Makefile
        pkgsrc/sysutils/ups-nut/files: upsd.sh upsdriver.sh upslog.sh upsmon.sh
Added Files:
        pkgsrc/sysutils/ups-nut/files: upskillpower.sh

Log Message:
sysutils/nut: Add support for turning off UPS at shutdown

Add support for turning off the UPS as part of a shutdown caused by
low battery.  The actual poweroff is commented out for now, pending testing.

Move ups daemon startup slightly earlier in the startup sequence.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 pkgsrc/sysutils/ups-nut/Makefile
cvs rdiff -u -r1.8 -r1.9 pkgsrc/sysutils/ups-nut/files/upsd.sh \
    pkgsrc/sysutils/ups-nut/files/upsmon.sh
cvs rdiff -u -r1.10 -r1.11 pkgsrc/sysutils/ups-nut/files/upsdriver.sh
cvs rdiff -u -r0 -r1.1 pkgsrc/sysutils/ups-nut/files/upskillpower.sh
cvs rdiff -u -r1.7 -r1.8 pkgsrc/sysutils/ups-nut/files/upslog.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/sysutils/ups-nut/Makefile
diff -u pkgsrc/sysutils/ups-nut/Makefile:1.68 pkgsrc/sysutils/ups-nut/Makefile:1.69
--- pkgsrc/sysutils/ups-nut/Makefile:1.68       Sat Jan  7 16:16:10 2023
+++ pkgsrc/sysutils/ups-nut/Makefile    Sun Jan  8 01:14:23 2023
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.68 2023/01/07 16:16:10 gdt Exp $
+# $NetBSD: Makefile,v 1.69 2023/01/08 01:14:23 gdt Exp $
 
-PKGREVISION= 3
+PKGREVISION= 4
 .include "Makefile.common"
 
 PKGNAME=               ups-${DISTNAME}
@@ -53,7 +53,7 @@ CONF_FILES_PERMS+=    ${NUT_EGDIR}/upsd.use
 CONF_FILES_PERMS+=     ${NUT_EGDIR}/upsmon.conf.sample                 \
                        ${NUT_CONFDIR}/upsmon.conf                      \
                        ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 0600
-RCD_SCRIPTS=           ups upsd upsdriver upslog upsmon
+RCD_SCRIPTS=           ups upskillpower upsdriver upsd upsmon upslog
 
 OWN_DIRS=              ${NUT_CONFDIR}
 OWN_DIRS_PERMS=                ${NUT_STATEDIR} ${NUT_USER} ${NUT_GROUP} 0770

Index: pkgsrc/sysutils/ups-nut/files/upsd.sh
diff -u pkgsrc/sysutils/ups-nut/files/upsd.sh:1.8 pkgsrc/sysutils/ups-nut/files/upsd.sh:1.9
--- pkgsrc/sysutils/ups-nut/files/upsd.sh:1.8   Sat Jan  7 16:16:10 2023
+++ pkgsrc/sysutils/ups-nut/files/upsd.sh       Sun Jan  8 01:14:23 2023
@@ -1,10 +1,9 @@
 #!@RCD_SCRIPTS_SHELL@
 #
-# $NetBSD: upsd.sh,v 1.8 2023/01/07 16:16:10 gdt Exp $
+# $NetBSD: upsd.sh,v 1.9 2023/01/08 01:14:23 gdt Exp $
 #
 # PROVIDE: upsd
 # REQUIRE: upsdriver
-# BEFORE: upsmon
 # KEYWORD: shutdown
 
 if [ -f /etc/rc.subr ]; then
Index: pkgsrc/sysutils/ups-nut/files/upsmon.sh
diff -u pkgsrc/sysutils/ups-nut/files/upsmon.sh:1.8 pkgsrc/sysutils/ups-nut/files/upsmon.sh:1.9
--- pkgsrc/sysutils/ups-nut/files/upsmon.sh:1.8 Sat Jan  7 16:16:10 2023
+++ pkgsrc/sysutils/ups-nut/files/upsmon.sh     Sun Jan  8 01:14:23 2023
@@ -1,8 +1,9 @@
 #!@RCD_SCRIPTS_SHELL@
 #
-# $NetBSD: upsmon.sh,v 1.8 2023/01/07 16:16:10 gdt Exp $
+# $NetBSD: upsmon.sh,v 1.9 2023/01/08 01:14:23 gdt Exp $
 #
 # PROVIDE: upsmon
+# REQUIRE: upsd
 # BEFORE: SERVERS
 # KEYWORD: shutdown
 

Index: pkgsrc/sysutils/ups-nut/files/upsdriver.sh
diff -u pkgsrc/sysutils/ups-nut/files/upsdriver.sh:1.10 pkgsrc/sysutils/ups-nut/files/upsdriver.sh:1.11
--- pkgsrc/sysutils/ups-nut/files/upsdriver.sh:1.10     Sat Jan  7 16:16:10 2023
+++ pkgsrc/sysutils/ups-nut/files/upsdriver.sh  Sun Jan  8 01:14:23 2023
@@ -1,9 +1,10 @@
 #!@RCD_SCRIPTS_SHELL@
 #
-# $NetBSD: upsdriver.sh,v 1.10 2023/01/07 16:16:10 gdt Exp $
+# $NetBSD: upsdriver.sh,v 1.11 2023/01/08 01:14:23 gdt Exp $
 #
 # PROVIDE: upsdriver
 # REQUIRE: NETWORK syslogd mountcritremote
+# KEYWORD: shutdown
 #
 # The standard approach is to leave "upsdriver_type" unset, so that
 # upsdrvctl is used to start and stop the driver(s).  (Note that a

Index: pkgsrc/sysutils/ups-nut/files/upslog.sh
diff -u pkgsrc/sysutils/ups-nut/files/upslog.sh:1.7 pkgsrc/sysutils/ups-nut/files/upslog.sh:1.8
--- pkgsrc/sysutils/ups-nut/files/upslog.sh:1.7 Sat Jan  7 16:16:10 2023
+++ pkgsrc/sysutils/ups-nut/files/upslog.sh     Sun Jan  8 01:14:23 2023
@@ -1,10 +1,11 @@
 #!@RCD_SCRIPTS_SHELL@
 #
-# $NetBSD: upslog.sh,v 1.7 2023/01/07 16:16:10 gdt Exp $
+# $NetBSD: upslog.sh,v 1.8 2023/01/08 01:14:23 gdt Exp $
 #
 # PROVIDE: upslog
 # REQUIRE: upsd DAEMON
 # BEFORE: LOGIN
+# KEYWORD: shutdown
 #
 # You will need to set some variables in /etc/rc.conf to start upslog
 # properly, e.g.

Added files:

Index: pkgsrc/sysutils/ups-nut/files/upskillpower.sh
diff -u /dev/null pkgsrc/sysutils/ups-nut/files/upskillpower.sh:1.1
--- /dev/null   Sun Jan  8 01:14:23 2023
+++ pkgsrc/sysutils/ups-nut/files/upskillpower.sh       Sun Jan  8 01:14:23 2023
@@ -0,0 +1,37 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# $NetBSD: upskillpower.sh,v 1.1 2023/01/08 01:14:23 gdt Exp $
+#
+# PROVIDE: upskillpower
+# REQUIRE: mountcritremote
+# BEFORE: upsdriver altq downinterfaces 
+# KEYWORD: shutdown
+
+# This script shuts off power, if upsmon has decided to shutdown
+# because of low battery/runtime.  This is logically part of upsmon
+# but should run later in shutdown.
+
+. /etc/rc.subr
+
+name="upskillpower"
+rcvar=upsmon
+
+start_empty()
+{
+    # This is a shutdown-only file.
+    true
+}
+
+killpower()
+{
+    if @PREFIX@/sbin/upsmon -K; then
+       echo "upskillpower: POWER OFF commanded"
+       echo TEST ONLY @PREFIX@/sbin/upsdrvctl shutdown
+    fi
+}
+
+start_cmd="start_empty"
+stop_cmd="killpower"
+
+load_rc_config $name
+run_rc_command "$1"



Home | Main Index | Thread Index | Old Index