ports/92466: Port sysutils/apcupsd - upgrade and many fixes
Alex Samorukov
samm at os2.kiev.ua
Sat Jan 28 19:20:05 UTC 2006
>Number: 92466
>Category: ports
>Synopsis: Port sysutils/apcupsd - upgrade and many fixes
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: update
>Submitter-Id: current-users
>Arrival-Date: Sat Jan 28 19:20:02 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator: Alex Samorukov
>Release: FreeBSD 6.0-RELEASE i386
>Organization:
Home
>Environment:
System: FreeBSD 6.0-RELEASE #13: Sat Dec 17 00:05:04 EET 2005
root at samm.local:/usr/obj/usr/src/sys/SAMMKRNL
>Description:
Proposed patch will:
1) Update apcupsd to the 3.12.2 version
2) Replace old startup shell script with a new, rc style.
3) Fix man path on configure stage (--manndir)
4) add -lmenu -lcurses to libs to make configure happy (it tries to use -lmenu w/o -lcurses and fail to detect ncurses lib)
5) removes manual.pdf because it removed from the source tarball
6) removes apcnisd from the pkg-plist (it seems that it is deprecated)
7) replace etc/apcupsd/mainsback to etc/apcupsd/offbattery
>How-To-Repeat:
>Fix:
diff --new-file -u -r apcupsd/Makefile apcupsd.new/Makefile
--- apcupsd/Makefile Sat Jan 28 20:58:45 2006
+++ apcupsd.new/Makefile Sat Jan 28 21:02:31 2006
@@ -6,8 +6,7 @@
#
PORTNAME= apcupsd
-PORTVERSION= 3.10.18
-PORTREVISION= 1
+PORTVERSION= 3.12.2
CATEGORIES= sysutils
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= ${PORTNAME}
@@ -16,12 +15,11 @@
COMMENT= A daemon for controlling APC UPS
USE_GETTEXT= yes
-
-STARTUP_SCRIPT= apcupsd.sh.sample
-PLIST_SUB= STARTUP_SCRIPT=${STARTUP_SCRIPT}
+USE_RC_SUBR= apcupsd.sh
HAS_CONFIGURE= yes
CONFIGURE_ARGS= --prefix=${PREFIX} --sbindir=${PREFIX}/sbin \
+ --mandir=${MANPREFIX}/man \
--with-nologin=/var/run \
--disable-install-distdir \
--sysconfdir=${PREFIX}/etc/apcupsd \
@@ -69,6 +67,7 @@
# Cause FreeBSD 3.X misses libmenu, libforms and libpanel (curses)
.if ${OSVERSION} > 400000
CONFIGURE_ARGS+=--enable-powerflute --with-libwrap=yes
+CONFIGURE_ENV+=LIBS="-lmenu -lcurses"
PLIST_SUB+= POWERFL=""
.else
PLIST_SUB+= POWERFL="@comment "
@@ -76,8 +75,6 @@
MAN8= "apcupsd.8"
-PORTDOCS= manual.pdf
-
pre-everything::
@${ECHO_MSG} ""
@${ECHO_MSG} "You may use the following build options:"
@@ -111,7 +108,6 @@
done
${ECHO_CMD} "@unexec if [ -d %D/etc/apcupsd ]; then ${ECHO_CMD} \"If you are permanently removing this port, you should do a ``rm -rf ${PREFIX}/etc/apcupsd`` to remove config files left.\" | ${FMT} ; fi" >> ${TMPPLIST}
# Install sample startup script
- ${INSTALL_SCRIPT} ${FILESDIR}/${STARTUP_SCRIPT} ${PREFIX}/etc/rc.d/${STARTUP_SCRIPT}
${INSTALL_DATA} ${FILESDIR}/apcupsd.conf.net-master.sample ${PREFIX}/etc/apcupsd/
${INSTALL_DATA} ${FILESDIR}/apcupsd.conf.net-slave.sample ${PREFIX}/etc/apcupsd/
# If there is already a config file it is installed as ...new
diff --new-file -u -r apcupsd/distinfo apcupsd.new/distinfo
--- apcupsd/distinfo Fri Nov 25 20:14:34 2005
+++ apcupsd.new/distinfo Sat Jan 28 19:00:43 2006
@@ -1,3 +1,3 @@
-MD5 (apcupsd-3.10.18.tar.gz) = 64104a1fface0253e77318ca84948bac
-SHA256 (apcupsd-3.10.18.tar.gz) = ae42d64e5cb29c8ce291f634139b5c81e888c95686f5c70ac9c250a1d8c02a38
-SIZE (apcupsd-3.10.18.tar.gz) = 5698299
+MD5 (apcupsd-3.12.2.tar.gz) = f771fafbc06551e7820bd3d277b5cce3
+SHA256 (apcupsd-3.12.2.tar.gz) = 755cd2bffc4090c58979a87ed3f9135afd1846153feb8a39fad95f745adbd347
+SIZE (apcupsd-3.12.2.tar.gz) = 4219660
diff --new-file -u -r apcupsd/files/apcupsd.sh.in apcupsd.new/files/apcupsd.sh.in
--- apcupsd/files/apcupsd.sh.in Thu Jan 1 03:00:00 1970
+++ apcupsd.new/files/apcupsd.sh.in Sat Jan 28 20:18:31 2006
@@ -0,0 +1,33 @@
+#!/bin/sh
+#
+
+# Start or stop apcupsd
+
+# PROVIDE: apcupsd
+# REQUIRE: NETWORKING SERVERS
+# BEFORE: DAEMON
+# KEYWORD: shutdown
+
+#
+# Add the following line to /etc/rc.conf to enable apcupsd
+# apcupsd_enable (bool):Set to "NO" by default.
+# Set it to "YES" to enable apcupsd.
+# apcupsd_args (str): Custom additional arguments to be passed
+# to apcupsd (default empty).
+#
+
+. %%RC_SUBR%%
+
+name="apcupsd"
+rcvar=`set_rcvar`
+
+load_rc_config $name
+
+: ${apcupsd_enable="NO"}
+: ${apcupsd_args=""}
+
+pidfile="/var/run/apcupsd.pid"
+command="%%PREFIX%%/sbin/apcupsd"
+command_args="${apcupsd_args}"
+
+run_rc_command "$1"
diff --new-file -u -r apcupsd/files/apcupsd.sh.sample apcupsd.new/files/apcupsd.sh.sample
--- apcupsd/files/apcupsd.sh.sample Tue Mar 9 22:20:05 2004
+++ apcupsd.new/files/apcupsd.sh.sample Thu Jan 1 03:00:00 1970
@@ -1,66 +0,0 @@
-#!/bin/sh
-# $FreeBSD: ports/sysutils/apcupsd/files/apcupsd.sh.sample,v 1.3 2004/03/09 20:20:05 lkoeller Exp $
-# startup scripts for APCUPSD.
-
-if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then
- echo "$0: Cannot determine the PREFIX" >&2
- exit 1
-fi
-
-# If there is a global system configuration file, suck it in.
-if [ -r /etc/defaults/rc.conf ]; then
- . /etc/defaults/rc.conf
- source_rc_confs
-elif [ -r /etc/rc.conf ]; then
- . /etc/rc.conf
-fi
-
-apcupsd_enable=${apcupsd_enable:-YES}
-apcupsd_program=${apcupsd_program:-${PREFIX}/sbin/apcupsd}
-apcupsd_flags=${apcupsd_flags:-"--kill-on-powerfail"}
-apcupsd_pidfile=${apcupsd_pidfile:-/var/run/apcupsd.pid}
-apcupsd_lockfile=${apcupsd_pidfile:-/var/spool/lock/apcupsd.lock}
-
-case $1 in
- start)
- case "${apcupsd_enable}" in
- [Yy][Ee][Ss])
- rm -f /var/run/powerfail
- rm -f /var/run/nologin
- if [ -f ${apcupsd_program} ]; then
- echo -n " apcupsd"
- ${apcupsd_program} ${apcupsd_flags} || return=" Failed."
- touch ${apcupsd_lockfile}
- fi
- ;;
- esac
- ;;
-
- stop)
- if [ -f ${apcupsd_pidfile} ]; then
- PID=`cat ${apcupsd_pidfile}`
- kill -KILL $PID || return=" Failed."
- rm -f ${apcupsd_pidfile}
- # some slaves won't die
- killall apcupsd > /dev/null 2>&1
- echo " apcupsd killed"
- else
- return=" Failed."
- fi
- ;;
-
- restart)
- $0 stop
- $0 start;
- ;;
-
- status)
- ${PREFIX}/sbin/apcaccess status
- ;;
-
- *)
- echo "usage: $0 {start|stop|restart|status}" 1>&2
- ;;
-esac
-
-exit 0;
diff --new-file -u -r apcupsd/pkg-plist apcupsd.new/pkg-plist
--- apcupsd/pkg-plist Sun Jan 22 08:28:50 2006
+++ apcupsd.new/pkg-plist Sat Jan 28 20:52:21 2006
@@ -1,6 +1,5 @@
sbin/apcupsd
sbin/apcaccess
-sbin/apcnisd
sbin/apctest
sbin/smtp
%%POWERFL%%sbin/powerflute
@@ -12,10 +11,10 @@
etc/apcupsd/changeme
etc/apcupsd/commfailure
etc/apcupsd/commok
-etc/apcupsd/mainsback
etc/apcupsd/masterconnect
etc/apcupsd/mastertimeout
etc/apcupsd/onbattery
+etc/apcupsd/offbattery
%%CGI%%@unexec if cmp -s %D/etc/apcupsd/apcupsd.css.sample %D/etc/apcupsd/apcupsd.css; then rm -f %D/etc/apcupsd/apcupsd.css; fi
%%CGI%%etc/apcupsd/apcupsd.css.sample
%%CGI%%@unexec if cmp -s %D/etc/apcupsd/host.conf.sample %D/etc/apcupsd/host.conf; then rm -f %D/etc/apcupsd/host.conf; fi
@@ -26,6 +25,5 @@
%%CGI%%etc/apcupsd/cgi/upsfstats.cgi
%%CGI%%etc/apcupsd/cgi/upsimage.cgi
%%CGI%%etc/apcupsd/cgi/upsstats.cgi
-etc/rc.d/%%STARTUP_SCRIPT%%
%%CGI%%@dirrm etc/apcupsd/cgi
@dirrmtry etc/apcupsd
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list