aboutsummaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
Diffstat (limited to 'testing')
-rw-r--r--testing/apcupsd/APKBUILD30
-rw-r--r--testing/apcupsd/apcupsd-alpine.patch41
-rw-r--r--testing/apcupsd/apcupsd.initd38
3 files changed, 109 insertions, 0 deletions
diff --git a/testing/apcupsd/APKBUILD b/testing/apcupsd/APKBUILD
new file mode 100644
index 0000000000..4adc8c0966
--- /dev/null
+++ b/testing/apcupsd/APKBUILD
@@ -0,0 +1,30 @@
+pkgname=apcupsd
+pkgver=3.14.7
+pkgrel=0
+pkgdesc="A Daemon to control APC UPSes"
+subpackages="$pkgname-doc"
+url="http://www.apcupsd.org"
+license="GPL-2"
+depends="util-linux-ng"
+makedepends=
+source="http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz
+ apcupsd.initd
+ apcupsd-alpine.patch
+ "
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+ patch -p1 < ../apcupsd-alpine.patch || return 1
+
+ ac_cv_path_SHUTDOWN="/sbin/poweroff" \
+ ./configure --prefix=/usr \
+ --mandir=/usr/share/man \
+ --enable-usb
+ make || return 1
+ make DESTDIR=$pkgdir install
+ install -D -m755 "$srcdir"/apcupsd.initd "$pkgdir"/etc/init.d/apcupsd
+}
+
+md5sums="bb2f8e4fc6b2f5d7b3e236eb57b81640 apcupsd-3.14.7.tar.gz
+0798cd407de6f199d4c267036ec54c5b apcupsd.initd
+08d9cc703cdd4275d342882deed1d719 apcupsd-alpine.patch"
diff --git a/testing/apcupsd/apcupsd-alpine.patch b/testing/apcupsd/apcupsd-alpine.patch
new file mode 100644
index 0000000000..3f5c6965b7
--- /dev/null
+++ b/testing/apcupsd/apcupsd-alpine.patch
@@ -0,0 +1,41 @@
+--- a/platforms/apccontrol.in Mon Oct 26 09:12:30 2009
++++ b/platforms/apccontrol.in Mon Oct 26 09:36:47 2009
+@@ -20,11 +20,20 @@
+
+ APCPID=@PIDDIR@/apcupsd.pid
+ APCUPSD=@sbindir@/apcupsd
+-SHUTDOWN=@SHUTDOWN@
++POWEROFF=/sbin/poweroff
++REBOOT=/sbin/reboot
+ SCRIPTSHELL=@SCRIPTSHELL@
+ SCRIPTDIR=@sysconfdir@
+-WALL=wall
++WALL=_wall
+
++_wall() {
++ local i
++ local msg=$(cat)
++ for i in /dev/pts/*; do
++ [ -c "$i" ] && echo "$msg" > $i
++ done
++}
++
+ #
+ # Concatenate all output from this script to the events file
+ # Note, the following kills the script in a power fail situation
+@@ -100,11 +109,13 @@
+ ;;
+ doreboot)
+ echo "UPS ${2} initiating Reboot Sequence" | ${WALL}
+- ${SHUTDOWN} -r now "apcupsd UPS ${2} initiated reboot"
++ echo "apcupsd UPS ${2} initiated reboot" | ${WALL}
++ $REBOOT
+ ;;
+ doshutdown)
+ echo "UPS ${2} initiated Shutdown Sequence" | ${WALL}
+- ${SHUTDOWN} -h now "apcupsd UPS ${2} initiated shutdown"
++ echo "apcupsd UPS ${2} initiated shutdown" | ${WALL}
++ $POWEROFF
+ ;;
+ annoyme)
+ echo "Power problems with UPS ${2}. Please logoff." | ${WALL}
diff --git a/testing/apcupsd/apcupsd.initd b/testing/apcupsd/apcupsd.initd
new file mode 100644
index 0000000000..5265347f41
--- /dev/null
+++ b/testing/apcupsd/apcupsd.initd
@@ -0,0 +1,38 @@
+#!/sbin/runscript
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-power/apcupsd/files/apcupsd.init.2,v 1.1 2009/01/15 15:21:11 flameeyes Exp $
+
+INSTANCE="${SVCNAME#*.}"
+if [ -z "${INSTANCE}" ] || [ "${SVCNAME}" = "apcupsd" ]; then
+ INSTANCE="apcupsd"
+fi
+
+depend() {
+ use net
+ after firewall
+}
+
+start() {
+ rm -f /etc/apcupsd/powerfail
+
+ export SERVICE="${SVCNAME}"
+
+ ebegin "Starting APC UPS daemon"
+ start-stop-daemon \
+ --start --pidfile "/var/run/${SVCNAME}.pid" \
+ --exec /sbin/apcupsd -- \
+ -f "/etc/apcupsd/${INSTANCE}.conf" \
+ -P "/var/run/${SVCNAME}.pid"
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping APC UPS daemon"
+ start-stop-daemon \
+ --stop --pidfile "/var/run/${SVCNAME}.pid" \
+ --retry TERM/5/TERM/5 \
+ --exec /sbin/apcupsd
+ eend $?
+}
+