File: 99-store-ifdown-auto.dpatch

package info (click to toggle)
hibernate 1.99-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 780 kB
  • ctags: 61
  • sloc: sh: 2,194; makefile: 58
file content (136 lines) | stat: -rw-r--r-- 3,519 bytes parent folder | download | duplicates (2)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#! /bin/sh /usr/share/dpatch/dpatch-run
## 99-store-ifdown-auto.dpatch by martin f. krafft <madduck@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.

@DPATCH@
diff -urNad upstream.trunk~/scriptlets.d/network upstream.trunk/scriptlets.d/network
--- upstream.trunk~/scriptlets.d/network	2007-07-09 17:34:28.000000000 +0200
+++ upstream.trunk/scriptlets.d/network	2007-07-09 17:46:09.000000000 +0200
@@ -30,9 +30,7 @@
 	    [ "$int" = "lo" ] && continue
 	fi
 	vecho 2 "Bringing down interface $int"
-	network_ifdown $int
-	[ $? -ne 0 ] && ret=1
-	NETWORK_DOWNEDIFS="$int $NETWORK_DOWNEDIFS"
+	NETWORK_DOWNEDIFS="$(network_ifdown $int) $NETWORK_DOWNEDIFS" || ret=$?
     done
     return $ret
 }
@@ -95,7 +93,9 @@
 	    	[ -x "/etc/init.d/net.$1" ] && /etc/init.d/net.$1 start
 	    }
 	    network_ifdown() {
-	    	[ -x "/etc/init.d/net.$1" ] && /etc/init.d/net.$1 stop
+	    	[ -x "/etc/init.d/net.$1" ] && /etc/init.d/net.$1 stop \
+		   || return $?
+		echo $1
 	    }
 	    ;;
 	suse)
@@ -103,7 +103,8 @@
 		/etc/init.d/network start
 	    }
 	    network_ifdown() {
-		/etc/init.d/network stop
+		/etc/init.d/network stop || return $?
+		echo all
 	    }
 	    NETWORK_CALL_ONCE=1
 	    ;;
@@ -113,15 +114,20 @@
 		    --startas /sbin/ifup --name "hibernate_ifup_$1" -- $*
 	    }
 	    network_ifdown() {
-		/sbin/ifdown $*
-	    }
+                STDERR="$(/sbin/ifdown $1 2>&1 1>/dev/null)" || return $?
+                case "$STDERR" in
+                    "/sbin/ifdown: interface $1 not configured") :;;
+                    *) echo $1;;
+                esac
+            }
 	    ;;
 	mandrake|fedora|redhat)
 	    network_ifup() {
 		/sbin/ifup $*
 	    }
 	    network_ifdown() {
-		/sbin/ifdown $*
+		/sbin/ifdown $* || return $?
+		echo $*
 	    }
 	    ;;
 	slackware)
@@ -129,7 +135,8 @@
 		/etc/rc.d/rc.inet1 start
 	    }
 	    network_ifdown() {
-		/etc/rc.d/rc.inet1 stop
+		/etc/rc.d/rc.inet1 stop || return $?
+		echo all
 	    }
 	    NETWORK_CALL_ONCE=1
 	    ;;
@@ -140,28 +147,35 @@
 		    /sbin/ifup $*
 		}
 		network_ifdown() {
-		    /sbin/ifdown $*
+		    STDERR="$(/sbin/ifdown $1 2>&1 1>/dev/null)" || return $?
+		    case "$STDERR" in
+			"/sbin/ifdown: interface $1 not configured") :;;
+			*) echo $1;;
+		    esac
 		}
 	    elif [ -x "/etc/init.d/ifup" ] ; then
 		network_ifup() {
 		    /etc/init.d/ifup $*
 		}
 		network_ifdown() {
-		    /etc/init.d/ifdown $*
+		    /etc/init.d/ifdown $* || return $?
+		    echo $*
 		}
 	    elif [ -x "/etc/sysconfig/network-scripts/ifup" ] ; then
 		network_ifup() {
 		    /etc/sysconfig/network-scripts/ifup $*
 		}
 		network_ifdown() {
-		    /etc/sysconfig/network-scripts/ifdown $*
+		    /etc/sysconfig/network-scripts/ifdown $* || return $?
+		    echo $*
 		}
 	    elif [ -x "/etc/init.d/networking" ] ; then
 		network_ifup() {
 		    /etc/init.d/networking start
 		}
 		network_ifdown() {
-		    /etc/init.d/networking stop
+		    /etc/init.d/networking stop || return $?
+		    echo all
 		}
 		NETWORK_CALL_ONCE=1
 	    elif [ -x "/etc/init.d/network" ] ; then
@@ -169,7 +183,8 @@
 		    /etc/init.d/network start
 		}
 		network_ifdown() {
-		    /etc/init.d/network stop
+		    /etc/init.d/network stop || return $?
+		    echo all
 		}
 		NETWORK_CALL_ONCE=1
 	    else
@@ -177,7 +192,8 @@
 		    /sbin/ifconfig $1 up
 		}
 		network_ifdown() {
-		    /sbin/ifconfig $1 down
+		    /sbin/ifconfig $1 down || return $?
+		    echo $1
 		}
 	    fi
     esac