| 1 |
#!/bin/sh |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
LOG="/var/log/vbox-install.log" |
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
. /usr/share/debconf/confmodule |
|---|
| 18 |
db_version 2.0 |
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
if [ -f /etc/init.d/vboxdrv.sh ]; then |
|---|
| 22 |
echo "Found old version of /etc/init.d/vboxdrv.sh, removing." |
|---|
| 23 |
rm /etc/init.d/vboxdrv.sh |
|---|
| 24 |
update-rc.d vboxdrv.sh remove >/dev/null |
|---|
| 25 |
fi |
|---|
| 26 |
if [ -f /etc/init.d/virtualbox ]; then |
|---|
| 27 |
echo "Found old version of /etc/init.d/virtualbox, removing." |
|---|
| 28 |
rm /etc/init.d/virtualbox |
|---|
| 29 |
update-rc.d virtualbox remove >/dev/null |
|---|
| 30 |
fi |
|---|
| 31 |
if [ -f /etc/vbox/vbox.cfg ]; then |
|---|
| 32 |
echo "Found old version of /etc/vbox/vbox.cfg, removing." |
|---|
| 33 |
rm /etc/vbox/vbox.cfg |
|---|
| 34 |
fi |
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 |
if [ -d /etc/udev/rules.d ]; then |
|---|
| 38 |
udev_out=`udevinfo -V 2> /dev/null` |
|---|
| 39 |
udev_ver=`expr "$udev_out" : '[^0-9]*\([0-9]*\)'` |
|---|
| 40 |
if [ "$udev_ver" = "" -o "$udev_ver" -lt 55 ]; then |
|---|
| 41 |
echo 'KERNEL="vboxdrv", NAME="vboxdrv", OWNER="root", GROUP="root", MODE="0600"' \ |
|---|
| 42 |
> /etc/udev/rules.d/60-vboxdrv.rules |
|---|
| 43 |
else |
|---|
| 44 |
echo 'KERNEL=="vboxdrv", NAME="vboxdrv", OWNER="root", GROUP="root", MODE="0600"' \ |
|---|
| 45 |
> /etc/udev/rules.d/60-vboxdrv.rules |
|---|
| 46 |
fi |
|---|
| 47 |
fi |
|---|
| 48 |
|
|---|
| 49 |
|
|---|
| 50 |
db_input high virtualbox-ose/group-vboxusers || true |
|---|
| 51 |
db_go || true |
|---|
| 52 |
addgroup --system vboxusers |
|---|
| 53 |
|
|---|
| 54 |
if [ ! -f /lib/modules/`uname -r`/misc/vboxdrv.ko ]; then |
|---|
| 55 |
db_get virtualbox-ose/module-compilation-allowed |
|---|
| 56 |
if [ "$RET" = "false" ]; then |
|---|
| 57 |
cat << EOF |
|---|
| 58 |
Unable to find a precompiled module for the current kernel |
|---|
| 59 |
though module compilation denied by debconf setting. |
|---|
| 60 |
EOF |
|---|
| 61 |
else |
|---|
| 62 |
db_input critical virtualbox-ose/module-compilation-allowed || true |
|---|
| 63 |
db_go || true |
|---|
| 64 |
db_get virtualbox-ose/module-compilation-allowed |
|---|
| 65 |
if [ "$RET" = "true" ]; then |
|---|
| 66 |
|
|---|
| 67 |
cat << EOF |
|---|
| 68 |
Messages emitted during module compilation will be logged to $LOG. |
|---|
| 69 |
EOF |
|---|
| 70 |
if ! /usr/share/virtualbox-ose/src/build_in_tmp install > /var/log/vbox-install.log 2>&1; then |
|---|
| 71 |
db_fset virtualbox-ose/module-compilation-failed seen false |
|---|
| 72 |
db_input critical virtualbox-ose/module-compilation-failed || true |
|---|
| 73 |
db_go || true |
|---|
| 74 |
touch /etc/vbox/module_not_compiled |
|---|
| 75 |
|
|---|
| 76 |
else |
|---|
| 77 |
|
|---|
| 78 |
cat << EOF |
|---|
| 79 |
Success! |
|---|
| 80 |
EOF |
|---|
| 81 |
rm -f /etc/vbox/module_not_compiled |
|---|
| 82 |
fi |
|---|
| 83 |
fi |
|---|
| 84 |
fi |
|---|
| 85 |
fi |
|---|
| 86 |
|
|---|
| 87 |
|
|---|
| 88 |
if lsmod | grep -q "vboxdrv[^_-]"; then |
|---|
| 89 |
/etc/init.d/vboxdrv stop || true |
|---|
| 90 |
fi |
|---|
| 91 |
|
|---|
| 92 |
|
|---|
| 93 |
|
|---|
| 94 |
if ! dpkg-statoverride --list /usr/lib/virtualbox-ose/VirtualBox > /dev/nnull 2>&1; then |
|---|
| 95 |
chmod 4711 /usr/lib/virtualbox-ose/VirtualBox |
|---|
| 96 |
fi |
|---|
| 97 |
if ! dpkg-statoverride --list /usr/lib/virtualbox-ose/VBoxHeadless > /dev/nnull 2>&1; then |
|---|
| 98 |
chmod 4711 /usr/lib/virtualbox-ose/VBoxHeadless |
|---|
| 99 |
fi |
|---|
| 100 |
if ! dpkg-statoverride --list /usr/lib/virtualbox-ose/VBoxSDL > /dev/nnull 2>&1; then |
|---|
| 101 |
chmod 4711 /usr/lib/virtualbox-ose/VBoxSDL |
|---|
| 102 |
fi |
|---|
| 103 |
|
|---|
| 104 |
|
|---|
| 105 |
|
|---|
| 106 |
exit 0 |
|---|