postinst revision 9eb499828dd875d229531b50d05f016b8a1f1dd9
1556N/A#!/bin/sh
1556N/A#
1556N/A# Copyright (C) 2006-2007 innotek GmbH
1556N/A#
1556N/A# This file is part of VirtualBox Open Source Edition (OSE), as
1556N/A# available from http://www.virtualbox.org. This file is free software;
1556N/A# you can redistribute it and/or modify it under the terms of the GNU
1556N/A# General Public License as published by the Free Software Foundation,
1556N/A# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
1556N/A# distribution. VirtualBox OSE is distributed in the hope that it will
1556N/A# be useful, but WITHOUT ANY WARRANTY of any kind.
1556N/A#
1556N/A
1556N/ALOG="/var/log/vbox-install.log"
1556N/A
1556N/A# for debconf
1556N/A. /usr/share/debconf/confmodule
1556N/Adb_version 2.0
1556N/A
1556N/A# remove old cruft
2899N/Aif [ -f /etc/init.d/vboxdrv.sh ]; then
1556N/A echo "Found old version of /etc/init.d/vboxdrv.sh, removing."
1556N/A rm /etc/init.d/vboxdrv.sh
1556N/A update-rc.d vboxdrv.sh remove >/dev/null
1556N/Afi
3433N/Aif [ -f /etc/init.d/virtualbox ]; then
1556N/A echo "Found old version of /etc/init.d/virtualbox, removing."
1556N/A rm /etc/init.d/virtualbox
1556N/A update-rc.d virtualbox remove >/dev/null
1556N/Afi
3433N/A
3433N/A# install udev rule
1556N/Aif [ -d /etc/udev/rules.d ]; then
1556N/A udev_out=`udevinfo -V 2> /dev/null`
3433N/A udev_ver=`expr "$udev_out" : '[^0-9]*\([0-9]*\)'`
2899N/A if [ "$udev_ver" = "" -o "$udev_ver" -lt 55 ]; then
1556N/A echo 'KERNEL="vboxdrv", NAME="vboxdrv", OWNER="root", GROUP="vboxusers", MODE="0660"' \
1556N/A > /etc/udev/rules.d/60-vboxdrv.rules
1556N/A else
1556N/A echo 'KERNEL=="vboxdrv", NAME="vboxdrv", OWNER="root", GROUP="vboxusers", MODE="0660"' \
1768N/A > /etc/udev/rules.d/60-vboxdrv.rules
1768N/A fi
1768N/Afi
1768N/A
1768N/A# create users groups
1556N/Adb_input high virtualbox-ose/group-vboxusers || true
1556N/Adb_go || true
1556N/Agroupadd -f vboxusers
3433N/A
1556N/Aif [ ! -f /lib/modules/`uname -r`/misc/vboxdrv.ko ]; then
1768N/A db_get virtualbox-ose/module-compilation-allowed
1556N/A if [ "$RET" = "false" ]; then
1938N/A cat << EOF
1556N/AUnable to find a precompiled module for the current kernel
1556N/Athough module compilation denied by debconf setting.
1556N/AEOF
1556N/A else
1556N/A db_input critical virtualbox-ose/module-compilation-allowed || true
1556N/A db_go || true
1556N/A db_get virtualbox-ose/module-compilation-allowed
1556N/A if [ "$RET" = "true" ]; then
1556N/A # Compile module. Don't show a message box here if everything works well.
1556N/A cat << EOF
1556N/AMessages emitted during module compilation will be logged to $LOG.
EOF
if ! /usr/share/virtualbox-ose/src/build_in_tmp install > /var/log/vbox-install.log 2>&1; then
db_fset virtualbox-ose/module-compilation-failed seen false
db_input critical virtualbox-ose/module-compilation-failed || true
db_go || true
touch /etc/vbox/module_not_compiled
# don't abort the installation!
else
# success
cat << EOF
Success!
EOF
rm -f /etc/vbox/module_not_compiled
fi
fi
fi
fi
# There might be an old module active (e.g. manually loaded)
if lsmod | grep -q "vboxdrv[^_-]"; then
/etc/init.d/vboxdrv stop || true
fi
#DEBHELPER#
exit 0