summaryrefslogtreecommitdiff
blob: 2d4c48e491c0f157885ec6c86fcdba6db3fc0220 (plain)
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
Abort generate-modprobe.conf if modprobe fails, bug #68689.

--- module-init-tools-3.2-pre7/generate-modprobe.conf	2005-07-15 11:21:54.000000000 +0200
+++ module-init-tools-3.2-pre7.az/generate-modprobe.conf	2005-07-15 11:24:33.000000000 +0200
@@ -35,22 +35,28 @@
 MODPROBECONF=`mktemp /tmp/modprobe.XXXXXX || tempfile || echo /tmp/modprobe.$$`
 trap "rm -f $MODPROBECONF" 0
 
+modprobe_abort()
+{
+    echo Failed to to run modprobe.  Giving up. 2>&1
+    exit 1
+}
+
 if [ x"$TESTING_MODPROBE_CONF" != x ]; then
     cp $TESTING_MODPROBE_CONF $MODPROBECONF
 elif [ "$STDIN" = "1" ]; then
     cat > $MODPROBECONF
 elif [ -x /sbin/modprobe.old ]; then
     # In sbin.
-    /sbin/modprobe.old -c > $MODPROBECONF
+    /sbin/modprobe.old -c > $MODPROBECONF || modprobe_abort
 elif modprobe.old -c >/dev/null 2>&1; then
     # Somewhere in path.
-    modprobe.old -c > $MODPROBECONF
+    modprobe.old -c > $MODPROBECONF || modprobe_abort
 elif /sbin/modprobe -V 2>/dev/null | grep -q 'modprobe version'; then
     # Running /sbin/modprobe gives old version.
-    /sbin/modprobe -c > $MODPROBECONF
+    /sbin/modprobe -c > $MODPROBECONF || modprobe_abort
 elif modprobe -V 2>/dev/null | grep -q 'modprobe version'; then
     # Running modprobe gives old version.
-    modprobe -c > $MODPROBECONF
+    modprobe -c > $MODPROBECONF || modprobe_abort
 else
     echo Cannot find old version of modprobe.  Giving up. 2>&1
     exit 1