summaryrefslogtreecommitdiff
path: root/debian/patches/09-initscript.dpatch
blob: 0359bf0db8598d26e79043f91fd19aeb475c46c9 (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
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#!/bin/sh /usr/share/dpatch/dpatch-run
## 09-initscript.dpatch by Michael Meskes <meskes@debian.org>
##
## DP: Several initscript changes.

@DPATCH@

diff -Naurp virtualbox-ose-3.0.0-dfsg.orig/src/VBox/Installer/linux/vboxdrv.sh.in virtualbox-ose-3.0.0-dfsg/src/VBox/Installer/linux/vboxdrv.sh.in
--- virtualbox-ose-3.0.0-dfsg.orig/src/VBox/Installer/linux/vboxdrv.sh.in	2009-07-01 10:37:25.000000000 +0200
+++ virtualbox-ose-3.0.0-dfsg/src/VBox/Installer/linux/vboxdrv.sh.in		2009-07-01 10:41:54.000000000 +0200
@@ -19,8 +19,8 @@
 #
 ### BEGIN INIT INFO
 # Provides:       vboxdrv
-# Required-Start: $syslog
-# Required-Stop:
+# Required-Start: $remote_fs $network
+# Required-Stop:  $remote_fs
 # Default-Start:  2 3 4 5
 # Default-Stop:   0 1 6
 # Short-Description: VirtualBox Linux kernel module
@@ -32,7 +32,9 @@
 LOG="/var/log/vbox-install.log"
 NOLSB=%NOLSB%
 
-[ -f /lib/lsb/init-functions ] || NOLSB=yes
+# Include virtualbox-ose defaults if available
+[ -f /etc/default/virtualbox-ose ] && . /etc/default/virtualbox-ose
+[ -f /lib/lsb/init-functions ] && NOLSB=
 [ -f /etc/vbox/vbox.cfg ] && . /etc/vbox/vbox.cfg
 
 if [ -n "$INSTALL_DIR" ]; then
@@ -66,11 +68,14 @@
         log_failure_msg "$1"
     }
     succ_msg() {
-        log_success_msg " done."
+	log_end_msg 0
     }
     begin_msg() {
         log_daemon_msg "$@"
     }
+    prog_msg() {
+	log_progress_msg "$1"
+    }
 else
     if [ "$system" = "redhat" ]; then
         . /etc/init.d/functions
@@ -148,15 +153,26 @@
 
 start()
 {
-    begin_msg "Starting VirtualBox kernel module"
+    begin_msg "Starting VirtualBox kernel modules"
     if ! running vboxdrv; then
+      if [ "$LOAD_VBOXDRV_MODULE" = 1 ]; then
         if ! rm -f $DEVICE; then
             failure "Cannot remove $DEVICE"
         fi
         if ! modprobe vboxdrv > /dev/null 2>&1; then
+	  if ! find /lib/modules/`uname -r` -name "vboxdrv\.*" 2>/dev/null|grep -q vboxdrv; then
+	    failure "No suitable module for running kernel found"
+	  else
             failure "modprobe vboxdrv failed. Please use 'dmesg' to find out why"
-        fi
-        sleep .2
+	  fi
+	else
+	  prog_msg vboxdrv
+        fi
+      else
+	succ_msg
+	return
+      fi
+      sleep .2
     fi
     # ensure the character special exists
     if [ ! -c $DEVICE ]; then
@@ -185,31 +201,51 @@
         rmmod vboxdrv 2>/dev/null
         failure "Cannot change owner $GROUPNAME for device $DEVICE"
     fi
-    if ! modprobe vboxnetflt > /dev/null 2>&1; then
-        failure "modprobe vboxnetflt failed. Please use 'dmesg' to find out why"
-    fi
-    if ! modprobe vboxnetadp > /dev/null 2>&1; then
-        failure "modprobe vboxnetadp failed. Please use 'dmesg' to find out why"
+    if [ "$LOAD_VBOXDRV_MODULE" = 1 ]; then
+      if ! modprobe vboxnetflt > /dev/null 2>&1; then
+	if ! find /lib/modules/`uname -r` -name "vboxnetflt\.*" 2>/dev/null|grep -q vboxnetflt; then
+	  failure "No suitable vboxnetflt module for running kernel found"
+	else
+          failure "modprobe vboxnetflt failed. Please use 'dmesg' to find out why"
+	fi
+      else
+	  prog_msg vboxnetflt
+      fi
+      if ! modprobe vboxnetadp > /dev/null 2>&1; then
+	if ! find /lib/modules/`uname -r` -name "vboxnetadp\.*" 2>/dev/null|grep -q vboxnetadp; then
+          failure "No suitable vboxnetadp module for running kernel found"
+        else
+          failure "modprobe vboxnetadp failed. Please use 'dmesg' to find out why"
+	fi
+      else
+	  prog_msg vboxnetadp
+      fi
     fi
     succ_msg
 }
 
 stop()
 {
-    begin_msg "Stopping VirtualBox kernel module"
+    begin_msg "Stopping VirtualBox kernel modules"
     if running vboxnetadp; then
         if ! rmmod vboxnetadp 2>/dev/null; then
             failure "Cannot unload module vboxnetadp"
+	else
+	    prog_msg vboxnetadp
         fi
     fi
     if running vboxdrv; then
         if running vboxnetflt; then
             if ! rmmod vboxnetflt 2>/dev/null; then
                 failure "Cannot unload module vboxnetflt"
+	    else
+		prog_msg vboxnetflt
             fi
         fi
         if ! rmmod vboxdrv 2>/dev/null; then
             failure "Cannot unload module vboxdrv"
+	else
+	    prog_msg vboxdrv
         fi
         if ! rm -f $DEVICE; then
             failure "Cannot unlink $DEVICE"
@@ -352,14 +384,11 @@
     stop
     start
     ;;
-setup)
-    setup
-    ;;
 status)
     dmnstatus
     ;;
 *)
-    echo "Usage: $0 {start|stop|stop_vms|restart|force-reload|status|setup}"
+    echo "Usage: $0 {start|stop|stop_vms|restart|force-reload|status}"
     exit 1
 esac