postinst.in revision f5ab5688c35373443d953e2a9fa8a054defdece8
0887a65d2e1f7d938381bed11e859caed56cb47evboxsync# Copyright (C) 2006-2010 Oracle Corporation
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync# This file is part of VirtualBox Open Source Edition (OSE), as
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync# available from http://www.virtualbox.org. This file is free software;
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync# you can redistribute it and/or modify it under the terms of the GNU
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync# General Public License as published by the Free Software Foundation,
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync# distribution. VirtualBox OSE is distributed in the hope that it will
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync# be useful, but WITHOUT ANY WARRANTY of any kind.
003bed4b86e46315aaef143a73c95eb8eee7fe78vboxsync# we can be called with the following arguments (6.5 of Debian policy):
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync# configure: (our version): installing/configuring new version
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync# abort-upgrade: (old version): upgrading to a new version failed
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync# abort-remove: (our version): removing this package failed
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync# abort-deconfigure: (our version): error during resolving conflicts
003bed4b86e46315aaef143a73c95eb8eee7fe78vboxsync[ -r /etc/default/virtualbox ] && . /etc/default/virtualbox
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync # for debconf
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync # remove old cruft
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync echo "Found old version of /etc/init.d/vboxdrv.sh, removing."
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync echo "Found old version of /etc/vbox/vbox.cfg, removing."
003bed4b86e46315aaef143a73c95eb8eee7fe78vboxsync # install udev rule (disable with INSTALL_NO_UDEV=1 in /etc/default/virtualbox)
003bed4b86e46315aaef143a73c95eb8eee7fe78vboxsync if [ -d /etc/udev/rules.d -a "$INSTALL_NO_UDEV" != "1" ]; then
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync if [ "$udev_ver" = "" -o "$udev_ver" -lt 55 ]; then
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync echo "KERNEL=${udev_fix}\"vboxdrv\", NAME=\"vboxdrv\", OWNER=\"root\", GROUP=\"root\", MODE=\"0600\"" \
003bed4b86e46315aaef143a73c95eb8eee7fe78vboxsync echo "SUBSYSTEM=${udev_fix}\"usb_device\", GROUP=\"vboxusers\", MODE=\"0664\"" \
003bed4b86e46315aaef143a73c95eb8eee7fe78vboxsync echo "SUBSYSTEM=${udev_fix}\"usb\", ENV{DEVTYPE}==\"usb_device\", GROUP=\"vboxusers\", MODE=\"0664\"" \
003bed4b86e46315aaef143a73c95eb8eee7fe78vboxsync echo "SUBSYSTEM=${udev_fix}\"usb_device\", GROUP=\"root\", MODE=\"0664\"" \
003bed4b86e46315aaef143a73c95eb8eee7fe78vboxsync echo "SUBSYSTEM=${udev_fix}\"usb\", ENV{DEVTYPE}==\"usb_device\", GROUP=\"root\", MODE=\"0664\"" \
003bed4b86e46315aaef143a73c95eb8eee7fe78vboxsync # Remove old udev description file
003bed4b86e46315aaef143a73c95eb8eee7fe78vboxsync rm -f /etc/udev/rules.d/60-vboxdrv.rules 2> /dev/null
003bed4b86e46315aaef143a73c95eb8eee7fe78vboxsync # Push the permissions to the USB device nodes. One of these should match.
003bed4b86e46315aaef143a73c95eb8eee7fe78vboxsync # Rather nasty to use udevadm trigger for this, but I don't know of any
003bed4b86e46315aaef143a73c95eb8eee7fe78vboxsync # better way.
003bed4b86e46315aaef143a73c95eb8eee7fe78vboxsync udevadm trigger --subsystem-match=usb > /dev/null 2>&1
003bed4b86e46315aaef143a73c95eb8eee7fe78vboxsync udevtrigger --subsystem-match=usb_device > /dev/null 2>&1
003bed4b86e46315aaef143a73c95eb8eee7fe78vboxsync # create users groups (disable with INSTALL_NO_GROUP=1 in /etc/default/virtualbox)
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync # The starters need to be Suid root. They drop the privileges before starting
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync # the real frontend.
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync if ! dpkg-statoverride --list /usr/lib/virtualbox/VirtualBox > /dev/null 2>&1; then
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync if ! dpkg-statoverride --list /usr/lib/virtualbox/VBoxHeadless > /dev/null 2>&1; then
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync if ! dpkg-statoverride --list /usr/lib/virtualbox/VBoxSDL > /dev/null 2>&1; then
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync if ! dpkg-statoverride --list /usr/lib/virtualbox/VBoxNetDHCP > /dev/null 2>&1; then
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync if ! dpkg-statoverride --list /usr/lib/virtualbox/VBoxNetAdpCtl > /dev/null 2>&1; then
003bed4b86e46315aaef143a73c95eb8eee7fe78vboxsync # if INSTALL_NO_VBOXDRV is set to 1, remove all shipped modules
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsyncfi # $1 = "configure"
7eaaa8a4480370b82ef3735994f986f338fb4df2vboxsync # Start vboxdrv/vboxweb-service manually as we use our own error handling in postrm
7eaaa8a4480370b82ef3735994f986f338fb4df2vboxsync if [ -x "/etc/init.d/vboxdrv" ]; then
7eaaa8a4480370b82ef3735994f986f338fb4df2vboxsync # There might be an old module active (e.g. manually loaded)
7eaaa8a4480370b82ef3735994f986f338fb4df2vboxsync # Disable module compilation with INSTALL_NO_VBOXDRV=1 in /etc/default/virtualbox
f5ab5688c35373443d953e2a9fa8a054defdece8vboxsync if [ ! -f /lib/modules/`uname -r`/misc/vboxdrv.ko ]; then
7eaaa8a4480370b82ef3735994f986f338fb4df2vboxsyncUnable to find a precompiled module for the current kernel
7eaaa8a4480370b82ef3735994f986f338fb4df2vboxsyncthough module compilation denied by debconf setting.
f5ab5688c35373443d953e2a9fa8a054defdece8vboxsync db_input low virtualbox/module-compilation-allowed || true
f5ab5688c35373443d953e2a9fa8a054defdece8vboxsync # shipped modules found, register sources at DKMS anyway
f5ab5688c35373443d953e2a9fa8a054defdece8vboxsync if [ -n "$DKMS" ]; then
f5ab5688c35373443d953e2a9fa8a054defdece8vboxsync $DKMS add -m vboxhost -v %VER% > /dev/null 2>&1 || true
7eaaa8a4480370b82ef3735994f986f338fb4df2vboxsync if [ -x "/etc/init.d/vboxweb-service" ]; then
7eaaa8a4480370b82ef3735994f986f338fb4df2vboxsync# if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
7eaaa8a4480370b82ef3735994f986f338fb4df2vboxsync# invoke-rc.d vboxweb-service start || exit $?
7eaaa8a4480370b82ef3735994f986f338fb4df2vboxsync# /etc/init.d/vboxweb-service start || exit $?
7eaaa8a4480370b82ef3735994f986f338fb4df2vboxsyncfi # $1 = "configure"