VirtualBox

source: vbox/trunk/debian/postinst.in@ 74942

Last change on this file since 74942 was 51424, checked in by vboxsync, 10 years ago

debian: sync

File size: 5.9 KB
RevLine 
[3848]1#!/bin/sh
[6316]2#
[44528]3# Copyright (C) 2006-2012 Oracle Corporation
[6316]4#
5# This file is part of VirtualBox Open Source Edition (OSE), as
6# available from http://www.virtualbox.org. This file is free software;
7# you can redistribute it and/or modify it under the terms of the GNU
[43119]8# General Public License (GPL) as published by the Free Software
9# Foundation, in version 2 as it comes in the "COPYING" file of the
10# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
11# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
[6316]12#
[3848]13
[31999]14# we can be called with the following arguments (6.5 of Debian policy):
[23991]15# configure: (our version): installing/configuring new version
16# abort-upgrade: (old version): upgrading to a new version failed
17# abort-remove: (our version): removing this package failed
18# abort-deconfigure: (our version): error during resolving conflicts
19
[39266]20#include installer-common.sh
21
[3848]22LOG="/var/log/vbox-install.log"
23
[31999]24# defaults
25[ -r /etc/default/virtualbox ] && . /etc/default/virtualbox
26
[23991]27if [ "$1" = "configure" ]; then
[3848]28
[23991]29 # for debconf
30 . /usr/share/debconf/confmodule
31 db_version 2.0
[3848]32
[23991]33 # remove old cruft
34 if [ -f /etc/init.d/vboxdrv.sh ]; then
35 echo "Found old version of /etc/init.d/vboxdrv.sh, removing."
36 rm /etc/init.d/vboxdrv.sh
37 update-rc.d vboxdrv.sh remove >/dev/null
38 fi
39 if [ -f /etc/vbox/vbox.cfg ]; then
40 echo "Found old version of /etc/vbox/vbox.cfg, removing."
41 rm /etc/vbox/vbox.cfg
42 fi
43
[31999]44 # create users groups (disable with INSTALL_NO_GROUP=1 in /etc/default/virtualbox)
45 if [ "$INSTALL_NO_GROUP" != "1" ]; then
46 db_input low virtualbox/group-vboxusers || true
47 db_go || true
48 addgroup --system vboxusers || true
49 fi
[3848]50
[39266]51 # install udev rule (disable with INSTALL_NO_UDEV=1 in
52 # /etc/default/virtualbox) and /dev/vboxdrv and /dev/vboxusb/*/* device nodes
53 install_device_node_setup root 0600 /usr/share/virtualbox "${usb_group}"
54
[23991]55 # The starters need to be Suid root. They drop the privileges before starting
56 # the real frontend.
57 if ! dpkg-statoverride --list /usr/lib/virtualbox/VirtualBox > /dev/null 2>&1; then
58 chmod 4511 /usr/lib/virtualbox/VirtualBox
59 fi
60 if ! dpkg-statoverride --list /usr/lib/virtualbox/VBoxHeadless > /dev/null 2>&1; then
61 chmod 4511 /usr/lib/virtualbox/VBoxHeadless
62 fi
63 if ! dpkg-statoverride --list /usr/lib/virtualbox/VBoxSDL > /dev/null 2>&1; then
64 chmod 4511 /usr/lib/virtualbox/VBoxSDL
65 fi
66 if ! dpkg-statoverride --list /usr/lib/virtualbox/VBoxNetDHCP > /dev/null 2>&1; then
67 chmod 4511 /usr/lib/virtualbox/VBoxNetDHCP
68 fi
[47894]69 if ! dpkg-statoverride --list /usr/lib/virtualbox/VBoxNetNAT > /dev/null 2>&1; then
70 chmod 4511 /usr/lib/virtualbox/VBoxNetNAT
[47884]71 fi
[23991]72 if ! dpkg-statoverride --list /usr/lib/virtualbox/VBoxNetAdpCtl > /dev/null 2>&1; then
73 chmod 4511 /usr/lib/virtualbox/VBoxNetAdpCtl
74 fi
[44866]75 if [ -x /usr/lib/virtualbox/VBoxVolInfo ]; then
76 if ! dpkg-statoverride --list /usr/lib/virtualbox/VBoxVolInfo > /dev/null 2>&1; then
77 chmod 4511 /usr/lib/virtualbox/VBoxVolInfo
78 fi
[43715]79 fi
[23991]80
[31999]81 # if INSTALL_NO_VBOXDRV is set to 1, remove all shipped modules
82 if [ "$INSTALL_NO_VBOXDRV" = "1" ]; then
83 rm -f /lib/modules/*/misc/vboxdrv.ko
84 rm -f /lib/modules/*/misc/vboxnetflt.ko
85 rm -f /lib/modules/*/misc/vboxnetadp.ko
86 fi
87
[23991]88fi # $1 = "configure"
89
[3848]90#DEBHELPER#
91
[32183]92if [ "$1" = "configure" ]; then
[36782]93 # Start vboxdrv/vboxballoonctrl/vboxweb-service manually as we use our own error handling in postrm
[32183]94 if [ -x "/etc/init.d/vboxdrv" ]; then
[51424]95 update-rc.d vboxdrv defaults 20 80 >/dev/null
[32183]96
97 BUILD_MODULES=0
[32237]98 REGISTER_MODULES=1
[32183]99 # Disable module compilation with INSTALL_NO_VBOXDRV=1 in /etc/default/virtualbox
[32237]100 if [ ! -f /lib/modules/`uname -r`/misc/vboxdrv.ko ]; then
101 REGISTER_MODULES=0
102 if [ "$INSTALL_NO_VBOXDRV" != "1" ]; then
103 db_get virtualbox/module-compilation-allowed
104 if [ "$RET" = "false" ]; then
105 cat << EOF
[32183]106Unable to find a precompiled module for the current kernel
107though module compilation denied by debconf setting.
108EOF
[32237]109 else
110 db_input low virtualbox/module-compilation-allowed || true
111 db_go || true
112 db_get virtualbox/module-compilation-allowed
113 if [ "$RET" = "true" ]; then
114 BUILD_MODULES=1
115 fi
[32183]116 fi
117 fi
118 fi
119
[32237]120 if [ $BUILD_MODULES -eq 1 ]; then
121 if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
[32183]122 invoke-rc.d vboxdrv setup || true
123 else
[32237]124 /etc/init.d/vboxdrv setup || true
[32183]125 fi
126 else
[32237]127 # shipped modules found, register sources at DKMS anyway
[32517]128 if lsmod | grep -q "vboxdrv[^_-]"; then
129 /etc/init.d/vboxdrv stop || true
130 fi
[32237]131 if [ $REGISTER_MODULES -eq 1 ]; then
132 DKMS=`which dkms 2>/dev/null`
133 if [ -n "$DKMS" ]; then
134 $DKMS add -m vboxhost -v %VER% > /dev/null 2>&1 || true
135 fi
136 fi
137 if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
138 invoke-rc.d vboxdrv start || exit $?
[32183]139 else
140 /etc/init.d/vboxdrv start || exit $?
141 fi
142 fi
143 fi
[36782]144 if [ -x "/etc/init.d/vboxballoonctrl-service" ]; then
[51424]145 update-rc.d vboxballoonctrl-service defaults 35 65 >/dev/null
[36782]146 if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
147 invoke-rc.d vboxballoonctrl-service start || exit $?
148 else
149 /etc/init.d/vboxballoonctrl-service start || exit $?
150 fi
151 fi
[43316]152 if [ -x "/etc/init.d/vboxautostart-service" ]; then
[51424]153 update-rc.d vboxautostart-service defaults 35 65 >/dev/null
[43316]154 if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
155 invoke-rc.d vboxautostart-service start || exit $?
156 else
157 /etc/init.d/vboxautostart-service start || exit $?
158 fi
159 fi
[32183]160 if [ -x "/etc/init.d/vboxweb-service" ]; then
[51424]161 update-rc.d vboxweb-service defaults 35 65 >/dev/null
[32543]162 if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
163 invoke-rc.d vboxweb-service start || exit $?
164 else
165 /etc/init.d/vboxweb-service start || exit $?
166 fi
[32183]167 fi
168
169fi # $1 = "configure"
170
[3848]171exit 0
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use