Add apcupsd 3.8.3, a daemon for controlling APC UPS.

PR:		31478
Submitted by:	Lars Koeller <Lars.Koeller@Uni-Bielefeld.DE>
This commit is contained in:
Lars Koeller
2001-12-02 11:24:53 +00:00
parent 417a7a0ec0
commit da0b33d01c
10 changed files with 342 additions and 0 deletions

View File

@@ -5,6 +5,7 @@
SUBDIR += abck
SUBDIR += afio
SUBDIR += anteater
SUBDIR += apcupsd
SUBDIR += asapm
SUBDIR += ascpu
SUBDIR += asfsm

54
sysutils/apcupsd/Makefile Normal file
View File

@@ -0,0 +1,54 @@
# New ports collection makefile for: apcupsd
# Date created: 1.12.2001
# Whom: Lars Köller <Lars.Koeller@Uni-Bielefeld.DE>
#
# $FreeBSD$
#
PORTNAME= apcupsd
PORTVERSION= 3.8.3
CATEGORIES= sysutils
MASTER_SITES= ftp://ftp.apcupsd.org/pub/apcupsd/stable/tar/
MAINTAINER= Lars.Koeller@Uni-Bielefeld.de
LIB_DEPENDS= intl.1:${PORTSDIR}/devel/gettext
STARTUP_SCRIPT= apcupsd.sh.sample
PLIST_SUB= STARTUP_SCRIPT=${STARTUP_SCRIPT}
HAS_CONFIGURE= yes
CONFIGURE_ARGS= --prefix=${PREFIX} --sbindir=${PREFIX}/sbin \
--enable-nls \
--sysconfdir=${PREFIX}/etc/apcupsd \
--with-serial-dev=/dev/usv \
--enable-cgi --with-cgi-bin=${PREFIX}/etc/apcupsd/cgi
CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" \
CFLAGS="-I${LOCALBASE}/include" \
LIBS="-L${LOCALBASE}/lib"
.include <bsd.port.pre.mk>
# Cause FreeBSD 3.X misses libmenu, libforms and libpanel (curses)
.if ${OSVERSION} > 400000
CONFIGURE_ARGS+=--enable-powerflute
PLIST_SUB+= POWERFL=""
.else
PLIST_SUB+= POWERFL="@comment "
.endif
MAN8= "apcupsd.8"
PORTDOCS= doc/manual/apcupsd.pdf
post-install:
${INSTALL_SCRIPT} ${FILESDIR}/${STARTUP_SCRIPT} \
${PREFIX}/etc/rc.d/${STARTUP_SCRIPT}
.if !defined(NOPORTDOCS)
@${MKDIR} ${DOCSDIR}
.for file in ${PORTDOCS}
${INSTALL_DATA} ${WRKSRC}/${file} ${DOCSDIR}
.endfor
.endif
.include <bsd.port.post.mk>

View File

@@ -0,0 +1 @@
MD5 (apcupsd-3.8.3.tar.gz) = 05966c23d3404c8598e78663738bae0c

View File

@@ -0,0 +1,63 @@
#!/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_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}
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;

View File

@@ -0,0 +1,53 @@
*** ../../configure Sat Dec 1 19:51:44 2001
--- configure Sat Dec 1 19:53:05 2001
***************
*** 4327,4333 ****
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
! LIBS="-lmenu $LIBS"
cat > conftest.$ac_ext <<EOF
#line 4333 "configure"
#include "confdefs.h"
--- 4327,4333 ----
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
! LIBS="-lmenu -lcurses $LIBS"
cat > conftest.$ac_ext <<EOF
#line 4333 "configure"
#include "confdefs.h"
***************
*** 4368,4374 ****
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
! LIBS="-lform $LIBS"
cat > conftest.$ac_ext <<EOF
#line 4374 "configure"
#include "confdefs.h"
--- 4368,4374 ----
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
! LIBS="-lform -lcurses $LIBS"
cat > conftest.$ac_ext <<EOF
#line 4374 "configure"
#include "confdefs.h"
***************
*** 4409,4415 ****
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
! LIBS="-lpanel $LIBS"
cat > conftest.$ac_ext <<EOF
#line 4415 "configure"
#include "confdefs.h"
--- 4409,4415 ----
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
! LIBS="-lpanel -lcurses $LIBS"
cat > conftest.$ac_ext <<EOF
#line 4415 "configure"
#include "confdefs.h"

View File

