UPS: apcupsd clean sources
[tomato.git] / release / src / router / apcupsd / platforms / alpha / awkhaltprog.in
blob672957f99c8027fe748e252edee7e5dd0830396e
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) 
11 # We insert our code just before this line
12 /^# Init single-user state if shutdown/ {
13    print "# See if this is a powerfail situation.                               # ###apcupsd###"
14    print "if [ -f @PWRFAILDIR@/powerfail ]; then                                # ###apcupsd###"
15    print "   echo                                                               # ###apcupsd###"
16    print "   echo \"APCUPSD will now power off the UPS\"                          # ###apcupsd###"
17    print "   echo                                                               # ###apcupsd###"
18    print "   @sysconfdir@/apccontrol killpower                                  # ###apcupsd###"
19    print "   echo                                                               # ###apcupsd###"
20    print "   echo \"Please ensure that the UPS has powered off before rebooting\" # ###apcupsd###"
21    print "   echo \"Otherwise, the UPS may cut the power during the reboot!!!\"   # ###apcupsd###"
22    print "   echo                                                               # ###apcupsd###"
23    print "fi                                                                    # ###apcupsd###"
24    print ""
26 # everything else is duplicated
27 { print }