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>&1 > /dev/null
|
---|
24 | if [ "$udev_out" = "" ]; then
|
---|
25 | udev_out=`udevinfo -V` 2>&1 > /dev/null # New syntax
|
---|
26 | fi
|
---|
27 | udev_ver=`expr "$udev_out" : '[^0-9]*\([0-9]*\)'`
|
---|
28 | if [ "$udev_ver" = "" -o "$udev_ver" -lt 55 ]; then
|
---|
29 | echo 'KERNEL="vboxdrv", NAME="vboxdrv", OWNER="root", GROUP="vboxusers", MODE="0660"' \
|
---|
30 | > /etc/udev/rules.d/60-vboxdrv.rules
|
---|
31 | else
|
---|
32 | echo 'KERNEL=="vboxdrv", NAME="vboxdrv", OWNER="root", GROUP="vboxusers", MODE="0660"' \
|
---|
33 | > /etc/udev/rules.d/60-vboxdrv.rules
|
---|
34 | fi
|
---|
35 | fi
|
---|
36 |
|
---|
37 | # create users groups
|
---|
38 | db_input high virtualbox-ose/group-vboxusers || true
|
---|
39 | db_go || true
|
---|
40 | groupadd -f vboxusers
|
---|
41 |
|
---|
42 | if [ ! -f /lib/modules/`uname -r`/misc/vboxdrv.ko ]; then
|
---|
43 | db_get virtualbox-ose/module-compilation-allowed
|
---|
44 | if [ "$RET" = "false" ]; then
|
---|
45 | cat << EOF
|
---|
46 | Unable to find a precompiled module for the current kernel
|
---|
47 | though module compilation denied by debconf setting.
|
---|
48 | EOF
|
---|
49 | else
|
---|
50 | db_input critical virtualbox-ose/module-compilation-allowed || true
|
---|
51 | db_go || true
|
---|
52 | db_get virtualbox-ose/module-compilation-allowed
|
---|
53 | if [ "$RET" = "true" ]; then
|
---|
54 | # Compile module. Don't show a message box here if everything works well.
|
---|
55 | cat << EOF
|
---|
56 | Messages emitted during module compilation will be logged to $LOG.
|
---|
57 | EOF
|
---|
58 | if ! /usr/share/virtualbox-ose/src/build_in_tmp install > /var/log/vbox-install.log 2>&1; then
|
---|
59 | db_fset virtualbox-ose/module-compilation-failed seen false
|
---|
60 | db_input critical virtualbox-ose/module-compilation-failed || true
|
---|
61 | db_go || true
|
---|
62 | touch /etc/vbox/module_not_compiled
|
---|
63 | # don't abort the installation!
|
---|
64 | else
|
---|
65 | # success
|
---|
66 | cat << EOF
|
---|
67 | Success!
|
---|
68 | EOF
|
---|
69 | rm -f /etc/vbox/module_not_compiled
|
---|
70 | fi
|
---|
71 | fi
|
---|
72 | fi
|
---|
73 | fi
|
---|
74 |
|
---|
75 | #DEBHELPER#
|
---|
76 |
|
---|
77 | exit 0
|
---|