@@ -0,0 +1,79 @@
*** Makefile.in.orig Sat Nov 24 09:23:03 2001
--- Makefile.in Sun Dec 2 11:47:56 2001
***************
*** 196,202 ****
install-:
$(MAKE) dummy
! install: install-apcupsd@WIN32@ install-@POWERFLUTE@ install-cgi @INSTALL_DISTDIR@
install-powerflute: powerflute
@echo "Installing powerflute binary..."
--- 196,202 ----
install-:
$(MAKE) dummy
! install: install-apcupsd@WIN32@ install-@POWERFLUTE@ install-cgi
install-powerflute: powerflute
@echo "Installing powerflute binary..."
***************
*** 219,249 ****
@echo "Installing apcaccess binary..."
$(INSTALL_PROGRAM) $(srcdir)/apcaccess $(sbindir)/apcaccess
@echo "Installing apccontrol script..."
! $(INSTALL_PROGRAM) -m 744 $(srcdir)/distributions/$(DISTNAME)/apccontrol.sh $(sysconfdir)/apccontrol
@echo "Installing manual pages..."
$(INSTALL_DATA) $(srcdir)/doc/apcupsd.man $(mandir)/apcupsd.$(manext)
@echo "Installing language catalogs..."
@POMAKE@ install
# don't overwrite any existing config file
! echo "Installing apcupsd.conf..."; \
if [ -f $(srcdir)/distributions/$(DISTNAME)/apcupsd.conf ]; then \
srcconf=$(srcdir)/distributions/$(DISTNAME)/apcupsd.conf; \
else \
srcconf=etc/apcupsd.conf; \
fi; \
! if test -f $(sysconfdir)/apcupsd.conf; then \
! dstconf=apcupsd.conf.new; \
! echo " found old apcupsd.conf, installing new conf file as $$dstconf"; \
! else \
! dstconf=apcupsd.conf; \
! fi; \
echo "$(INSTALL_DATA) $$srcconf $(sysconfdir)/$$dstconf"; \
! $(INSTALL_PROGRAM) -m 644 $$srcconf $(sysconfdir)/$$dstconf
! $(INSTALL_PROGRAM) -m 744 $(srcdir)/etc/changeme $(sysconfdir)
! $(INSTALL_PROGRAM) -m 744 $(srcdir)/etc/commfailure $(sysconfdir)
! $(INSTALL_PROGRAM) -m 744 $(srcdir)/etc/commok $(sysconfdir)
! $(INSTALL_PROGRAM) -m 744 $(srcdir)/etc/onbattery $(sysconfdir)
! $(INSTALL_PROGRAM) -m 744 $(srcdir)/etc/mainsback $(sysconfdir)
install-apcupsdwin32: apcupsd
--- 219,244 ----
@echo "Installing apcaccess binary..."
$(INSTALL_PROGRAM) $(srcdir)/apcaccess $(sbindir)/apcaccess
@echo "Installing apccontrol script..."
! $(INSTALL_DATA) -m 744 $(srcdir)/distributions/$(DISTNAME)/apccontrol.sh $(sysconfdir)/apccontrol
@echo "Installing manual pages..."
$(INSTALL_DATA) $(srcdir)/doc/apcupsd.man $(mandir)/apcupsd.$(manext)
@echo "Installing language catalogs..."
@POMAKE@ install
# don't overwrite any existing config file
! echo "Installing sample apcupsd.conf..."; \
if [ -f $(srcdir)/distributions/$(DISTNAME)/apcupsd.conf ]; then \
srcconf=$(srcdir)/distributions/$(DISTNAME)/apcupsd.conf; \
else \
srcconf=etc/apcupsd.conf; \
fi; \
! dstconf=apcupsd.conf.sample; \
echo "$(INSTALL_DATA) $$srcconf $(sysconfdir)/$$dstconf"; \
! $(INSTALL_DATA) -m 644 $$srcconf $(sysconfdir)/$$dstconf
! $(INSTALL_DATA) -m 744 $(srcdir)/etc/changeme $(sysconfdir)
! $(INSTALL_DATA) -m 744 $(srcdir)/etc/commfailure $(sysconfdir)
! $(INSTALL_DATA) -m 744 $(srcdir)/etc/commok $(sysconfdir)
! $(INSTALL_DATA) -m 744 $(srcdir)/etc/onbattery $(sysconfdir)
! $(INSTALL_DATA) -m 744 $(srcdir)/etc/mainsback $(sysconfdir)
install-apcupsdwin32: apcupsd

View File

