Hi.
This diff adds rc script, removes snmp flavor, which is marked as
obsolete upstream and doesn't build, enables test driver.
There is no rc.reload because apcupsd doesn't support SIGHUP to reload config.
Index: Makefile
===================================================================
RCS file: /cvs/ports/sysutils/apcupsd/Makefile,v
retrieving revision 1.10
diff -u -p -r1.10 Makefile
--- Makefile 7 Mar 2011 18:54:51 -0000 1.10
+++ Makefile 5 May 2011 06:58:23 -0000
@@ -6,7 +6,7 @@ COMMENT-x11 = gapcmon - GUI for apcupsd
DISTNAME = apcupsd-3.14.8
PKGNAME-main = ${DISTNAME}
-REVISION-main = 2
+REVISION-main = 3
PKGNAME-cgi = ${DISTNAME:S/-/-cgi-/}
PKGNAME-x11 = ${DISTNAME:S/-/-x11-/}
REVISION-x11 = 1
@@ -44,10 +44,10 @@ CONFIGURE_ARGS = --mandir=${PREFIX}/man
--with-cgi-bin=${WEB_ROOT}/cgi-bin/apcupsd \
--with-lock-dir=/var/run \
--with-nisip=127.0.0.1 \
+ --enable-test \
--enable-usb
PSEUDO_FLAVORS = no_x11
-FLAVORS = snmp
FLAVOR ?=
MULTI_PACKAGES = -main
@@ -74,12 +74,6 @@ WANTLIB-x11 += gmodule-2.0 gobject-2.0 g
WANTLIB-x11 += m pango-1.0 pangocairo-1.0 pangoft2-1.0 pixman-1 png
WANTLIB-x11 += pthread-stubs xcb-render xcb z ${WANTLIB} c pthread
WANTLIB-x11 += GL X11-xcb Xxf86vm drm xcb-shm
-.endif
-
-.if ${FLAVOR:L:Msnmp}
-CONFIGURE_ARGS += --enable-net-snmp
-LIB_DEPENDS-main += net/net-snmp
-WANTLIB-main = ${WANTLIB} crypto netsnmp
.endif
FAKE_FLAGS = sysconfdir=${TRUEPREFIX}/share/examples/apcupsd/etc
Index: pkg/MESSAGE-main
===================================================================
RCS file: /cvs/ports/sysutils/apcupsd/pkg/MESSAGE-main,v
retrieving revision 1.3
diff -u -p -r1.3 MESSAGE-main
--- pkg/MESSAGE-main 17 Jun 2010 18:43:43 -0000 1.3
+++ pkg/MESSAGE-main 5 May 2011 06:58:23 -0000
@@ -1,10 +1,3 @@
-To start apcupsd at boot time, edit ${SYSCONFDIR}/apcupsd/apcupsd.conf
-and add the following lines to /etc/rc.local:
-
-if [ -x ${PREFIX}/sbin/apcupsd ]; then
- echo -n ' apcupsd'; ${PREFIX}/sbin/apcupsctl start
-fi
-
To allow the system to be fully powered down (in order to preserve
UPS battery), add the following lines to /etc/rc.shutdown:
Index: pkg/PLIST-main
===================================================================
RCS file: /cvs/ports/sysutils/apcupsd/pkg/PLIST-main,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 PLIST-main
--- pkg/PLIST-main 25 May 2010 21:56:33 -0000 1.1.1.1
+++ pkg/PLIST-main 5 May 2011 06:58:23 -0000
@@ -1,4 +1,5 @@
@comment $OpenBSD: PLIST-main,v 1.1.1.1 2010/05/25 21:56:33 sthen Exp $
+@pkgpath sysutils/apcupsd,snmp
@group bin
@man man/man5/apcupsd.conf.5
@man man/man8/apcaccess.8
@@ -82,3 +83,4 @@ share/examples/apcupsd/status/SmartUPS70
share/examples/apcupsd/status/SmartUPS700.status
share/examples/apcupsd/status/newbackupspro1.status
share/examples/apcupsd/status/newbackupspro2.status
+@rcscript ${RCDIR}/apcupsd
Index: pkg/apcupsd.rc
===================================================================
RCS file: pkg/apcupsd.rc
diff -N pkg/apcupsd.rc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ pkg/apcupsd.rc 5 May 2011 06:58:23 -0000
@@ -0,0 +1,30 @@
+#!/bin/sh
+#
+# $OpenBSD$
+
+daemon=${TRUEPREFIX}/sbin/apcupsd
+daemon_flags="--kill-on-powerfail"
+
+. /etc/rc.d/rc.subr
+
+rc_pre() {
+ if [ -f ${SYSCONFDIR}/apcupsd/powerfail ]; then
+ rm -f ${SYSCONFDIR}/apcupsd/powerfail
+ fi
+}
+
+rc_stop() {
+ if [ -f /var/run/apcupsd.pid ]; then
+ APCPID=`cat /var/run/apcupsd.pid`
+ kill ${APCPID}
+ rm -f /var/run/apcupsd.pid
+ fi
+}
+
+rc_restart() {
+ rc_stop || rc_pre || rc_start
+}
+
+rc_reload=NO