summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--system/apcupsd/README19
-rw-r--r--system/apcupsd/README-SLACKWARE60
-rw-r--r--system/apcupsd/apcupsd.SlackBuild131
-rw-r--r--system/apcupsd/apcupsd.info8
-rw-r--r--system/apcupsd/doinst.sh34
-rw-r--r--system/apcupsd/slack-desc11
6 files changed, 263 insertions, 0 deletions
diff --git a/system/apcupsd/README b/system/apcupsd/README
new file mode 100644
index 0000000000..6646eb7aec
--- /dev/null
+++ b/system/apcupsd/README
@@ -0,0 +1,19 @@
+APCUPSD can be used for power management and controlling most of APC's UPS
+models on Unix and Windows machines. Apcupsd works with most of APC's
+Smart-UPS models as well as most simple signalling models such as Back-UPS
+and BackUPS-Office.
+
+This buildscript veers from the "accepted" installation of apcupsd, but for
+what I believe you'll see are justifiable reasons. The stock install of
+apcupsd detects its presence on Slackware and attempts to patch the system's
+/etc/rc.d/rc.6 script and places the rc.apcupsd script inside /etc/rc.d
+(instead of DESTDIR/etc/rc.d - in essence, it touches files outside DESTDIR).
+I don't view this as even remotely acceptable, so the build script disables
+the distribution-specific installation to prevent messing with files outside
+DESTDIR; however, this does make it require some manual configuration after
+installation.
+
+After installing, see /usr/doc/apcupsd-3.14.0/README-SLACKWARE for more
+information on how to modify rc.6 and how to start the apcupsd daemon
+automatically at boot.
+
diff --git a/system/apcupsd/README-SLACKWARE b/system/apcupsd/README-SLACKWARE
new file mode 100644
index 0000000000..b4d6a1a93a
--- /dev/null
+++ b/system/apcupsd/README-SLACKWARE
@@ -0,0 +1,60 @@
+README-SLACKWARE
+Written by Robby Workman <rworkman@slackbuilds.org>
+
+
+First, see /usr/doc/apcupsd-3.14.0/examples/make-hiddev if you're using
+a 2.4.x kernel and need to manually create the device node(s).
+
+
+Second, you'll need to start the apcupsd service at boot.
+The recommended way is to add the following to your /etc/rc.d/rc.local
+script:
+
+ if [ -x /etc/rc.d/rc.apcupsd ]; then
+ /etc/rc.d/rc.apcupsd start
+ fi
+
+Make sure the rc.apcupsd script is executable.
+
+
+Finally, you'll need to edit your /etc/rc.d/rc.6 script for apcupsd
+to perform the shutdown on power failures. Here's the short version:
+Scroll down to the end of rc.6 - you should see a section that calls
+/sbin/genpowerd. Comment out (or remove) this entire section:
+
+ if [ -x /sbin/genpowerd ]; then
+ # See if this is a powerfail situation:
+ if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then
+ # Signal UPS to shut off the inverter:
+ /sbin/genpowerd -k
+ if [ ! $? = 0 ]; then
+ echo
+ echo "There was an error signaling the UPS."
+ echo "Perhaps you need to edit /etc/genpowerd.conf to configure"
+ echo "the serial line and UPS type."
+ # Wasting 15 seconds of precious power:
+ /bin/sleep 15
+ fi
+ fi
+ fi
+
+
+Now replace that section with this (or add immediately after it if you
+chose to comment out the original):
+
+ # This will cause the UPS to kill the power supply after a configurable number
+ # of seconds (see the apcupsd.conf file). This is important for situations
+ # where the mains power comes back before the UPS batteries are completely
+ # dead.
+ if [ -f /etc/powerfail ]; then
+ echo
+ echo "apcupsd will now power off the UPS"
+ echo
+ /etc/apcupsd/apccontrol killpower
+ echo
+ echo "Please ensure that the UPS has powered off before rebooting."
+ echo "Otherwise, the UPS may cut the power during the reboot."
+ echo
+ halt -f -p # power down the system if the hardware is capable
+ fi
+
diff --git a/system/apcupsd/apcupsd.SlackBuild b/system/apcupsd/apcupsd.SlackBuild
new file mode 100644
index 0000000000..6f110ed612
--- /dev/null
+++ b/system/apcupsd/apcupsd.SlackBuild
@@ -0,0 +1,131 @@
+#!/bin/sh
+
+# Slackware build script for apcupsd
+
+# Copyright 2006-2007 Robby Workman (http://rlworkman.net)
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# Modified by the SlackBuilds.org project
+
+set -e
+
+PRGNAM=apcupsd
+VERSION=3.14.0
+ARCH=${ARCH:-i486}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+CWD=$(pwd)
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+SNMP=${SNMP:-no} # Change to "yes" if you have net-snmp installed
+ # and wish to have support for SNMP
+
+# These can be changed in the config file after installing apcupsd,
+# so it's okay to leave them alone if you don't know what the values
+# should be yet.
+DEVICE=${DEVICE:-/dev/usb/hiddev0} # Device node of UPS
+UPSTYPE=${UPSTYPE:-usb} # Type of UPS
+UPSCABLE=${UPSCABLE:-usb} # Cable type (RJ45<-->USB == USB)
+
+if [ "$ARCH" = "i486" ]; then
+ SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+fi
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$VERSION
+tar -xzvf $CWD/$PRGNAM-$VERSION.tar.gz
+cd $PRGNAM-$VERSION
+chown -R root:root .
+chmod -R a-s,u+w,go+r-w .
+
+# The "--disable-install-distdir" is important - don't remove it
+# If you enable the distribution-specific install, then apcupsd will attempt
+# to patch the /etc/rc.d/rc.6 script on your system. This may be acceptable
+# from a single-user standpoint, but for packagers, it's not worth a crap.
+# If I'd wanted the Makefile tampering with things outside DESTDIR, I wouldn't
+# have used the DESTDIR flag - why is this so difficult to comprehend?
+CFLAGS="$SLKCFLAGS" \
+CXXFLAGS="$SLKCFLAGS" \
+./configure \
+ --prefix=/usr \
+ --sbindir=/sbin \
+ --mandir=/usr/man \
+ --localstatedir=/var \
+ --sysconfdir=/etc/apcupsd \
+ --disable-install-distdir \
+ --enable-cgi \
+ --with-cgi-bin=/etc/apcupsd \
+ --enable-usb \
+ --enable-powerflute \
+ --with-libwrap \
+ --enable-nls \
+ --enable-snmp=$SNMP \
+ --with-upstype=$UPSTYPE \
+ --with-upscable=$UPSCABLE \
+ --with-dev=$DEVICE \
+ --build=$ARCH-slackware-linux \
+ --host=$ARCH-slackware-linux
+
+make
+make install-strip DESTDIR=$PKG
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a \
+ ABOUT-NLS COPYING ChangeLog* DISCLAIMER Developers INSTALL ReleaseNotes \
+ VERIFYING examples doc/* $CWD/README-SLACKWARE $PKG/usr/doc/$PRGNAM-$VERSION
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+find $PKG/usr/doc/$PRGNAM-$VERSION -type f -exec chmod 644 {} \;
+find $PKG/usr/doc/$PRGNAM-$VERSION -name "Makefile*" -exec rm {} \;
+find $PKG/usr/doc/$PRGNAM-$VERSION -name "*.man" -exec rm {} \;
+
+# Install the apctest man page - it's not done automatically for some reason
+install -m 0644 doc/apctest.man $PKG/usr/man/man8/apctest.8
+
+# Install the apcupsd init script
+install -D -m 0755 platforms/slackware/apcupsd \
+ $PKG/etc/rc.d/rc.apcupsd.new
+
+# Create the /var/lock/subsys directory
+install -d -m 0755 $PKG/var/lock/subsys
+
+# Rename config files to *.new so custom changes aren't clobberred
+for i in apccontrol apcupsd.conf apcupsd.css changeme \
+ commfailure commok hosts.conf multimon.cgi multimon.conf \
+ offbattery onbattery upsfstats.cgi upsimage.cgi upsstats.cgi ; do
+ mv $PKG/etc/apcupsd/$i $PKG/etc/apcupsd/$i.new;
+done
+
+( cd $PKG/usr/man
+ find . -type f -exec gzip -9 {} \;
+ for i in $( find . -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
+)
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+cat $CWD/doinst.sh > $PKG/install/doinst.sh
+
+cd $PKG
+/sbin/makepkg -l y -c n -p $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz
diff --git a/system/apcupsd/apcupsd.info b/system/apcupsd/apcupsd.info
new file mode 100644
index 0000000000..a4fbba559f
--- /dev/null
+++ b/system/apcupsd/apcupsd.info
@@ -0,0 +1,8 @@
+PRGNAM="apcupsd"
+VERSION="3.14.0"
+HOMEPAGE="http://www.apcupsd.org"
+DOWNLOAD="http://dl.sourceforge.net/apcupsd/apcupsd-3.14.0.tar.gz"
+MD5SUM="334fe3413c08f14acec0226e71e98e0a"
+MAINTAINER="Robby Workman"
+EMAIL="rw@rlworkman.net"
+APPROVED="BP{k}"
diff --git a/system/apcupsd/doinst.sh b/system/apcupsd/doinst.sh
new file mode 100644
index 0000000000..f393efaa22
--- /dev/null
+++ b/system/apcupsd/doinst.sh
@@ -0,0 +1,34 @@
+config() {
+ NEW="$1"
+ OLD="`dirname $NEW`/`basename $NEW .new`"
+ # If there's no config file by that name, mv it over:
+ if [ ! -r $OLD ]; then
+ mv $NEW $OLD
+ elif [ "`cat $OLD | md5sum`" = "`cat $NEW | md5sum`" ]; then
+ # toss the redundant copy
+ rm $NEW
+ fi
+ # Otherwise, we leave the .new copy for the admin to consider...
+}
+
+for i in \
+ apccontrol.new \
+ apcupsd.conf.new \
+ apcupsd.css.new \
+ changeme.new \
+ commfailure.new \
+ commok.new \
+ hosts.conf.new \
+ multimon.cgi.new \
+ multimon.conf.new \
+ offbattery.new \
+ onbattery.new \
+ upsfstats.cgi.new \
+ upsimage.cgi.new \
+ upsstats.cgi.new;
+do \
+ config etc/apcupsd/$i;
+done
+
+config etc/rc.d/rc.apcupsd.new
+
diff --git a/system/apcupsd/slack-desc b/system/apcupsd/slack-desc
new file mode 100644
index 0000000000..7971e76310
--- /dev/null
+++ b/system/apcupsd/slack-desc
@@ -0,0 +1,11 @@
+apcupsd: APC UPS Daemon
+apcupsd:
+apcupsd: Apcupsd can be used for power mangement and controlling most of APC's
+apcupsd: UPS models on Unix and Windows machines. Apcupsd works with most of
+apcupsd: APC's Smart-UPS models as well as most simple signalling models such
+apcupsd: as Back-UPS, and BackUPS-Office.
+apcupsd:
+apcupsd: See /usr/doc/apcupsd-$VERSION/README-SLACKWARE
+apcupsd:
+apcupsd:
+apcupsd: