File: halt.patch

package info (click to toggle)
nut 2.8.1-5
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 18,284 kB
  • sloc: ansic: 108,785; sh: 9,370; cpp: 3,370; makefile: 2,842; python: 1,029; perl: 763; xml: 47
file content (40 lines) | stat: -rw-r--r-- 1,295 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
--- /etc/rc.d/init.d/halt	Thu Mar 28 00:21:19 2002
+++ halt.new	Fri Jan 31 15:29:49 2003
@@ -8,8 +8,17 @@
 #               Modified for RHS Linux by Damien Neil
 #
 
+# 2003-01-31 Antonino Albanese <al.an@monkeysweb.net>
+# Modified ups shutdown for new NUT method
+#
 # Set the path.
 PATH=/sbin:/bin:/usr/bin:/usr/sbin
+# load /etc/sysconfig/ups if present I've put the POWERDOWNFLAG
+# in there so noboby have to manually modify the shutdown script
+if [ -f /etc/sysconfig/ups ]; then
+   . /etc/sysconfig/ups
+fi
+UPSCMD=`which upsdrvctl`
 
 export NOLOCALE=1
 . /etc/init.d/functions
@@ -198,10 +208,15 @@
 fi
 
 if [ "$command" = halt ] ; then
-    if [ -r /etc/ups/upsmon.conf -a -f /etc/killpower -a -f /etc/sysconfig/ups ] ; then
-        . /etc/sysconfig/ups
-        [ "$SERVER" = "yes" -a "$MODEL" != "NONE" -a -n "$MODEL" -a -n "$DEVICE" ] && $MODEL -k $DEVICE
-    fi
+#    if [ -r /etc/ups/upsmon.conf -a -f /etc/killpower -a -f /etc/sysconfig/ups ] ; then
+#        . /etc/sysconfig/ups
+#        [ "$SERVER" = "yes" -a "$MODEL" != "NONE" -a -n "$MODEL" -a -n "$DEVICE" ] && $MODEL -k $DEVICE
+#    fi
+   if [ -n "$POWERDOWNFLAG" -a -n "$UPSCMD" ]; then
+      if [ -f $POWERDOWNFLAG ]; then
+         $UPSCMD shutdown
+      fi
+   fi
 fi
 
 if [ -x "/sbin/halt.local" ]; then