+diff -urN apcupsd-3.8.1/Makefile.in apcupsd-3.8.1.grzegorz/Makefile.in
+--- apcupsd-3.8.1/Makefile.in Mon Dec 4 08:04:56 2000
++++ apcupsd-3.8.1.grzegorz/Makefile.in Sun Jun 10 15:59:29 2001
+@@ -30,7 +30,7 @@
+ # this is a list of all subdirectories that contain or could contain Makefiles
+ #
+ subdirs = . @INTLSUB@ @POSUB@ cgi doc lib contrib distributions distributions/debian \
+- distributions/freebsd distributions/hpux distributions/openbsd distributions/redhat \
++ distributions/freebsd distributions/hpux distributions/openbsd distributions/pld distributions/redhat \
+ distributions/slackware distributions/sun distributions/suse \
+ distributions/unifix win32
+
+@@ -359,6 +359,7 @@
+
+ all = $(docs) $(config) $(srcs) $(parser) $(headers) $(extra) $(scripts) \
+ $(srcdir)/distributions/redhat/* $(srcdir)/distributions/debian/* \
++ $(srcdir)/distributions/pld/* \
+ $(srcdir)/distributions/slackware/* $(srcdir)/distributions/suse/* \
+ $(srcdir)/distributions/unifix/* $(srcdir)/distributions/unknown/* \
+ $(srcdir)/intl/* $(srcdir)/po/* $(srcdir)/etc/*
+diff -urN apcupsd-3.8.1/configure apcupsd-3.8.1.grzegorz/configure
+--- apcupsd-3.8.1/configure Mon Dec 11 22:52:51 2000
++++ apcupsd-3.8.1.grzegorz/configure Sun Jun 10 16:02:23 2001
+@@ -6431,6 +6431,9 @@
+ distributions/redhat/apccontrol.sh \
+ distributions/redhat/awkhaltprog \
+ distributions/redhat/apcupsd.spec \
++ distributions/pld/Makefile \
++ distributions/pld/apcupsd \
++ distributions/pld/apccontrol.sh \
+ distributions/unknown/Makefile \
+ distributions/unknown/apcupsd \
+ distributions/unknown/apccontrol.sh \
+diff -urN apcupsd-3.8.1/distributions/Makefile.in apcupsd-3.8.1.grzegorz/distributions/Makefile.in
+--- apcupsd-3.8.1/distributions/Makefile.in Fri Sep 22 17:02:21 2000
++++ apcupsd-3.8.1.grzegorz/distributions/Makefile.in Sun Jun 10 15:59:29 2001
+@@ -10,7 +10,7 @@
+ # Generic install program.
+ INSTALL = @INSTALL@
+
+-SUBDIRS = freebsd redhat sun unknown hpux suse openbsd \
++SUBDIRS = freebsd redhat sun unknown hpux suse openbsd pld \
+ slackware alpha
+
+ # Some makes apparently use .PHONY as the default goal if it is before `all'.
+diff -urN apcupsd-3.8.1/distributions/pld/Makefile.in apcupsd-3.8.1.grzegorz/distributions/pld/Makefile.in
+--- apcupsd-3.8.1/distributions/pld/Makefile.in Thu Jan 1 01:00:00 1970
++++ apcupsd-3.8.1.grzegorz/distributions/pld/Makefile.in Sun Jun 10 15:59:29 2001
+@@ -0,0 +1,65 @@
++#
++# This file is used as the template to create the
++# Makefile for the RedHat 5.2, 6.0 and 6.1 specific
++# installation.
++#
++# 25 Sep 1999 -- KES
++#
++
++
++INSTALL = @INSTALL@
++INSTALL_PROGRAM = @INSTALL_PROGRAM@
++
++all: install
++
++install:
++ @if test -f /etc/rc.d/init.d/apcupsd; then \
++ /sbin/chkconfig --del apcupsd; \
++ fi
++ # remove old 3.6.2 stuff
++ @rm -f /etc/rc.d/rc0.d/K20apcups
++ @rm -f /etc/rc.d/rc1.d/S20apcups
++ @rm -f /etc/rc.d/rc1.d/K20apcups
++ @rm -f /etc/rc.d/rc2.d/S20apcups
++ @rm -f /etc/rc.d/rc3.d/S20apcups
++ @rm -f /etc/rc.d/rc5.d/S20apcups
++ @rm -f /etc/rc.d/rc6.d/K20apcups
++ @rm -f /etc/rc.d/init.d/apcups
++ @$(INSTALL_PROGRAM) -m 744 apcupsd /etc/rc.d/init.d/apcupsd
++ # save old halt script
++ @cp -f /etc/rc.d/init.d/halt /etc/rc.d/init.d/halt.old
++ # insert apcupsd script into halt
++ @awk -f awkhaltprog /etc/rc.d/init.d/halt.old >/etc/rc.d/init.d/halt
++ @chmod 744 /etc/rc.d/init.d/halt
++ # link new halt script for startup and shutdown
++ @/sbin/chkconfig --add apcupsd
++ @echo "================================================="
++ @echo " "
++ @echo "apcupsd script installation for RedHat $(DISTVER) complete."
++ @echo " "
++ @echo "You should now edit /etc/apcupsd/apcupsd.conf to correspond"
++ @echo "to your setup then start the apcupsd daemon with:"
++ @echo " "
++ @echo "/etc/rc.d/init.d/apcupsd start"
++ @echo " "
++ @echo "thereafter when you reboot, it will be stopped and started"
++ @echo "automatically."
++ @echo " "
++ @echo "Please check that your halt script in:"
++ @echo " /etc/rc.d/init.d/halt"
++ @echo "was properly updated (see installation section of manual)"
++ @echo " "
++ @echo "================================================="
++
++uninstall:
++ @echo "Removing symlinks..."
++ @/sbin/chkconfig --del apcupsd
++ @echo "Removing boot script..."
++ @rm -f /etc/rc.d/init.d/apcupsd
++ @echo "Restoring old halt script"
++ @cp -f /etc/rc.d/init.d/halt.old /etc/rc.d/init.d/halt
++
++clean:
++
++distclean:
++ @rm -f apccontrol.sh apcupsd awkhaltprog Makefile
+diff -urN apcupsd-3.8.1/distributions/pld/apccontrol.sh.in apcupsd-3.8.1.grzegorz/distributions/pld/apccontrol.sh.in
+--- apcupsd-3.8.1/distributions/pld/apccontrol.sh.in Thu Jan 1 01:00:00 1970
++++ apcupsd-3.8.1.grzegorz/distributions/pld/apccontrol.sh.in Sun Jun 10 15:59:29 2001
+@@ -0,0 +1,119 @@
++#!@SCRIPTSHELL@
++#
++# Copyright (C) 1999-2000 Riccardo Facchetti <riccardo@master.oasi.gpa.it>
++#
++# @configure_input@
++#
++
++#
++# These variables are needed for set up the autoconf other variables.
++#
++prefix=@prefix@
++exec_prefix=@exec_prefix@
++
++APCPID=@PIDDIR@/apcupsd.pid
++APCUPSD=@sbindir@/apcupsd
++SHUTDOWN=/sbin/shutdown
++SCRIPTSHELL=@SCRIPTSHELL@
++SCRIPTDIR=@sysconfdir@
++
++#
++# This piece is to substitute the default behaviour with your own script,
++# perl, or C program.
++# You can customize every single command creating an executable file (may be a
++# script or a compiled program) and calling it the same as the $1 parameter
++# passed by apcupsd to this script.
++#
++# After executing your script, apccontrol continues with the default action.
++# If you do not want apccontrol to continue, exit your script with exit
++# code 99. E.g. "exit 99".
++#
++# WARNING: the apccontrol file will be overwritten every time you update your
++# apcupsd, doing `make install'. Your own customized scripts will _not_ be
++# overwritten. If you wish to make changes to this file (discouraged), you
++# should change apccontrol.sh.in and then rerun the configure process.
++#
++if [ -f ${SCRIPTDIR}/${1} -a -x ${SCRIPTDIR}/${1} ]
++then
++ ${SCRIPTSHELL} ${SCRIPTDIR}/${1}
++ # exit code 99 means he does not want us to do default action
++ if [ $? = 99 ] ; then
++ exit 0
++ fi
++fi
++
++case "$1" in
++ killpower)
++ echo "Apccontrol doing: ${APCUPSD} --killpower"
++ ${APCUPSD} --killpower
++ ;;
++ commfailure)
++ wall "Warning serial port communications with UPS lost."
++ ;;
++ commok)
++ wall "Serial communciations with UPS restored."
++ ;;
++ powerout)
++ wall "Warning power loss detected."
++ ;;
++ onbattery)
++ wall "Power failure. Running on UPS batteries."
++ ;;
++ failing)
++ wall "UPS battery power exhaused. Doing shutdown."
++ ;;
++ timeout)
++ wall "UPS battery runtime limit exceded. Doing shutdown."
++ ;;
++ loadlimit)
++ wall "UPS battery discharge limit reached. Doing shutdown."
++ ;;
++ runlimit)
++ wall "UPS battery runtime percent reached. Doing shutdown."
++ ;;
++ doreboot)
++ wall "Beginning Reboot Sequence"
++ ${SHUTDOWN} -r now "apcupsd initiated reboot"
++ ;;
++ doshutdown)
++ wall "Beginning Shutdown Sequence"
++ ${SHUTDOWN} -h now "apcupsd initiated shutdown"
++ ;;
++ mainsback)
++ wall "Power has returned..."
++ if [ -f @sysconfdir@/powerfail ] ; then
++ wall "Attempting to cancel shutdown."
++ ${SHUTDOWN} -c
++ fi
++ ;;
++ annoyme)
++ wall "Power problems please logoff."
++ ;;
++ emergency)
++ wall "Emergency Shutdown. Possible UPS battery failure."
++ ${SHUTDOWN} -h now "apcupsd emergency shutdown"
++ ;;
++ changeme)
++ wall "Emergency! UPS batteries have failed. Change them NOW"
++ ;;
++ remotedown)
++ wall "Remote Shutdown. Beginning Shutdown Sequence."
++ ${SHUTDOWN} -h now "apcupsd remote shutdown"
++ ;;
++ restartme)
++ echo -n "Restarting APCUPSD Power Management: "
++ THEPID=`cat ${APCPID}`
++ kill ${THEPID}
++ rm -f ${APCPID}
++ rm -f @sysconfdir@/powerfail
++ rm -f /etc/nologin
++ sleep 5
++ `${APCUPSD}`
++ echo "apcupsd"
++ ;;
++ *) echo "Usage: ${0##*/} command"
++ echo " warning: this script is intended to be launched by"
++ echo " apcupsd and should never be launched by users."
++ exit 1
++ ;;
++esac
+diff -urN apcupsd-3.8.1/distributions/pld/apcupsd.in apcupsd-3.8.1.grzegorz/distributions/pld/apcupsd.in
+--- apcupsd-3.8.1/distributions/pld/apcupsd.in Thu Jan 1 01:00:00 1970
++++ apcupsd-3.8.1.grzegorz/distributions/pld/apcupsd.in Sun Jun 10 15:59:29 2001
+@@ -0,0 +1,48 @@
++#! /bin/sh
++#
++# apcupsd This shell script takes care of starting and stopping
++# the apcupsd UPS monitoring daemon.
++#
++# chkconfig: 2345 20 99
++# description: apcupsd monitors power and takes action if necessary
++#
++APCPID=@PIDDIR@/apcupsd.pid
++
++# Source function libarary
++. /etc/rc.d/init.d/functions
++
++case "$1" in
++ start)
++ if [ ! -f /var/lock/subsys/apcupsd ]; then
++ msg_starting apcupsd
++ daemon @sbindir@/apcupsd -f @sysconfdir@/apcupsd.conf
++ RETVAL=$?
++ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/apcupsd
++ else
++ msg_Already_Running apcupsd
++ exit 1
++ fi
++ ;;
++ stop)
++ if [ -f /var/lock/subsys/apcupsd ]; then
++ msg_stopping apcupsd
++ killproc apcupsd
++ rm -f /var/lock/subsys/apcupsd $APCPID
++ else
++ msg_Not_Running apcupsd
++ exit 1
++ fi
++ ;;
++ restart)
++ $0 stop
++ $0 start
++ ;;
++ status)
++ @sbindir@/apcaccess status
++ ;;
++ *)
++ echo "Usage: $0 {start|stop|restart|status}"
++ exit 1
++ ;;
++esac
++exit 0
+diff -urN apcupsd-3.8.1/distributions/pld/awkhaltprog.in apcupsd-3.8.1.grzegorz/distributions/pld/awkhaltprog.in
+--- apcupsd-3.8.1/distributions/pld/awkhaltprog.in Thu Jan 1 01:00:00 1970
++++ apcupsd-3.8.1.grzegorz/distributions/pld/awkhaltprog.in Sun Jun 10 15:59:29 2001
+@@ -0,0 +1,30 @@
++#
++# Awk program to insert the necessary apcupsd script in
++# to a halt script.
++#
++# Suff left over from a previous apcupsd, remove it
++/^# See if this is a powerfail situation\./ {
++ do {
++ getline
++ } while (length($0) != 0)
++ getline
++}
++# We insert our code just before this line
++/^# Now halt or reboot\./ {
++ print "# See if this is a powerfail situation. # ***apcupsd***"
++ print "if [ -f @sysconfdir@/powerfail ]; then # ***apcupsd***"
++ print " echo # ***apcupsd***"
++ print " echo \"APCUPSD will now power off the UPS\" # ***apcupsd***"
++ print " echo # ***apcupsd***"
++ print " @sysconfdir@/apccontrol killpower # ***apcupsd***"
++ print " echo # ***apcupsd***"
++ print " echo \"Please ensure that the UPS has powered off before rebooting\" # ***apcupsd***"
++ print " echo \"Otherwise, the UPS may cut the power during the reboot!!!\" # ***apcupsd***"
++ print " echo # ***apcupsd***"
++ print " sleep 2d # ***apcupsd***"
++ print " exit 0 # ***apcupsd***"
++ print "fi # ***apcupsd***"
++ print ""
++}
++# everything else is duplicated
++{ print }