1 | #!/bin/sh
|
---|
2 |
|
---|
3 | LOG="/var/log/vbox-install.log"
|
---|
4 |
|
---|
5 | # for debconf
|
---|
6 | . /usr/share/debconf/confmodule
|
---|
7 | db_version 2.0
|
---|
8 |
|
---|
9 | # remove old cruft
|
---|
10 | if [ -f /etc/init.d/vboxdrv.sh ]; then
|
---|
11 | echo "Found old version of /etc/init.d/vboxdrv.sh, removing."
|
---|
12 | rm /etc/init.d/vboxdrv.sh
|
---|
13 | update-rc.d vboxdrv.sh remove >/dev/null
|
---|
14 | fi
|
---|
15 | if [ -f /etc/init.d/virtualbox ]; then
|
---|
16 | echo "Found old version of /etc/init.d/virtualbox, removing."
|
---|
17 | rm /etc/init.d/virtualbox
|
---|
18 | update-rc.d virtualbox remove >/dev/null
|
---|
19 | fi
|
---|
20 |
|
---|
21 | # install udev rule
|
---|
22 | if [ -d /etc/udev/rules.d ]; then
|
---|
23 | udev_out=`udevinfo -V 2> /dev/null`
|
---|
24 | udev_ver=`expr "$udev_out" : '[^0-9]*\([0-9]*\)'`
|
---|
25 | if [ "$udev_ver" = "" -o "$udev_ver" -lt 55 ]; then
|
---|
26 | echo 'KERNEL="vboxdrv", NAME="vboxdrv", OWNER="root", GROUP="vboxusers", MODE="0660"' \
|
---|
27 | > /etc/udev/rules.d/60-vboxdrv.rules
|
---|
28 | else
|
---|
29 | echo 'KERNEL=="vboxdrv", NAME="vboxdrv", OWNER="root", GROUP="vboxusers", MODE="0660"' \
|
---|
30 | > /etc/udev/rules.d/60-vboxdrv.rules
|
---|
31 | fi
|
---|
32 | fi
|
---|
33 |
|
---|
34 | # create users groups
|
---|
35 | db_input high virtualbox-ose/group-vboxusers || true
|
---|
36 | db_go || true
|
---|
37 | groupadd -f vboxusers
|
---|
38 |
|
---|
39 | if [ ! -f /lib/modules/`uname -r`/misc/vboxdrv.ko ]; then
|
---|
40 | db_get virtualbox-ose/module-compilation-allowed
|
---|
41 | if [ "$RET" = "false" ]; then
|
---|
42 | cat << EOF
|
---|
43 | Unable to find a precompiled module for the current kernel
|
---|
44 | though module compilation denied by debconf setting.
|
---|
45 | EOF
|
---|
46 | else
|
---|
47 | db_input critical virtualbox-ose/module-compilation-allowed || true
|
---|
48 | db_go || true
|
---|
49 | db_get virtualbox-ose/module-compilation-allowed
|
---|
50 | if [ "$RET" = "true" ]; then
|
---|
51 | # Compile module. Don't show a message box here if everything works well.
|
---|
52 | cat << EOF
|
---|
53 | Messages emitted during module compilation will be logged to $LOG.
|
---|
54 | EOF
|
---|
55 | if ! /usr/share/virtualbox-ose/src/build_in_tmp install > /var/log/vbox-install.log 2>&1; then
|
---|
56 | db_fset virtualbox-ose/module-compilation-failed seen false
|
---|
57 | db_input critical virtualbox-ose/module-compilation-failed || true
|
---|
58 | db_go || true
|
---|
59 | touch /etc/vbox/module_not_compiled
|
---|
60 | # don't abort the installation!
|
---|
61 | else
|
---|
62 | # success
|
---|
63 | cat << EOF
|
---|
64 | Success!
|
---|
65 | EOF
|
---|
66 | rm -f /etc/vbox/module_not_compiled
|
---|
67 | fi
|
---|
68 | fi
|
---|
69 | fi
|
---|
70 | fi
|
---|
71 |
|
---|
72 | # There might be an old module active (e.g. manually loaded)
|
---|
73 | if lsmod | grep -q "vboxdrv[^_-]"; then
|
---|
74 | /etc/init.d/vboxdrv stop || true
|
---|
75 | fi
|
---|
76 |
|
---|
77 | #DEBHELPER#
|
---|
78 |
|
---|
79 | exit 0
|
---|