Hi. This diff updates sysutils/apcupsd to the latest version. It also fixes
typo in MESSAGE-cgi, adds rc script, enables test driver, fixes apcupsd.conf
manual with our groff and removes abandoned SNMP support through net-snmp.
OK to commit?

Index: Makefile
===================================================================
RCS file: /cvs/ports/sysutils/apcupsd/Makefile,v
retrieving revision 1.11
diff -u -p -r1.11 Makefile
--- Makefile    14 May 2011 21:29:03 -0000      1.11
+++ Makefile    24 Jul 2011 19:22:11 -0000
@@ -4,12 +4,10 @@ COMMENT-main =                daemon for controlling A
 COMMENT-cgi =          CGI scripts for web monitoring
 COMMENT-x11 =          gapcmon - GUI for apcupsd

-DISTNAME =             apcupsd-3.14.8
+DISTNAME =             apcupsd-3.14.9
 PKGNAME-main =         ${DISTNAME}
-REVISION-main =        2
 PKGNAME-cgi =          ${DISTNAME:S/-/-cgi-/}
 PKGNAME-x11 =          ${DISTNAME:S/-/-x11-/}
-REVISION-x11 =                 2

 CATEGORIES =           sysutils

@@ -44,10 +42,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
@@ -75,12 +73,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: distinfo
===================================================================
RCS file: /cvs/ports/sysutils/apcupsd/distinfo,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 distinfo
--- distinfo    25 May 2010 21:56:33 -0000      1.1.1.1
+++ distinfo    24 Jul 2011 19:22:11 -0000
@@ -1,5 +1,5 @@
-MD5 (apcupsd-3.14.8.tar.gz) = zRfwqQPcIiDlXtVOJCNZ0g==
-RMD160 (apcupsd-3.14.8.tar.gz) = 9kJYLgFQbruYbBbfAUKea7CMfos=
-SHA1 (apcupsd-3.14.8.tar.gz) = y3p7QBeX4SnJKmuNwr97GTsdbHI=
-SHA256 (apcupsd-3.14.8.tar.gz) = jn8ldNOrr2Y32j55CGDD+bpk+rHsflC7CA3kQ5RBxac=
-SIZE (apcupsd-3.14.8.tar.gz) = 1317601
+MD5 (apcupsd-3.14.9.tar.gz) = ql4sKVSoHC8H4KNW44/oUw==
+RMD160 (apcupsd-3.14.9.tar.gz) = vhozuFx5D8O8YrqzcKYtAU2/Clc=
+SHA1 (apcupsd-3.14.9.tar.gz) = Hp6KBU8XxVTAR+wdezY9NVUwWLw=
+SHA256 (apcupsd-3.14.9.tar.gz) = AEHwCy5igFbmaNtymNCvCtUB/hJ+DFw0TuyYc6CYipI=
+SIZE (apcupsd-3.14.9.tar.gz) = 1334762
Index: patches/patch-doc_apcupsd_conf_5
===================================================================
RCS file: patches/patch-doc_apcupsd_conf_5
diff -N patches/patch-doc_apcupsd_conf_5
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-doc_apcupsd_conf_5    24 Jul 2011 19:22:11 -0000
@@ -0,0 +1,11 @@
+$OpenBSD$
+--- doc/apcupsd.conf.5.orig    Sun Jul 24 23:00:50 2011
++++ doc/apcupsd.conf.5 Sun Jul 24 23:01:00 2011
+@@ -82,7 +82,6 @@ for most situations.
+ apcupsd creates a lockfile for the serial or USB port in the specified
+ directory.  It must be changed when running more than one copy of apcupsd
+ on the same computer to control multiple UPSes.
+-
+ .It SCRIPTDIR <path>
+ .Pp
+ Directory in which apccontrol and event scripts are located.
Index: patches/patch-src_apcupsd_c
===================================================================
RCS file: patches/patch-src_apcupsd_c
diff -N patches/patch-src_apcupsd_c
--- patches/patch-src_apcupsd_c 25 May 2010 21:56:33 -0000      1.1.1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,83 +0,0 @@
-$OpenBSD: patch-src_apcupsd_c,v 1.1.1.1 2010/05/25 21:56:33 sthen Exp $
---- src/apcupsd.c.orig Tue May 18 02:07:50 2010
-+++ src/apcupsd.c      Tue May 18 02:20:02 2010
-@@ -68,9 +68,10 @@ UPSINFO *core_ups = NULL;
-
- static void daemon_start(void);
-
--int shm_OK = 0;
-+int pidcreated = 0;
- extern int kill_on_powerfail;
- extern FILE *trace_fd;
-+extern char *pidfile;
-
- /*
-  * The terminate function and trapping signals allows apcupsd
-@@ -91,11 +92,10 @@ void apcupsd_terminate(int sig)
-       log_event(ups, LOG_WARNING, _("apcupsd exiting, signal %u\n"), sig);
-
-    clear_files();
--
-    device_close(ups);
--
-    delete_lockfile(ups);
--
-+   if (pidcreated)
-+      unlink(pidfile);
-    clean_threads();
-    log_event(ups, LOG_WARNING, _("apcupsd shutdown succeeded"));
-    destroy_ups(ups);
-@@ -107,6 +107,8 @@ void apcupsd_error_cleanup(UPSINFO *ups)
- {
-    device_close(ups);
-    delete_lockfile(ups);
-+   if (pidcreated)
-+      unlink(pidfile);
-    clean_threads();
-    log_event(ups, LOG_ERR, _("apcupsd error shutdown completed"));
-    destroy_ups(ups);
-@@ -261,7 +263,6 @@ int main(int argc, char *argv[])
-    Dmsg1(10, "Attached to driver: %s\n", ups->driver->driver_name);
-
-    ups->start_time = time(NULL);
--   delete_lockfile(ups);
-
-    if (!hibernate_ups && !shutdown_ups && go_background) {
-       daemon_start();
-@@ -270,7 +271,6 @@ int main(int argc, char *argv[])
-       openlog("apcupsd", LOG_CONS | LOG_PID, ups->sysfac);
-    }
-
--   make_pid_file();
-    init_signals(apcupsd_terminate);
-
-    /* Create temp events file if we are not doing a hibernate or shutdown */
-@@ -282,6 +282,14 @@ int main(int argc, char *argv[])
-       }
-    }
-
-+   if (create_lockfile(ups) == LCKERROR) {
-+      Error_abort1(_("Failed to acquire device lock file\n"),
-+         ups->device);
-+   }
-+
-+   make_pid_file();
-+   pidcreated = 1;
-+
-    setup_device(ups);
-
-    if (hibernate_ups) {
-@@ -295,13 +303,6 @@ int main(int argc, char *argv[])
-    }
-
-    prep_device(ups);
--
--   if (create_lockfile(ups) == LCKERROR) {
--      Error_abort1(_("Failed to reacquire serial port lock file on device
%s\n"),
--         ups->device);
--   }
--
--   shm_OK = 1;
-
-    /*
-     * From now ... we must _only_ start up threads!
Index: pkg/MESSAGE-cgi
===================================================================
RCS file: /cvs/ports/sysutils/apcupsd/pkg/MESSAGE-cgi,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 MESSAGE-cgi
--- pkg/MESSAGE-cgi     25 May 2010 21:56:33 -0000      1.1.1.1
+++ pkg/MESSAGE-cgi     24 Jul 2011 19:22:11 -0000
@@ -5,6 +5,6 @@ This switch is on by default.
 To run scripts in chrooted apache (default behaviour), configuration
 files must be available to the webserver:
 # mv ${SYSCONFDIR}/apcupsd /var/www/${SYSCONFDIR}/apcupsd
-# ln -s /var/www/${SYSCONFIDR}/apcupsd ${SYSCONFDIR}/
+# ln -s /var/www/${SYSCONFDIR}/apcupsd ${SYSCONFDIR}/
 And some libraries must be copied in:
 # ${WEB_ROOT}/cgi-bin/apcupsd/copy-libs.sh
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    24 Jul 2011 19:22:11 -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      24 Jul 2011 19:22:11 -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
@@ -11,8 +12,8 @@ sbin/apcupsctl
 @bin sbin/apcupsd
 @bin sbin/smtp
 @comment share/applications/
-share/doc/apcupsd/
 @group
+share/doc/apcupsd/
 share/doc/apcupsd/COPYING
 share/doc/apcupsd/COPYRIGHT
 share/doc/apcupsd/DISCLAIMER
@@ -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      24 Jul 2011 19:22:11 -0000
@@ -0,0 +1,18 @@
+#!/bin/sh
+#
+# $OpenBSD$
+
+daemon="${TRUEPREFIX}/sbin/apcupsd"
+daemon_flags="--kill-on-powerfail"
+
+. /etc/rc.d/rc.subr
+
+rc_reload=NO
+
+rc_pre() {
+       if [ -f ${SYSCONFDIR}/apcupsd/powerfail ]; then
+               rm -f ${SYSCONFDIR}/apcupsd/powerfail
+       fi
+}
+
+rc_cmd $1

Reply via email to