From 440b72989b3a330594e689c3ef74ab3dbae85519 Mon Sep 17 00:00:00 2001 From: Robby Workman Date: Wed, 12 May 2010 17:44:57 +0200 Subject: system/apcupsd: Updated for version 3.14.5 --- system/apcupsd/README | 2 +- system/apcupsd/README-SLACKWARE | 55 --------------------------------------- system/apcupsd/README.SLACKWARE | 55 +++++++++++++++++++++++++++++++++++++++ system/apcupsd/apcupsd.SlackBuild | 31 +++++++++++++++------- system/apcupsd/apcupsd.info | 8 +++--- system/apcupsd/apcupsd.logrotate | 8 ++++++ system/apcupsd/doinst.sh | 3 +-- system/apcupsd/slack-desc | 4 +-- 8 files changed, 92 insertions(+), 74 deletions(-) delete mode 100644 system/apcupsd/README-SLACKWARE create mode 100644 system/apcupsd/README.SLACKWARE create mode 100644 system/apcupsd/apcupsd.logrotate (limited to 'system/apcupsd') diff --git a/system/apcupsd/README b/system/apcupsd/README index a5aafec1fc..f41fdcf630 100644 --- a/system/apcupsd/README +++ b/system/apcupsd/README @@ -13,6 +13,6 @@ 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.4/README-SLACKWARE for more +After installing, see /usr/doc/apcupsd-3.14.5/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 deleted file mode 100644 index 9587d0e26b..0000000000 --- a/system/apcupsd/README-SLACKWARE +++ /dev/null @@ -1,55 +0,0 @@ -README-SLACKWARE -Written by Robby Workman - -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/apcupsd/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/README.SLACKWARE b/system/apcupsd/README.SLACKWARE new file mode 100644 index 0000000000..9587d0e26b --- /dev/null +++ b/system/apcupsd/README.SLACKWARE @@ -0,0 +1,55 @@ +README-SLACKWARE +Written by Robby Workman + +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/apcupsd/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 index af4edb58ae..eff23168bb 100644 --- a/system/apcupsd/apcupsd.SlackBuild +++ b/system/apcupsd/apcupsd.SlackBuild @@ -2,7 +2,7 @@ # Slackware build script for apcupsd -# Copyright 2006-2008 Robby Workman Northport, Alabama, USA +# Copyright 2006-2009 Robby Workman Northport, AL, USA # All rights reserved. # # Redistribution and use of this script, with or without modification, is @@ -22,8 +22,11 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# Modified 3/3/2009 by Christopher Walker +# * added log rotation + PRGNAM=apcupsd -VERSION=3.14.4 +VERSION=3.14.5 ARCH=${ARCH:-i486} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} @@ -36,7 +39,7 @@ OUTPUT=${OUTPUT:-/tmp} # 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. -CGIPATH=${CGIPATH:-/etc/apcupsd} # Path for cgi executables +CGIPATH=${CGIPATH:-/var/www/cgi-bin} # Path for cgi executables DEVICE=${DEVICE:-/dev/usb/hiddev0} # Device node of UPS UPSTYPE=${UPSTYPE:-usb} # Type of UPS UPSCABLE=${UPSCABLE:-usb} # Cable type (RJ45<-->USB == USB) @@ -79,7 +82,6 @@ CXXFLAGS="$SLKCFLAGS" \ --with-cgi-bin=$CGIPATH \ --enable-usb \ --with-libwrap \ - --enable-nls \ --enable-snmp=yes \ --with-upstype=$UPSTYPE \ --with-upscable=$UPSCABLE \ @@ -89,13 +91,18 @@ CXXFLAGS="$SLKCFLAGS" \ make make install DESTDIR=$PKG -find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \ - | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true +( cd $PKG + find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | \ + xargs strip --strip-unneeded 2> /dev/null || true + find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | \ + xargs strip --strip-unneeded 2> /dev/null +) mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION -cp -a 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 +cp -a \ + COPYING ChangeLog DISCLAIMER Developers INSTALL ReleaseNotes \ + VERIFYING examples doc/* $CWD/README.SLACKWARE $CWD/$PRGNAM.SlackBuild \ + $PKG/usr/doc/$PRGNAM-$VERSION 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 {} \; @@ -112,6 +119,10 @@ install -D -m 0755 platforms/slackware/apcupsd \ install -d -m 0755 $PKG/var/lock/subsys chmod 1777 $PKG/var/lock +# Configure logrotate +mkdir -p $PKG/etc/logrotate.d +cat $CWD/apcupsd.logrotate > $PKG/etc/logrotate.d/apcupsd.new + # 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.conf offbattery onbattery ; do @@ -124,7 +135,7 @@ done ) mkdir -p $PKG/install -sed s/VERSION/$VERSION/ $CWD/slack-desc > $PKG/install/slack-desc +sed s/@VERSION@/$VERSION/ $CWD/slack-desc > $PKG/install/slack-desc cat $CWD/doinst.sh > $PKG/install/doinst.sh cd $PKG diff --git a/system/apcupsd/apcupsd.info b/system/apcupsd/apcupsd.info index b27dd943ed..1566ceef6d 100644 --- a/system/apcupsd/apcupsd.info +++ b/system/apcupsd/apcupsd.info @@ -1,8 +1,8 @@ PRGNAM="apcupsd" -VERSION="3.14.4" +VERSION="3.14.5" HOMEPAGE="http://www.apcupsd.org" -DOWNLOAD="http://downloads.sourceforge.net/apcupsd/apcupsd-3.14.4.tar.gz" -MD5SUM="78811129db1a882b9a2b9afd540470b3" +DOWNLOAD="http://downloads.sourceforge.net/apcupsd/apcupsd-3.14.5.tar.gz" +MD5SUM="4ac73ec91d8ab56f3fac894e172567c4" MAINTAINER="Robby Workman" EMAIL="rw@rlworkman.net" -APPROVED="David Somero" +APPROVED="dsomero" diff --git a/system/apcupsd/apcupsd.logrotate b/system/apcupsd/apcupsd.logrotate new file mode 100644 index 0000000000..507c9cdaf3 --- /dev/null +++ b/system/apcupsd/apcupsd.logrotate @@ -0,0 +1,8 @@ +/var/log/apcupsd.events { + rotate 4 + weekly + notifempty + postrotate + /etc/rc.d/rc.apcupsd restart 1>/dev/null || true + endscript +} diff --git a/system/apcupsd/doinst.sh b/system/apcupsd/doinst.sh index 797750001b..e4732cd256 100644 --- a/system/apcupsd/doinst.sh +++ b/system/apcupsd/doinst.sh @@ -1,5 +1,3 @@ -#!/bin/sh - config() { NEW="$1" OLD="$(dirname $NEW)/$(basename $NEW .new)" @@ -31,4 +29,5 @@ config etc/apcupsd/hosts.conf.new config etc/apcupsd/multimon.conf.new config etc/apcupsd/offbattery.new config etc/apcupsd/onbattery.new +config etc/logrotate.d/apcupsd.new diff --git a/system/apcupsd/slack-desc b/system/apcupsd/slack-desc index d853a557ff..8e7ee00dcb 100644 --- a/system/apcupsd/slack-desc +++ b/system/apcupsd/slack-desc @@ -5,7 +5,7 @@ # make exactly 11 lines for the formatting to be correct. It's also # customary to leave one space after the ':'. - |-----handy-ruler-----------------------------------------------------| + |-----handy-ruler------------------------------------------------------| apcupsd: apcupsd (APC UPS Daemon) apcupsd: apcupsd: Apcupsd can be used for power mangement and controlling most of APC's @@ -13,7 +13,7 @@ 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: See /usr/doc/apcupsd-@VERSION@/README.SLACKWARE apcupsd: apcupsd: apcupsd: -- cgit v1.2.3