2 # Awk program to insert the necessary apcupsd script in
5 # Suff left over from a previous apcupsd, remove it
6 /^# See if this is a powerfail situation\./ {
9 } while (length($0) != 0)
12 # We insert our code just before this line
13 /^### Now halt or reboot\./ {
14 print "# See if this is a powerfail situation. # ***apcupsd***"
15 print "if [ -f @PWRFAILDIR@/powerfail ]; then # ***apcupsd***"
16 print " echo # ***apcupsd***"
17 print " echo \"APCUPSD will now power off the UPS\" # ***apcupsd***"
18 print " echo # ***apcupsd***"
19 print " @sysconfdir@/apccontrol killpower # ***apcupsd***"
20 print " echo # ***apcupsd***"
21 print " echo \"Please ensure that the UPS has powered off before rebooting\" # ***apcupsd***"
22 print " echo \"Otherwise, the UPS may cut the power during the reboot!!!\" # ***apcupsd***"
23 print " echo # ***apcupsd***"
24 print "fi # ***apcupsd***"
27 # everything else is duplicated