summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Väth <martin@mvath.de>2017-07-18 05:43:39 +0200
committerMartin Väth <martin@mvath.de>2017-07-18 05:47:49 +0200
commitc5a828b67f6a49e3ba3e1e5079e524828c2d5d13 (patch)
tree7640cdb9ec1d0d6d6db3751c9c81413b7d14def8 /sys-power/nut/files
parentsys-process/systemd-cron: Version bump. Fix libpath for split /usr (diff)
downloadmv-c5a828b67f6a49e3ba3e1e5079e524828c2d5d13.tar.gz
mv-c5a828b67f6a49e3ba3e1e5079e524828c2d5d13.tar.bz2
mv-c5a828b67f6a49e3ba3e1e5079e524828c2d5d13.zip
sys-power/nut: Add to fix system-shutdown path
Diffstat (limited to 'sys-power/nut/files')
-rw-r--r--sys-power/nut/files/lighttpd_nut.conf-2.2.022
-rw-r--r--sys-power/nut/files/nut-2.2.2-init.d-upsdrv43
-rw-r--r--sys-power/nut/files/nut-2.6.2-lowspeed-buffer-size.patch16
-rw-r--r--sys-power/nut/files/nut-2.6.5-init.d-upsd37
-rw-r--r--sys-power/nut/files/nut-2.6.5-init.d-upslog30
-rw-r--r--sys-power/nut/files/nut-2.6.5-init.d-upsmon29
-rw-r--r--sys-power/nut/files/nut-2.7.1-snmpusb-order.patch37
-rw-r--r--sys-power/nut/files/nut-2.7.2/nut-2.7.2-no-libdummy.patch13
-rw-r--r--sys-power/nut/files/nut.powerfail.initd48
9 files changed, 275 insertions, 0 deletions
diff --git a/sys-power/nut/files/lighttpd_nut.conf-2.2.0 b/sys-power/nut/files/lighttpd_nut.conf-2.2.0
new file mode 100644
index 00000000..434be8c8
--- /dev/null
+++ b/sys-power/nut/files/lighttpd_nut.conf-2.2.0
@@ -0,0 +1,22 @@
+###############################################################################
+# Lighttpd configuration for using NUT under Gentoo Linux.
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+###############################################################################
+
+# Simple copy this to /etc/lighttpd/ and include it in your lighttpd.conf.
+# It will make NUT available at http://$HOST/nut/
+
+server.modules += ("mod_cgi")
+
+# If you want to limit it to some host, uncomment the host check and modify it to your needs.
+# $HTTP["host"] == "www2.example.org" {
+alias.url += ( "/nut/" => "/usr/share/nut/cgi/" )
+$HTTP["url"] =~ "^/nut/" {
+ dir-listing.activate = "disable"
+ cgi.assign = ( ".cgi" => "" )
+ index-file.names = ( "upsstats.cgi" )
+}
+# }
+
+# vim: set ft=conf foldmethod=marker et :
diff --git a/sys-power/nut/files/nut-2.2.2-init.d-upsdrv b/sys-power/nut/files/nut-2.2.2-init.d-upsdrv
new file mode 100644
index 00000000..9b49ee39
--- /dev/null
+++ b/sys-power/nut/files/nut-2.2.2-init.d-upsdrv
@@ -0,0 +1,43 @@
+#!/sbin/openrc-run
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+extra_commands="stopall startall"
+
+UPSNAME=${SVCNAME#*.}
+msgtext="drivers"
+[ "${UPSNAME}" = "${SVCNAME}" ] && UPSNAME=''
+[ -n "$UPSNAME" ] && msgtext="driver for $UPSNAME"
+
+depend() {
+ before upsd
+ [ "${UPSNAME}" != '' ] && provide upsdrv
+}
+
+start() {
+ _dostart "$UPSNAME" "$msgtext"
+}
+stop() {
+ _dostop "$UPSNAME" "$msgtext"
+}
+
+startall() {
+ _dostart "" "$msgtext"
+}
+stopall() {
+ _dostop "" "$msgtext"
+}
+
+_dostart() {
+ ebegin "Starting UPS $msgtext"
+ /usr/sbin/upsdrvctl start $UPSNAME
+ eend $? "Failed to start UPS $msgtext!"
+}
+
+_dostop() {
+ # The pidfile names depend on the actual UPS name
+ # Not in our control at all
+ ebegin "Stopping UPS $msgtext"
+ /usr/sbin/upsdrvctl stop $UPSNAME
+ eend $? "Failed to stop UPS $msgtext!"
+}
diff --git a/sys-power/nut/files/nut-2.6.2-lowspeed-buffer-size.patch b/sys-power/nut/files/nut-2.6.2-lowspeed-buffer-size.patch
new file mode 100644
index 00000000..9806d07e
--- /dev/null
+++ b/sys-power/nut/files/nut-2.6.2-lowspeed-buffer-size.patch
@@ -0,0 +1,16 @@
+http://bugs.gentoo.org/show_bug.cgi?id=318937
+http://boxster.ghz.cc/projects/nut/changeset/2407
+
+Respun from nut-2.4.3-lowspeed-buffer-size.patch
+
+Index: /trunk/drivers/libhid.c
+===================================================================
+--- /trunk/drivers/libhid.c (revision 2336)
++++ /trunk/drivers/libhid.c (revision 2407)
+@@ -142,5 +142,5 @@
+ int id = pData->ReportID;
+ int r;
+- unsigned char buf[SMALLBUF];
++ unsigned char buf[8]; /* Maximum size for low-speed USB devices */
+
+ if (rbuf->ts[id] + age > time(NULL)) {
diff --git a/sys-power/nut/files/nut-2.6.5-init.d-upsd b/sys-power/nut/files/nut-2.6.5-init.d-upsd
new file mode 100644
index 00000000..c4debd30
--- /dev/null
+++ b/sys-power/nut/files/nut-2.6.5-init.d-upsd
@@ -0,0 +1,37 @@
+#!/sbin/openrc-run
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+extra_started_commands="reload"
+
+pidfile=/var/lib/nut/upsd.pid
+bin=/usr/sbin/upsd
+
+depend() {
+ use net
+ before upsmon
+ after upsdrv
+}
+
+start() {
+ ebegin "Starting upsd"
+ # clean up first
+ pkill -u root,nut -x ${bin}
+ sleep 1
+ rm -f ${pidfile}
+ # now start up
+ start-stop-daemon --start --quiet --exec ${bin}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping upsd"
+ start-stop-daemon --stop --quiet --pidfile ${pidfile}
+ eend $?
+}
+
+reload() {
+ ebegin "Reloading upsd"
+ start-stop-daemon --stop --signal HUP --oknodo --quiet --pidfile ${pidfile}
+ eend $?
+}
diff --git a/sys-power/nut/files/nut-2.6.5-init.d-upslog b/sys-power/nut/files/nut-2.6.5-init.d-upslog
new file mode 100644
index 00000000..01a9d470
--- /dev/null
+++ b/sys-power/nut/files/nut-2.6.5-init.d-upslog
@@ -0,0 +1,30 @@
+#!/sbin/openrc-run
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+extra_started_commands="reload"
+
+pidfile=/var/run/upslog.pid
+bin=/usr/bin/upslog
+
+depend() {
+ use upsdrv
+ after upsdrv
+}
+
+start() {
+ ebegin "Starting upslog"
+ start-stop-daemon --start --quiet --exec ${bin}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping upslog"
+ start-stop-daemon --stop --quiet --pidfile ${pidfile}
+ eend $?
+}
+reload() {
+ ebegin "Reloading upslog"
+ start-stop-daemon --stop --signal HUP --oknodo --quiet --pidfile ${pidfile}
+ eend $?
+}
diff --git a/sys-power/nut/files/nut-2.6.5-init.d-upsmon b/sys-power/nut/files/nut-2.6.5-init.d-upsmon
new file mode 100644
index 00000000..3aafe167
--- /dev/null
+++ b/sys-power/nut/files/nut-2.6.5-init.d-upsmon
@@ -0,0 +1,29 @@
+#!/sbin/openrc-run
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+extra_started_commands="reload"
+
+pidfile=/var/run/upsmon.pid
+bin=/usr/sbin/upsmon
+
+depend() {
+ use net
+}
+
+start() {
+ ebegin "Starting upsmon"
+ start-stop-daemon --start --quiet --exec ${bin}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping upsmon"
+ start-stop-daemon --stop --quiet --pidfile ${pidfile}
+ eend $?
+}
+reload() {
+ ebegin "Reloading upsmon"
+ start-stop-daemon --stop --signal HUP --oknodo --quiet --pidfile ${pidfile}
+ eend $?
+}
diff --git a/sys-power/nut/files/nut-2.7.1-snmpusb-order.patch b/sys-power/nut/files/nut-2.7.1-snmpusb-order.patch
new file mode 100644
index 00000000..e62b6571
--- /dev/null
+++ b/sys-power/nut/files/nut-2.7.1-snmpusb-order.patch
@@ -0,0 +1,37 @@
+The code that generates the SNMP and USB headers to compile against does not
+have a deterministic order, leading to different results at times.
+
+Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
+
+diff -Nuar --exclude .libs --exclude '*.o' --exclude core nut-2.7.1.orig/tools/nut-snmpinfo.py nut-2.7.1/tools/nut-snmpinfo.py
+--- nut-2.7.1.orig/tools/nut-snmpinfo.py 2014-01-04 19:08:19.117150636 -0800
++++ nut-2.7.1/tools/nut-snmpinfo.py 2013-07-26 12:41:11.000000000 -0700
+@@ -78,7 +78,9 @@
+ output_file.write( "/* SNMP IDs device table */\n" )
+ output_file.write( "static snmp_device_id_t snmp_device_table[] = {\n" )
+
+-for filename in glob.glob('../drivers/*-mib.c'):
++mibs = glob.glob('../drivers/*-mib.c')
++mibs.sort()
++for filename in mibs:
+ list_of_line = open(filename,'r').read().split(';')
+ for line in list_of_line:
+ if "mib2nut_info_t" in line:
+diff -Nuar --exclude .libs --exclude '*.o' --exclude core nut-2.7.1.orig/tools/nut-usbinfo.pl nut-2.7.1/tools/nut-usbinfo.pl
+--- nut-2.7.1.orig/tools/nut-usbinfo.pl 2014-01-04 19:12:45.595949760 -0800
++++ nut-2.7.1/tools/nut-usbinfo.pl 2013-11-17 11:27:38.000000000 -0800
+@@ -75,7 +75,12 @@
+
+ ################# MAIN #################
+
+-find(\&find_usbdevs,$scanPath);
++find({
++ wanted => \&find_usbdevs,
++ follow => 1,
++ preprocess => sub { return sort @_ },
++ },
++ $scanPath);
+ &gen_usb_files;
+
+ ################# SUB METHOD #################
+
diff --git a/sys-power/nut/files/nut-2.7.2/nut-2.7.2-no-libdummy.patch b/sys-power/nut/files/nut-2.7.2/nut-2.7.2-no-libdummy.patch
new file mode 100644
index 00000000..ca0d8be0
--- /dev/null
+++ b/sys-power/nut/files/nut-2.7.2/nut-2.7.2-no-libdummy.patch
@@ -0,0 +1,13 @@
+diff --git a/drivers/Makefile.am b/drivers/Makefile.am
+index 99614ca..42b3611 100644
+--- a/drivers/Makefile.am
++++ b/drivers/Makefile.am
+@@ -267,5 +267,6 @@ dist_noinst_HEADERS = apc-mib.h apc-hid.h baytech-mib.h bcmxcp.h \
+
+ # Define a dummy library so that Automake builds rules for the
+ # corresponding object files. This library is not actually built,
+-EXTRA_LIBRARIES = libdummy.a
+-libdummy_a_SOURCES = main.c dstate.c serial.c
++EXTRA_LIBRARIES =
++#EXTRA_LIBRARIES = libdummy.a
++#libdummy_a_SOURCES = main.c dstate.c serial.c
diff --git a/sys-power/nut/files/nut.powerfail.initd b/sys-power/nut/files/nut.powerfail.initd
new file mode 100644
index 00000000..fd26b4f7
--- /dev/null
+++ b/sys-power/nut/files/nut.powerfail.initd
@@ -0,0 +1,48 @@
+#!/sbin/openrc-run
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+description='Signal the UPS to kill power in a power failure condition'
+
+depend() {
+ # This is only for baselayout2
+ if [ -f /etc/init.d/sysfs ]; then
+ keyword -jail -lxc -openvz -prefix -uml -vserver -xenu -timeout
+ need mount-ro
+ fi
+}
+
+start() {
+ if [ ! -f /etc/init.d/sysfs ]; then
+ eerror "The $SVCNAME init-script is written for baselayout-2!"
+ eerror "Please do not use it with baselayout-1!".
+ return 1
+ fi
+ local UPS_CTL UPS_POWERDOWN
+
+ if [ -f /etc/killpower -o -f /etc/nut/killpower ]; then
+ UPS_CTL=/sbin/upsdrvctl
+ UPS_POWERDOWN="${UPS_CTL} shutdown"
+ elif [ -f /etc/apcupsd/powerfail ]; then
+ UPS_CTL=/sbin/apcupsd
+ UPS_POWERDOWN="${UPS_CTL} --killpower"
+ else
+ ewarn "UPS powerfail script scheduled, but no poweroff commands found."
+ return 0
+ fi
+
+ if [ -f "${UPS_CTL}" -a -x "${UPS_CTL}" ]; then
+ ebegin 'Signaling UPS to kill power'
+ ${UPS_POWERDOWN}
+ eend $?
+
+ ebegin 'Halt system and wait for the UPS to kill our power'
+ /sbin/halt -id
+ # If the sleep gets hit, something is wrong...
+ # do NOT restart the system.
+ while [ 1 ]; do sleep 60; done
+ else
+ ewarn "UPS powerfail script scheduled, and flags found, but ${UPS_CTL} missing."
+ fi
+}
+