aboutsummaryrefslogtreecommitdiff
path: root/sysutils/apcupsd
diff options
context:
space:
mode:
authorMarcus Alves Grando <mnag@FreeBSD.org>2006-04-22 13:51:37 +0000
committerMarcus Alves Grando <mnag@FreeBSD.org>2006-04-22 13:51:37 +0000
commitdf4b7a8f4938010504d7577215a7b3c22e23ebda (patch)
tree5249f106fa9ded3f485f50448023a005f7e06939 /sysutils/apcupsd
parent8a902a12b23747b5d83bb620908de3117ea191d9 (diff)
downloadports-df4b7a8f4938010504d7577215a7b3c22e23ebda.tar.gz
ports-df4b7a8f4938010504d7577215a7b3c22e23ebda.zip
Notes
Diffstat (limited to 'sysutils/apcupsd')
-rw-r--r--sysutils/apcupsd/Makefile116
-rw-r--r--sysutils/apcupsd/distinfo9
-rw-r--r--sysutils/apcupsd/files/apcupsd.in34
-rw-r--r--sysutils/apcupsd/files/apcupsd.sh.sample66
-rw-r--r--sysutils/apcupsd/pkg-message13
-rw-r--r--sysutils/apcupsd/pkg-plist7
6 files changed, 97 insertions, 148 deletions
diff --git a/sysutils/apcupsd/Makefile b/sysutils/apcupsd/Makefile
index 8ae69ef066d0..19eeb1af811a 100644
--- a/sysutils/apcupsd/Makefile
+++ b/sysutils/apcupsd/Makefile
@@ -4,104 +4,92 @@
#
# $FreeBSD$
#
-# $Tecnik: ports/sysutils/apcupsd/Makefile,v 1.2 2006/01/26 00:35:21 itetcu Exp $
+# $Tecnik: ports/sysutils/apcupsd/Makefile,v 1.7 2006/04/20 16:43:54 itetcu Exp $
PORTNAME= apcupsd
-PORTVERSION= 3.10.18
-PORTREVISION= 1
+PORTVERSION= 3.12.2
CATEGORIES= sysutils
-MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
-MASTER_SITE_SUBDIR= ${PORTNAME}
+MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:S/$/:src_sf/g} \
+ http://sce-tindy.tecnik93.com/FreeBSD/ports/${PORTNAME}/sources/:src_bk \
+ http://apcupsd.sourceforge.net/manual/:doc_sf \
+ http://sce-tindy.tecnik93.com/FreeBSD/ports/${PORTNAME}/sources/:doc_bk
+MASTER_SITE_SUBDIR= ${PORTNAME}/:src_sf
+DISTFILES= ${DISTNAME}${EXTRACT_SUFX}:src_sf,src_bk \
+ ${PORTNAME}.pdf:doc_sf,doc_bk
+EXTRACT_ONLY= ${DISTNAME}${EXTRACT_SUFX}
MAINTAINER= itetcu@people.tecnik93.com
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
HAS_CONFIGURE= yes
CONFIGURE_ARGS= --prefix=${PREFIX} --sbindir=${PREFIX}/sbin \
+ --mandir=${MANPREFIX}/man \
--with-nologin=/var/run \
--disable-install-distdir \
--sysconfdir=${PREFIX}/etc/apcupsd \
--with-serial-dev=/dev/usv
+CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include -L${LOCALBASE}/lib" \
+ CFLAGS="-I${LOCALBASE}/include -L${LOCALBASE}/lib" \
+ LDFLAGS="-L${LOCALBASE}/lib"
+
+MAN8= apcupsd.8
+
OPTIONS= CLIENT_ONLY "Build apcupsd client only (no network server)" off
OPTIONS+= CGI "Compile with CGI programms to show status" off
-OPTIONS+= USB "Compile with USB Support (READ MANUAL!!!)" off
-OPTIONS+= SNMP "Compile with SNMP Support (READ MANUAL!!!)" off
-OPTIONS+= NOPTHREADS "Compile without pthreads support (READ MANUAL!!!)" off
+OPTIONS+= USB "Compile with USB Support (READ MANUAL!)" on
+OPTIONS+= SNMP "Compile with SNMP Support (READ MANUAL!)" on
+OPTIONS+= PTHREADS "Compile without pthreads support (READ MANUAL!)" off
-.include <bsd.port.pre.mk>
+PORTDOCS= ${PORTNAME}.pdf
-.if defined(WITH_NOPTHREADS)
-CONFIGURE_ARGS+=--disable-pthreads
-.endif
+.include <bsd.port.pre.mk>
-.if defined(WITH_USB)
-CONFIGURE_ARGS+=--enable-usb
+.if defined(WITH_CLIENT_ONLY)
+CONFIGURE_ARGS+= --enable-net
+.else
+CONFIGURE_ARGS+= --enable-master-slave
.endif
.if defined(WITH_CGI)
-CONFIGURE_ARGS+=--enable-cgi --with-cgi-bin=${PREFIX}/etc/apcupsd/cgi
-LIB_DEPENDS+= gd.4:${PORTSDIR}/graphics/gd
-PLIST_SUB+= CGI=""
+CONFIGURE_ARGS+= --enable-cgi --with-cgi-bin=${PREFIX}/etc/apcupsd/cgi
+LIB_DEPENDS+= gd.4:${PORTSDIR}/graphics/gd
+PLIST_SUB+= CGI=""
.else
-PLIST_SUB+= CGI="@comment "
+PLIST_SUB+= CGI="@comment "
.endif
-.if defined(WITH_CLIENT_ONLY)
-CONFIGURE_ARGS+=--enable-net
-.else
-CONFIGURE_ARGS+=--enable-master-slave
+.if !defined(WITHOUT_USB)
+CONFIGURE_ARGS+= --enable-usb
.endif
-.if defined(WITH_SNMP)
-LIB_DEPENDS+= netsnmp.9:${PORTSDIR}/net-mgmt/net-snmp
-CONFIGURE_ARGS+=--enable-snmp
+.if !defined(WITHOUT_SNMP)
+LIB_DEPENDS+= netsnmp.9:${PORTSDIR}/net-mgmt/net-snmp
+CONFIGURE_ARGS+= --enable-snmp
.endif
-CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include -L${LOCALBASE}/lib" \
- CFLAGS="-I${LOCALBASE}/include -L${LOCALBASE}/lib" \
- LDFLAGS="-L${LOCALBASE}/lib"
+.if !defined(WITH_PTHREADS)
+CONFIGURE_ARGS+= --disable-pthreads
+.endif
# Cause FreeBSD 3.X misses libmenu, libforms and libpanel (curses)
.if ${OSVERSION} > 400000
-CONFIGURE_ARGS+=--enable-powerflute --with-libwrap=yes
-PLIST_SUB+= POWERFL=""
+CONFIGURE_ARGS+= --enable-powerflute --with-libwrap=yes
+CONFIGURE_ENV+= LIBS="-lcurses -lmenu"
+PLIST_SUB+= POWERFL=""
.else
-PLIST_SUB+= POWERFL="@comment "
-.endif
-
-MAN8= "apcupsd.8"
-
-PORTDOCS= manual.pdf
-
-pre-everything::
- @${ECHO_MSG} ""
- @${ECHO_MSG} "You may use the following build options:"
- @${ECHO_MSG} ""
- @${ECHO_MSG} " WITH_CGI=yes if you want to build CGI support."
- @${ECHO_MSG} " WITH_CLIENT_ONLY=yes if you only want a network client."
- @${ECHO_MSG} " WITH_USB=yes to compile with USB support (READ MANUAL!!!)"
- @${ECHO_MSG} " WITH_SNMP=yes to compile with SNMP support (READ MANUAL!!!)"
- @${ECHO_MSG} " WITH_NOPTHREADS=yes to compile without pthreads support (READ MANUAL!!!)"
- @${ECHO_MSG} ""
-.if defined(WITH_CGI)
- @${ECHO_MSG} "===> Building with CGI support."
-.endif
-.if defined(WITH_CLIENT_ONLY)
- @${ECHO_MSG} "===> Building network client."
+PLIST_SUB+= POWERFL="@comment "
.endif
post-configure:
- ${REINPLACE_CMD} -e "s|%PREFIX%|${PREFIX}|g" ${WRKSRC}/doc/apcupsd.man
+ @${REINPLACE_CMD} -e "s|%PREFIX%|${PREFIX}|g" ${WRKSRC}/doc/apcupsd.man
post-install:
-# If the files presaved are identical with the new one, include then in
-# the package list. So the port could be removed without problems
+# If the files presaved are identical with the new one, include then in
+# the package list. So the port could be removed without problems
for na in apccontrol commfailure mainsback mastertimeout \
changeme commok masterconnect onbattery; do \
if [ -f ${PREFIX}/etc/apcupsd/$$na.orig ]; then \
@@ -110,12 +98,11 @@ post-install:
fi \
fi; \
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}
+ @${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_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
+# If there is already a config file it is installed as ...new
for na in apcupsd.conf apcupsd.css hosts.conf multimon.conf; do \
if [ -f ${PREFIX}/etc/apcupsd/$$na ]; then \
if [ -f ${PREFIX}/etc/apcupsd/$$na.new ]; then \
@@ -125,12 +112,9 @@ post-install:
fi; \
fi; \
done
-
.if !defined(NOPORTDOCS)
@${MKDIR} ${DOCSDIR}
-.for filen in ${PORTDOCS}
- ${INSTALL_DATA} ${WRKSRC}/doc/texi/${filen} ${DOCSDIR}
-.endfor
+ cd ${DISTDIR} && ${INSTALL_DATA} ${PORTNAME}.pdf ${DOCSDIR}
.endif
.include <bsd.port.post.mk>
diff --git a/sysutils/apcupsd/distinfo b/sysutils/apcupsd/distinfo
index 026b9ae2922e..856b40fca079 100644
--- a/sysutils/apcupsd/distinfo
+++ b/sysutils/apcupsd/distinfo
@@ -1,3 +1,6 @@
-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
+MD5 (apcupsd.pdf) = 6cc2c59e54abc35854758e43f8fd13a4
+SHA256 (apcupsd.pdf) = 7d5664233350757709adfbf09cfd4f2434028c8af14c8f48c4255d41adfda0ca
+SIZE (apcupsd.pdf) = 1095048
diff --git a/sysutils/apcupsd/files/apcupsd.in b/sysutils/apcupsd/files/apcupsd.in
new file mode 100644
index 000000000000..b43442d35168
--- /dev/null
+++ b/sysutils/apcupsd/files/apcupsd.in
@@ -0,0 +1,34 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+# PROVIDE: apcupsd
+# REQUIRE: SERVERS
+# BEFORE: DAEMON
+# KEYWORD: shutdown
+#
+# Add the following line to /etc/rc.conf[.local] 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=${name}_enable
+
+load_rc_config $name
+
+: ${apcupsd_enable="NO"}
+: ${apcupsd_flags="--kill-on-powerfail"}
+: ${apcupsd_pidfile="/var/run/apcupsd.pid"}
+: ${apcupsd_lockfile"/var/spool/lock/apcupsd.lock"}
+
+pidfile="/var/run/apcupsd.pid"
+required_files="%%PREFIX%%/etc/apcupsd/apcupsd.conf"
+command="%%PREFIX%%/sbin/apcupsd"
+
+run_rc_command "$1"
diff --git a/sysutils/apcupsd/files/apcupsd.sh.sample b/sysutils/apcupsd/files/apcupsd.sh.sample
deleted file mode 100644
index 567c4a65eb46..000000000000
--- a/sysutils/apcupsd/files/apcupsd.sh.sample
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/bin/sh
-# $FreeBSD$
-# 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_lockfile:-/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 --git a/sysutils/apcupsd/pkg-message b/sysutils/apcupsd/pkg-message
index 8f7ad98c75c4..f1b5cb41f8e7 100644
--- a/sysutils/apcupsd/pkg-message
+++ b/sysutils/apcupsd/pkg-message
@@ -1,12 +1,4 @@
**********************************************************************
-NOTE IF you install a apcupsd server:
-
-Change to /dev and create a softlink to e.g. ups from the serial line
-the USV is connected to, e.g.
-
- cd /dev
- ln -s cuaa1 ups
-
Read the manual
${PREFIX}/share/doc/apcupsd/manual.pdf
@@ -18,7 +10,7 @@ Sample files are installed in ${PREFIX}/etc/apcupsd. These files
must be copied and/or configured for a proper working apcupsd.
You need to modify ${PREFIX}/etc/apcupsd/apcupsd.conf as follows:
- For serial cable: DEVICE /dev/ups (or /dev/cuaaX)
+ For serial cable: DEVICE /dev/cuaadX (or /dev/cuaaX for [45.]x)
For USB cable: DEVICE (yes, leave it blank after DEVICE)
NOTE that for USB cable you must comment out the line
@@ -30,4 +22,7 @@ Your keyboard and mouse will still work.
WARNING USB support on FreeBSD is still considered BETA!
+Add apcupsd_enable=YES to your /etc/rc.conf[.local] to have apcupsd
+starting up at boot time.
+
**********************************************************************
diff --git a/sysutils/apcupsd/pkg-plist b/sysutils/apcupsd/pkg-plist
index 07b3266b8e2b..589c7ee5a98c 100644
--- a/sysutils/apcupsd/pkg-plist
+++ b/sysutils/apcupsd/pkg-plist
@@ -1,6 +1,5 @@
sbin/apcupsd
sbin/apcaccess
-sbin/apcnisd
sbin/apctest
sbin/smtp
%%POWERFL%%sbin/powerflute
@@ -12,13 +11,13 @@ etc/apcupsd/apccontrol
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
+%%CGI%%@unexec if cmp -s %D/etc/apcupsd/hosts.conf.sample %D/etc/apcupsd/hosts.conf; then rm -f %D/etc/apcupsd/hosts.conf; fi
%%CGI%%etc/apcupsd/hosts.conf.sample
%%CGI%%@unexec if cmp -s %D/etc/apcupsd/multimon.conf.sample %D/etc/apcupsd/multimon.conf; then rm -f %D/etc/apcupsd/multimon.conf; fi
%%CGI%%etc/apcupsd/multimon.conf.sample
@@ -26,6 +25,6 @@ etc/apcupsd/onbattery
%%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
+%%PORTDOCS%%@dirrm %%DOCSDIR%%