UPS: apcupsd clean sources
[tomato.git] / release / src / router / apcupsd / platforms / redhat / awkhaltprog.in
blob77364ff87da0edda5d4c810e8f30b72dcb56abd3
2 # Awk program to insert the necessary apcupsd script in
3 # to a halt script.
5 # Suff left over from a previous apcupsd, remove it
6 /^# See if this is a powerfail situation\./ {
7    do {
8       getline 
9    }  while (length($0) != 0) 
10    getline
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***"
25    print ""
27 # everything else is duplicated
28 { print }