diff options
Diffstat (limited to 'sysutils/apcupsd/patches/patch-ai')
-rw-r--r-- | sysutils/apcupsd/patches/patch-ai | 126 |
1 files changed, 17 insertions, 109 deletions
diff --git a/sysutils/apcupsd/patches/patch-ai b/sysutils/apcupsd/patches/patch-ai index 30a38aa75c9..3d0412f3bc8 100644 --- a/sysutils/apcupsd/patches/patch-ai +++ b/sysutils/apcupsd/patches/patch-ai @@ -1,112 +1,20 @@ -$NetBSD: patch-ai,v 1.1.1.1 2000/01/21 19:16:00 bouyer Exp $ +$NetBSD: patch-ai,v 1.2 2000/08/05 07:31:21 jlam Exp $ ---- installs/powersc.orig Tue Jul 20 18:58:51 1999 -+++ installs/powersc Tue Jul 20 19:14:13 1999 -@@ -4,25 +4,9 @@ - POWERPID=/var/run/power.pid - APCPID=/var/run/apcupsd.pid +--- apchttp.c.orig Mon Apr 26 14:16:43 1999 ++++ apchttp.c Sat Aug 5 02:52:41 2000 +@@ -70,7 +70,6 @@ --if [ -x /sbin/shutdown ]; then - SHUTDOWN=/sbin/shutdown --elif [ -x /sbin/shutdown.bsd ]; then -- SHUTDOWN=/sbin/shutdown.bsd --else -- echo Command shutdown or shutdown.bsd not found! -- exit 1 --fi + #include <ctype.h> + #include <errno.h> +-#include <netinet/in.h> + #include <signal.h> + #include <stdio.h> + #include <stdlib.h> +@@ -80,6 +79,7 @@ + #include <sys/types.h> + #include <time.h> + #include <unistd.h> ++#include <netinet/in.h> --if [ -x /usr/local/sbin/apcupsd ]; then -- APCUPSD=/usr/local/sbin/apcupsd --elif [ -x /usr/sbin/apcupsd ]; then -- APCUPSD=/usr/sbin/apcupsd --elif [ -x /sbin/apcupsd ]; then -- APCUPSD=/sbin/apcupsd --else -- echo Command apcupsd not found! -- exit 1 --fi -+ APCUPSD=@@PREFIX@@/sbin/apcupsd - - if test "$(whoami)" != "root"; then - printf "Sorry, you must be root to run this script." | wall -@@ -32,42 +16,52 @@ - case "$1" in - POWEROUT) - printf "Warning there are Power problems." | wall -+ /usr/bin/logger -p user.info -t apcupsd \ -+ "Warning there are Power problems." - ;; - ONBATTERY) - printf "Power Failure running on UPS." | wall -+ /usr/bin/logger -p user.info -t apcupsd \ -+ "Power Failure running on UPS." - ;; - FAILING) - printf "Battery Power Failed, Normal Shutdown.\n" | wall -+ /usr/bin/logger -p user.emerg -t apcupsd \ -+ "UPS Battery Power Failed, Normal Shutdown." - ;; - TIMEOUT) - printf "Online Battery timeout, Normal Shutdown.\n" | wall -+ /usr/bin/logger -p user.emerg -t apcupsd \ -+ "UPS Online Battery timeout, Normal Shutdown." - ;; - LOADLIMIT) - printf "Battery Load Limits Reached, Normal Shutdown.\n" | wall -+ /usr/bin/logger -p user.emerg -t apcupsd \ -+ "UPS Battery Load Limits Reached, Normal Shutdown." - ;; - RUNLIMIT) - printf "Battery RunTime Limits Reached, Normal Shutdown.\n" | wall -+ /usr/bin/logger -p user.emerg -t apcupsd \ -+ "Battery RunTime Limits Reached, Normal Shutdown." - ;; - DOSHUTDOWN) - printf "Beginning Shutdown Sequence!!!!!" | wall -- ps x | gawk '{ if (($5 == "init") && ($1 == "1")) print $6 }' \ -- | cut -f2 -d[ | cut -f1 -d] \ -- > /tmp/run.level.power - if [ -f $POWERPID ] - then - exit 0 - else - echo $$ > $POWERPID -- $SHUTDOWN -h now -+ $SHUTDOWN -h now "UPS Powerfail" - fi - ;; - MAINSBACK | WAITASEC) - printf "Power has returned..." | wall -+ /usr/bin/logger -p user.info -t apcupsd \ -+ "Power has returned..." - if [ -f $POWERPID ]; then - printf "Attempting to cancel shutdown." - kill $(cat $POWERPID) - rm -f $POWERPID -- init $(cat /tmp/run.level.power) - fi - ;; - ANNOYME) -@@ -75,14 +69,20 @@ - ;; - EMERGENCY) - printf "Emergency Shutdown, Possible Battery Failure!!!!" | wall -- $SHUTDOWN -h now -+ /usr/bin/logger -p user.emerg -t apcupsd \ -+ "Emergency Shutdown, Possible Battery Failure!!!!" -+ $SHUTDOWN -h now "Emergency Shutdown" - ;; - CHANGEME) - printf "Emergency, Batteries Have Failed!!!!\nChange Them NOW!!!!" | wall -+ /usr/bin/logger -p user.emerg -t apcupsd \ -+ "Emergency, Batteries Have Failed!!!! Change Them NOW!!!!" - ;; - REMOTE) - printf "Remote Calls, Normal Shutdown.\nBeginning Shutdown Sequence!!!!!" | wall -- $SHUTDOWN -h now -+ /usr/bin/logger -p user.emerg -t apcupsd \ -+ "Remote Calls, Normal Shutdown" -+ $SHUTDOWN -h now "Remote Calls, Normal Shutdown" - ;; - KILL) sleep 1 - $APCUPSD killpower + #include <apc_config.h> + #include <apc_i18n.h> |