@@ -0,0 +1,53 @@
*** cgi/Makefile.in.orig Thu Jun 21 10:16:41 2001
--- cgi/Makefile.in Sun Dec 2 11:04:54 2001
***************
*** 84,89 ****
--- 84,92 ----
rm -f Makefile config.h
install: cgi
+ @if test ! -d $(cgibin) ; then \
+ mkdir -p $(cgibin); \
+ fi
@for p in $(CGIPROGS) ; do \
echo $(INSTALL_PROGRAM) $$p $(cgibin); \
$(INSTALL_PROGRAM) $$p $(cgibin); \
***************
*** 98,114 ****
echo "No CSS_DIR found, did not install multimon.css" ; \
fi
# don't overwrite any existing config file
! @if test ! -f $(sysconfdir)/hosts.conf; then \
! (echo "Installing hosts.conf..." && $(INSTALL_DATA) ../etc/hosts.conf $(sysconfdir)/hosts.conf); \
! else \
! (echo "Installing hosts.conf in $(sysconfdir)/hosts.conf.new" && $(INSTALL_DATA) ../etc/hosts.conf $(sysconfdir)/hosts.conf.new); \
! fi
# don't overwrite any existing config file
! @if test ! -f $(sysconfdir)/multimon.conf; then \
! (echo "Installing multimon.conf..." && $(INSTALL_DATA) ../etc/multimon.conf $(sysconfdir)/multimon.conf); \
! else \
! (echo "Installing multimon.conf in $(sysconfdir)/multimon.conf.new" && $(INSTALL_DATA) ../etc/multimon.conf $(sysconfdir)/multimon.conf.new); \
! fi
uninstall:
@echo "Uninstalling cgi program support..."
--- 101,119 ----
echo "No CSS_DIR found, did not install multimon.css" ; \
fi
# don't overwrite any existing config file
! # @if test ! -f $(sysconfdir)/hosts.conf; then \
! # (echo "Installing hosts.conf..." && $(INSTALL_DATA) ../etc/hosts.conf $(sysconfdir)/hosts.conf); \
! # else \
! # (echo "Installing hosts.conf in $(sysconfdir)/hosts.conf.new" && $(INSTALL_DATA) ../etc/hosts.conf $(sysconfdir)/hosts.conf.new); \
! # fi
! $(INSTALL_DATA) ../etc/hosts.conf $(sysconfdir)/hosts.conf.sample
# don't overwrite any existing config file
! # @if test ! -f $(sysconfdir)/multimon.conf; then \
! # (echo "Installing multimon.conf..." && $(INSTALL_DATA) ../etc/multimon.conf $(sysconfdir)/multimon.conf); \
! # else \
! # (echo "Installing multimon.conf in $(sysconfdir)/multimon.conf.new" && $(INSTALL_DATA) ../etc/multimon.conf $(sysconfdir)/multimon.conf.new); \
! # fi
! $(INSTALL_DATA) ../etc/multimon.conf $(sysconfdir)/multimon.conf.sample
uninstall:
@echo "Uninstalling cgi program support..."

View File

@@ -0,0 +1 @@
A daemon for controlling APC UPS

View File

@@ -0,0 +1,10 @@
"apcupsd" can be used for controlling all APC UPS models
It can monitor and log the current power and battery status, perform
automatic shutdown, and can run in network mode in order to power down
other hosts on a LAN
WWW: http://www.apcupsd.org
- Lars
Lars.Koeller@Uni-Bielefeld.DE

View File

@@ -0,0 +1,27 @@
sbin/apcupsd
sbin/apcaccess
sbin/apcnisd
%%POWERFL%%sbin/powerflute
etc/apcupsd/apccontrol
@unexec if [ -f %D/etc/apcupsd/apcupsd.conf ]; then cmp -s %D/etc/apcupsd/apcupsd.conf.sample %D/etc/apcupsd/apcupsd.conf && rm -f %D/etc/apcupsd/apcupsd.conf || echo "If you are permanently removing this port, you should do a ``rm ${PKG_PREFIX}/etc/apcupsd/apcupsd.conf`` to remove config files left." | fmt ; fi
etc/apcupsd/apcupsd.conf.sample
etc/apcupsd/changeme
etc/apcupsd/commfailure
etc/apcupsd/commok
etc/apcupsd/onbattery
etc/apcupsd/mainsback
@unexec if [ -f %D/etc/apcupsd/hosts.conf ]; then cmp -s %D/etc/apcupsd/hosts.conf.sample %D/etc/apcupsd/hosts.conf && rm -f %D/etc/apcupsd/hosts.conf || echo "If you are permanently removing this port, you should do a ``rm ${PKG_PREFIX}/etc/apcupsd/hosts.conf`` to remove config files left." | fmt ; fi
etc/apcupsd/hosts.conf.sample
@unexec if [ -f %D/etc/apcupsd/multimon.conf ]; then cmp -s %D/etc/apcupsd/multimon.conf.sample %D/etc/apcupsd/multimon.conf && rm -f %D/etc/apcupsd/multimon.conf || echo "If you are permanently removing this port, you should do a ``rm ${PKG_PREFIX}/etc/apcupsd/multimon.conf`` to remove config files left." | fmt ; fi
etc/apcupsd/multimon.conf.sample
etc/apcupsd/cgi/multimon.cgi
etc/apcupsd/cgi/multimoncss.cgi
etc/apcupsd/cgi/upsfstats.cgi
etc/apcupsd/cgi/upsimage.cgi
etc/apcupsd/cgi/upsstats.cgi
etc/rc.d/%%STARTUP_SCRIPT%%
share/locale/it/LC_MESSAGES/apcupsd.mo
%%PORTDOCS%%share/doc/apcupsd/apcupsd.pdf
@dirrm etc/apcupsd/cgi
@dirrm etc/apcupsd
%%PORTDOCS%%@dirrm share/doc/apcupsd