summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--testing/apcupsd/APKBUILD (renamed from extra/apcupsd/APKBUILD)14
-rw-r--r--testing/apcupsd/apcupsd.initd37
2 files changed, 46 insertions, 5 deletions
diff --git a/extra/apcupsd/APKBUILD b/testing/apcupsd/APKBUILD
index aab6780c525..03c280f8a29 100644
--- a/extra/apcupsd/APKBUILD
+++ b/testing/apcupsd/APKBUILD
@@ -4,19 +4,23 @@ pkgrel=0
pkgdesc="A Daemon to control APC UPSes"
subpackages="$pkgname-doc"
url="http://www.apcupsd.org"
-license='GPL2'
+license="GPL-2"
depends="uclibc util-linux-ng"
makedepends="g++"
-source="http://surfnet.dl.sourceforge.net/sourceforge/apcupsd/apcupsd-3.14.5.tar.gz"
+source="http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz
+ apcupsd.initd
+ "
build() {
cd "$srcdir/$pkgname-$pkgver"
./configure --prefix=/usr \
- --mandir=/usr/share/man
- --enable-usb
+ --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="4ac73ec91d8ab56f3fac894e172567c4 apcupsd-3.14.5.tar.gz"
+md5sums="4ac73ec91d8ab56f3fac894e172567c4 apcupsd-3.14.5.tar.gz
+d276b567fd8dfb9e2a74e533b25de031 apcupsd.initd"
diff --git a/testing/apcupsd/apcupsd.initd b/testing/apcupsd/apcupsd.initd
new file mode 100644
index 00000000000..43868f75dda
--- /dev/null
+++ b/testing/apcupsd/apcupsd.initd
@@ -0,0 +1,37 @@
+#!/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
+}
+
+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 $?
+}
+