]>
Commit | Line | Data |
---|---|---|
f49be709 GS |
1 | diff -urN apcupsd-3.8.1/Makefile.in apcupsd-3.8.1.grzegorz/Makefile.in |
2 | --- apcupsd-3.8.1/Makefile.in Mon Dec 4 08:04:56 2000 | |
3 | +++ apcupsd-3.8.1.grzegorz/Makefile.in Sun Jun 10 15:59:29 2001 | |
4 | @@ -30,7 +30,7 @@ | |
5 | # this is a list of all subdirectories that contain or could contain Makefiles | |
6 | # | |
7 | subdirs = . @INTLSUB@ @POSUB@ cgi doc lib contrib distributions distributions/debian \ | |
8 | - distributions/freebsd distributions/hpux distributions/openbsd distributions/redhat \ | |
9 | + distributions/freebsd distributions/hpux distributions/openbsd distributions/pld distributions/redhat \ | |
10 | distributions/slackware distributions/sun distributions/suse \ | |
11 | distributions/unifix win32 | |
12 | ||
13 | @@ -359,6 +359,7 @@ | |
14 | ||
15 | all = $(docs) $(config) $(srcs) $(parser) $(headers) $(extra) $(scripts) \ | |
16 | $(srcdir)/distributions/redhat/* $(srcdir)/distributions/debian/* \ | |
17 | + $(srcdir)/distributions/pld/* \ | |
18 | $(srcdir)/distributions/slackware/* $(srcdir)/distributions/suse/* \ | |
19 | $(srcdir)/distributions/unifix/* $(srcdir)/distributions/unknown/* \ | |
20 | $(srcdir)/intl/* $(srcdir)/po/* $(srcdir)/etc/* | |
21 | diff -urN apcupsd-3.8.1/configure apcupsd-3.8.1.grzegorz/configure | |
22 | --- apcupsd-3.8.1/configure Mon Dec 11 22:52:51 2000 | |
23 | +++ apcupsd-3.8.1.grzegorz/configure Sun Jun 10 16:02:23 2001 | |
24 | @@ -6431,6 +6431,9 @@ | |
25 | distributions/redhat/apccontrol.sh \ | |
26 | distributions/redhat/awkhaltprog \ | |
27 | distributions/redhat/apcupsd.spec \ | |
28 | + distributions/pld/Makefile \ | |
29 | + distributions/pld/apcupsd \ | |
30 | + distributions/pld/apccontrol.sh \ | |
31 | distributions/unknown/Makefile \ | |
32 | distributions/unknown/apcupsd \ | |
33 | distributions/unknown/apccontrol.sh \ | |
34 | diff -urN apcupsd-3.8.1/distributions/Makefile.in apcupsd-3.8.1.grzegorz/distributions/Makefile.in | |
35 | --- apcupsd-3.8.1/distributions/Makefile.in Fri Sep 22 17:02:21 2000 | |
36 | +++ apcupsd-3.8.1.grzegorz/distributions/Makefile.in Sun Jun 10 15:59:29 2001 | |
37 | @@ -10,7 +10,7 @@ | |
38 | # Generic install program. | |
39 | INSTALL = @INSTALL@ | |
40 | ||
41 | -SUBDIRS = freebsd redhat sun unknown hpux suse openbsd \ | |
42 | +SUBDIRS = freebsd redhat sun unknown hpux suse openbsd pld \ | |
43 | slackware alpha | |
44 | ||
45 | # Some makes apparently use .PHONY as the default goal if it is before `all'. | |
46 | diff -urN apcupsd-3.8.1/distributions/pld/Makefile.in apcupsd-3.8.1.grzegorz/distributions/pld/Makefile.in | |
47 | --- apcupsd-3.8.1/distributions/pld/Makefile.in Thu Jan 1 01:00:00 1970 | |
48 | +++ apcupsd-3.8.1.grzegorz/distributions/pld/Makefile.in Sun Jun 10 15:59:29 2001 | |
49 | @@ -0,0 +1,65 @@ | |
50 | +# | |
51 | +# This file is used as the template to create the | |
52 | +# Makefile for the RedHat 5.2, 6.0 and 6.1 specific | |
53 | +# installation. | |
54 | +# | |
55 | +# 25 Sep 1999 -- KES | |
56 | +# | |
57 | + | |
58 | + | |
59 | +INSTALL = @INSTALL@ | |
60 | +INSTALL_PROGRAM = @INSTALL_PROGRAM@ | |
61 | + | |
62 | +all: install | |
63 | + | |
64 | +install: | |
65 | + @if test -f /etc/rc.d/init.d/apcupsd; then \ | |
66 | + /sbin/chkconfig --del apcupsd; \ | |
67 | + fi | |
68 | + # remove old 3.6.2 stuff | |
69 | + @rm -f /etc/rc.d/rc0.d/K20apcups | |
70 | + @rm -f /etc/rc.d/rc1.d/S20apcups | |
71 | + @rm -f /etc/rc.d/rc1.d/K20apcups | |
72 | + @rm -f /etc/rc.d/rc2.d/S20apcups | |
73 | + @rm -f /etc/rc.d/rc3.d/S20apcups | |
74 | + @rm -f /etc/rc.d/rc5.d/S20apcups | |
75 | + @rm -f /etc/rc.d/rc6.d/K20apcups | |
76 | + @rm -f /etc/rc.d/init.d/apcups | |
77 | + @$(INSTALL_PROGRAM) -m 744 apcupsd /etc/rc.d/init.d/apcupsd | |
78 | + # save old halt script | |
79 | + @cp -f /etc/rc.d/init.d/halt /etc/rc.d/init.d/halt.old | |
80 | + # insert apcupsd script into halt | |
81 | + @awk -f awkhaltprog /etc/rc.d/init.d/halt.old >/etc/rc.d/init.d/halt | |
82 | + @chmod 744 /etc/rc.d/init.d/halt | |
83 | + # link new halt script for startup and shutdown | |
84 | + @/sbin/chkconfig --add apcupsd | |
85 | + @echo "=================================================" | |
86 | + @echo " " | |
87 | + @echo "apcupsd script installation for RedHat $(DISTVER) complete." | |
88 | + @echo " " | |
89 | + @echo "You should now edit /etc/apcupsd/apcupsd.conf to correspond" | |
90 | + @echo "to your setup then start the apcupsd daemon with:" | |
91 | + @echo " " | |
92 | + @echo "/etc/rc.d/init.d/apcupsd start" | |
93 | + @echo " " | |
94 | + @echo "thereafter when you reboot, it will be stopped and started" | |
95 | + @echo "automatically." | |
96 | + @echo " " | |
97 | + @echo "Please check that your halt script in:" | |
98 | + @echo " /etc/rc.d/init.d/halt" | |
99 | + @echo "was properly updated (see installation section of manual)" | |
100 | + @echo " " | |
101 | + @echo "=================================================" | |
102 | + | |
103 | +uninstall: | |
104 | + @echo "Removing symlinks..." | |
105 | + @/sbin/chkconfig --del apcupsd | |
106 | + @echo "Removing boot script..." | |
107 | + @rm -f /etc/rc.d/init.d/apcupsd | |
108 | + @echo "Restoring old halt script" | |
109 | + @cp -f /etc/rc.d/init.d/halt.old /etc/rc.d/init.d/halt | |
110 | + | |
111 | +clean: | |
112 | + | |
113 | +distclean: | |
114 | + @rm -f apccontrol.sh apcupsd awkhaltprog Makefile | |
115 | diff -urN apcupsd-3.8.1/distributions/pld/apccontrol.sh.in apcupsd-3.8.1.grzegorz/distributions/pld/apccontrol.sh.in | |
116 | --- apcupsd-3.8.1/distributions/pld/apccontrol.sh.in Thu Jan 1 01:00:00 1970 | |
117 | +++ apcupsd-3.8.1.grzegorz/distributions/pld/apccontrol.sh.in Sun Jun 10 15:59:29 2001 | |
118 | @@ -0,0 +1,119 @@ | |
119 | +#!@SCRIPTSHELL@ | |
120 | +# | |
121 | +# Copyright (C) 1999-2000 Riccardo Facchetti <riccardo@master.oasi.gpa.it> | |
122 | +# | |
123 | +# @configure_input@ | |
124 | +# | |
125 | + | |
126 | +# | |
127 | +# These variables are needed for set up the autoconf other variables. | |
128 | +# | |
129 | +prefix=@prefix@ | |
130 | +exec_prefix=@exec_prefix@ | |
131 | + | |
132 | +APCPID=@PIDDIR@/apcupsd.pid | |
133 | +APCUPSD=@sbindir@/apcupsd | |
134 | +SHUTDOWN=/sbin/shutdown | |
135 | +SCRIPTSHELL=@SCRIPTSHELL@ | |
136 | +SCRIPTDIR=@sysconfdir@ | |
137 | + | |
138 | +# | |
139 | +# This piece is to substitute the default behaviour with your own script, | |
140 | +# perl, or C program. | |
141 | +# You can customize every single command creating an executable file (may be a | |
142 | +# script or a compiled program) and calling it the same as the $1 parameter | |
143 | +# passed by apcupsd to this script. | |
144 | +# | |
145 | +# After executing your script, apccontrol continues with the default action. | |
146 | +# If you do not want apccontrol to continue, exit your script with exit | |
147 | +# code 99. E.g. "exit 99". | |
148 | +# | |
149 | +# WARNING: the apccontrol file will be overwritten every time you update your | |
150 | +# apcupsd, doing `make install'. Your own customized scripts will _not_ be | |
151 | +# overwritten. If you wish to make changes to this file (discouraged), you | |
152 | +# should change apccontrol.sh.in and then rerun the configure process. | |
153 | +# | |
154 | +if [ -f ${SCRIPTDIR}/${1} -a -x ${SCRIPTDIR}/${1} ] | |
155 | +then | |
156 | + ${SCRIPTSHELL} ${SCRIPTDIR}/${1} | |
157 | + # exit code 99 means he does not want us to do default action | |
158 | + if [ $? = 99 ] ; then | |
159 | + exit 0 | |
160 | + fi | |
161 | +fi | |
162 | + | |
163 | +case "$1" in | |
164 | + killpower) | |
165 | + echo "Apccontrol doing: ${APCUPSD} --killpower" | |
166 | + ${APCUPSD} --killpower | |
167 | + ;; | |
168 | + commfailure) | |
169 | + wall "Warning serial port communications with UPS lost." | |
170 | + ;; | |
171 | + commok) | |
172 | + wall "Serial communciations with UPS restored." | |
173 | + ;; | |
174 | + powerout) | |
175 | + wall "Warning power loss detected." | |
176 | + ;; | |
177 | + onbattery) | |
178 | + wall "Power failure. Running on UPS batteries." | |
179 | + ;; | |
180 | + failing) | |
181 | + wall "UPS battery power exhaused. Doing shutdown." | |
182 | + ;; | |
183 | + timeout) | |
184 | + wall "UPS battery runtime limit exceded. Doing shutdown." | |
185 | + ;; | |
186 | + loadlimit) | |
187 | + wall "UPS battery discharge limit reached. Doing shutdown." | |
188 | + ;; | |
189 | + runlimit) | |
190 | + wall "UPS battery runtime percent reached. Doing shutdown." | |
191 | + ;; | |
192 | + doreboot) | |
193 | + wall "Beginning Reboot Sequence" | |
194 | + ${SHUTDOWN} -r now "apcupsd initiated reboot" | |
195 | + ;; | |
196 | + doshutdown) | |
197 | + wall "Beginning Shutdown Sequence" | |
198 | + ${SHUTDOWN} -h now "apcupsd initiated shutdown" | |
199 | + ;; | |
200 | + mainsback) | |
201 | + wall "Power has returned..." | |
202 | + if [ -f @sysconfdir@/powerfail ] ; then | |
203 | + wall "Attempting to cancel shutdown." | |
204 | + ${SHUTDOWN} -c | |
205 | + fi | |
206 | + ;; | |
207 | + annoyme) | |
208 | + wall "Power problems please logoff." | |
209 | + ;; | |
210 | + emergency) | |
211 | + wall "Emergency Shutdown. Possible UPS battery failure." | |
212 | + ${SHUTDOWN} -h now "apcupsd emergency shutdown" | |
213 | + ;; | |
214 | + changeme) | |
215 | + wall "Emergency! UPS batteries have failed. Change them NOW" | |
216 | + ;; | |
217 | + remotedown) | |
218 | + wall "Remote Shutdown. Beginning Shutdown Sequence." | |
219 | + ${SHUTDOWN} -h now "apcupsd remote shutdown" | |
220 | + ;; | |
221 | + restartme) | |
222 | + echo -n "Restarting APCUPSD Power Management: " | |
223 | + THEPID=`cat ${APCPID}` | |
224 | + kill ${THEPID} | |
225 | + rm -f ${APCPID} | |
226 | + rm -f @sysconfdir@/powerfail | |
227 | + rm -f /etc/nologin | |
228 | + sleep 5 | |
229 | + `${APCUPSD}` | |
230 | + echo "apcupsd" | |
231 | + ;; | |
232 | + *) echo "Usage: ${0##*/} command" | |
233 | + echo " warning: this script is intended to be launched by" | |
234 | + echo " apcupsd and should never be launched by users." | |
235 | + exit 1 | |
236 | + ;; | |
237 | +esac | |
238 | diff -urN apcupsd-3.8.1/distributions/pld/apcupsd.in apcupsd-3.8.1.grzegorz/distributions/pld/apcupsd.in | |
239 | --- apcupsd-3.8.1/distributions/pld/apcupsd.in Thu Jan 1 01:00:00 1970 | |
240 | +++ apcupsd-3.8.1.grzegorz/distributions/pld/apcupsd.in Sun Jun 10 15:59:29 2001 | |
241 | @@ -0,0 +1,48 @@ | |
242 | +#! /bin/sh | |
243 | +# | |
244 | +# apcupsd This shell script takes care of starting and stopping | |
245 | +# the apcupsd UPS monitoring daemon. | |
246 | +# | |
247 | +# chkconfig: 2345 20 99 | |
248 | +# description: apcupsd monitors power and takes action if necessary | |
249 | +# | |
250 | +APCPID=@PIDDIR@/apcupsd.pid | |
251 | + | |
252 | +# Source function libarary | |
253 | +. /etc/rc.d/init.d/functions | |
254 | + | |
255 | +case "$1" in | |
256 | + start) | |
257 | + if [ ! -f /var/lock/subsys/apcupsd ]; then | |
258 | + msg_starting apcupsd | |
259 | + daemon @sbindir@/apcupsd -f @sysconfdir@/apcupsd.conf | |
260 | + RETVAL=$? | |
261 | + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/apcupsd | |
262 | + else | |
263 | + msg_Already_Running apcupsd | |
264 | + exit 1 | |
265 | + fi | |
266 | + ;; | |
267 | + stop) | |
268 | + if [ -f /var/lock/subsys/apcupsd ]; then | |
269 | + msg_stopping apcupsd | |
270 | + killproc apcupsd | |
271 | + rm -f /var/lock/subsys/apcupsd $APCPID | |
272 | + else | |
273 | + msg_Not_Running apcupsd | |
274 | + exit 1 | |
275 | + fi | |
276 | + ;; | |
277 | + restart) | |
278 | + $0 stop | |
279 | + $0 start | |
280 | + ;; | |
281 | + status) | |
282 | + @sbindir@/apcaccess status | |
283 | + ;; | |
284 | + *) | |
285 | + echo "Usage: $0 {start|stop|restart|status}" | |
286 | + exit 1 | |
287 | + ;; | |
288 | +esac | |
289 | +exit 0 | |
290 | diff -urN apcupsd-3.8.1/distributions/pld/awkhaltprog.in apcupsd-3.8.1.grzegorz/distributions/pld/awkhaltprog.in | |
291 | --- apcupsd-3.8.1/distributions/pld/awkhaltprog.in Thu Jan 1 01:00:00 1970 | |
292 | +++ apcupsd-3.8.1.grzegorz/distributions/pld/awkhaltprog.in Sun Jun 10 15:59:29 2001 | |
293 | @@ -0,0 +1,30 @@ | |
294 | +# | |
295 | +# Awk program to insert the necessary apcupsd script in | |
296 | +# to a halt script. | |
297 | +# | |
298 | +# Suff left over from a previous apcupsd, remove it | |
299 | +/^# See if this is a powerfail situation\./ { | |
300 | + do { | |
301 | + getline | |
302 | + } while (length($0) != 0) | |
303 | + getline | |
304 | +} | |
305 | +# We insert our code just before this line | |
306 | +/^# Now halt or reboot\./ { | |
307 | + print "# See if this is a powerfail situation. # ***apcupsd***" | |
308 | + print "if [ -f @sysconfdir@/powerfail ]; then # ***apcupsd***" | |
309 | + print " echo # ***apcupsd***" | |
310 | + print " echo \"APCUPSD will now power off the UPS\" # ***apcupsd***" | |
311 | + print " echo # ***apcupsd***" | |
312 | + print " @sysconfdir@/apccontrol killpower # ***apcupsd***" | |
313 | + print " echo # ***apcupsd***" | |
314 | + print " echo \"Please ensure that the UPS has powered off before rebooting\" # ***apcupsd***" | |
315 | + print " echo \"Otherwise, the UPS may cut the power during the reboot!!!\" # ***apcupsd***" | |
316 | + print " echo # ***apcupsd***" | |
317 | + print " sleep 2d # ***apcupsd***" | |
318 | + print " exit 0 # ***apcupsd***" | |
319 | + print "fi # ***apcupsd***" | |
320 | + print "" | |
321 | +} | |
322 | +# everything else is duplicated | |
323 | +{ print } |