| 1 | #!/bin/sh /usr/share/dpatch/dpatch-run |
|---|
| 2 | ## 09-initscript.dpatch by Michael Meskes <meskes@debian.org> |
|---|
| 3 | ## |
|---|
| 4 | ## DP: Some changes to initscript. |
|---|
| 5 | |
|---|
| 6 | @DPATCH@ |
|---|
| 7 | |
|---|
| 8 | diff -Naurp virtualbox-ose-2.0.4-dfsg.orig/src/VBox/Installer/linux/vboxnet.sh.in virtualbox-ose-2.0.4-dfsg/src/VBox/Installer/linux/vboxnet.sh.in |
|---|
| 9 | --- virtualbox-ose-2.0.4-dfsg.orig/src/VBox/Installer/linux/vboxnet.sh.in 2008-11-21 12:44:47.000000000 +0000 |
|---|
| 10 | +++ virtualbox-ose-2.0.4-dfsg/src/VBox/Installer/linux/vboxnet.sh.in 2008-11-21 12:45:40.000000000 +0000 |
|---|
| 11 | @@ -34,7 +34,12 @@ |
|---|
| 12 | TAPDEV="/dev/net/tun" |
|---|
| 13 | NOLSB=%NOLSB% |
|---|
| 14 | |
|---|
| 15 | -[ -f /lib/lsb/init-functions ] || NOLSB=yes |
|---|
| 16 | +# Include virtualbox-ose defaults if available |
|---|
| 17 | +if [ -f /etc/default/virtualbox-ose ] ; then |
|---|
| 18 | + . /etc/default/virtualbox-ose |
|---|
| 19 | +fi |
|---|
| 20 | + |
|---|
| 21 | +[ -f /lib/lsb/init-functions ] && NOLSB= |
|---|
| 22 | |
|---|
| 23 | if [ -n "$NOLSB" ]; then |
|---|
| 24 | if [ -f /etc/redhat-release ]; then |
|---|
| 25 | @@ -168,13 +173,6 @@ |
|---|
| 26 | if ! VBoxTunctl -h 2>&1 | grep VBoxTunctl > /dev/null; then |
|---|
| 27 | failure "VBoxTunctl not found" |
|---|
| 28 | fi |
|---|
| 29 | - # Fail if we don't have the kernel tun device |
|---|
| 30 | - # Make sure that the tun module is loaded (Ubuntu 7.10 needs this) |
|---|
| 31 | - modprobe tun > /dev/null 2>&1 |
|---|
| 32 | - if ! cat /proc/misc 2>/dev/null | grep tun > /dev/null; then |
|---|
| 33 | - failure "Linux tun/tap subsystem not available" |
|---|
| 34 | - fi |
|---|
| 35 | - succ_msg |
|---|
| 36 | # Read the configuration file entries line by line and create the |
|---|
| 37 | # interfaces |
|---|
| 38 | while read line; do |
|---|
| 39 | @@ -185,6 +183,19 @@ |
|---|
| 40 | # or two non-comment entries, possibly followed by a comment). |
|---|
| 41 | if ((! expr match "$2" "#" > /dev/null) && |
|---|
| 42 | (test -z "$4" || expr match "$4" "#" > /dev/null)); then |
|---|
| 43 | + if [ "$module_available" != 1 ] |
|---|
| 44 | + then |
|---|
| 45 | + # Fail if we don't have the kernel tun device |
|---|
| 46 | + # Make sure that the tun module is loaded (Ubuntu 7.10 needs this) |
|---|
| 47 | + # We only test this once, but we have to do it here, because otherwise an empty |
|---|
| 48 | + # configuration file would trigger the modprobe too. |
|---|
| 49 | + modprobe tun > /dev/null 2>&1 |
|---|
| 50 | + if ! cat /proc/misc 2>/dev/null | grep tun > /dev/null |
|---|
| 51 | + then |
|---|
| 52 | + failure "Linux tun/tap subsystem not available" |
|---|
| 53 | + fi |
|---|
| 54 | + module_available=1 |
|---|
| 55 | + fi |
|---|
| 56 | # Name our parameters, to make this script slightly less unreadable |
|---|
| 57 | interface=$1 |
|---|
| 58 | user=$2 |
|---|
| 59 | @@ -238,6 +249,7 @@ |
|---|
| 60 | fi |
|---|
| 61 | fi |
|---|
| 62 | done < "$CONFIG" |
|---|
| 63 | + succ_msg |
|---|
| 64 | return 0 |
|---|
| 65 | } |
|---|
| 66 | |
|---|
| 67 | @@ -331,10 +343,17 @@ |
|---|
| 68 | |
|---|
| 69 | case "$1" in |
|---|
| 70 | start) |
|---|
| 71 | + # try to insert module but do not fail if not possible |
|---|
| 72 | + if [ "$LOAD_VBOXDRV_MODULE" = 1 ]; then |
|---|
| 73 | + /sbin/modprobe -q vboxdrv || true |
|---|
| 74 | + fi |
|---|
| 75 | start_network |
|---|
| 76 | ;; |
|---|
| 77 | stop) |
|---|
| 78 | stop_network |
|---|
| 79 | + if [ "$LOAD_VBOXDRV_MODULE" = 1 ]; then |
|---|
| 80 | + /sbin/modprobe -qr vboxdrv || true |
|---|
| 81 | + fi |
|---|
| 82 | ;; |
|---|
| 83 | restart|reload) |
|---|
| 84 | stop_network && start_network |
|---|