1 | #!/bin/sh
|
---|
2 | # $Id: postinst 96407 2022-08-22 17:43:14Z vboxsync $
|
---|
3 | ## @file
|
---|
4 | # VirtualBox postinst
|
---|
5 | #
|
---|
6 |
|
---|
7 | #
|
---|
8 | # Copyright (C) 2006-2022 Oracle and/or its affiliates.
|
---|
9 | #
|
---|
10 | # This file is part of VirtualBox base platform packages, as
|
---|
11 | # available from https://www.virtualbox.org.
|
---|
12 | #
|
---|
13 | # This program is free software; you can redistribute it and/or
|
---|
14 | # modify it under the terms of the GNU General Public License
|
---|
15 | # as published by the Free Software Foundation, in version 3 of the
|
---|
16 | # License.
|
---|
17 | #
|
---|
18 | # This program is distributed in the hope that it will be useful, but
|
---|
19 | # WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
21 | # General Public License for more details.
|
---|
22 | #
|
---|
23 | # You should have received a copy of the GNU General Public License
|
---|
24 | # along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
25 | #
|
---|
26 | # SPDX-License-Identifier: GPL-3.0-only
|
---|
27 | #
|
---|
28 |
|
---|
29 | # we can be called with the following arguments (6.5 of Debian policy):
|
---|
30 | # configure: (our version): installing/configuring new version
|
---|
31 | # abort-upgrade: (old version): upgrading to a new version failed
|
---|
32 | # abort-remove: (our version): removing this package failed
|
---|
33 | # abort-deconfigure: (our version): error during resolving conflicts
|
---|
34 |
|
---|
35 | ## @todo Do we really gain anything from not just executing everything
|
---|
36 | ## unconditionally?
|
---|
37 |
|
---|
38 | LOG="/var/log/vbox-install.log"
|
---|
39 |
|
---|
40 | # defaults
|
---|
41 | [ -r /etc/default/virtualbox ] && . /etc/default/virtualbox
|
---|
42 |
|
---|
43 | if [ "$1" = "configure" ]; then
|
---|
44 |
|
---|
45 | # for debconf
|
---|
46 | . /usr/share/debconf/confmodule
|
---|
47 | db_version 2.0
|
---|
48 |
|
---|
49 | # remove old cruft
|
---|
50 | if [ -f /etc/init.d/vboxdrv.sh ]; then
|
---|
51 | echo "Found old version of /etc/init.d/vboxdrv.sh, removing."
|
---|
52 | rm /etc/init.d/vboxdrv.sh
|
---|
53 | update-rc.d vboxdrv.sh remove >/dev/null
|
---|
54 | fi
|
---|
55 | if [ -f /etc/vbox/vbox.cfg ]; then
|
---|
56 | echo "Found old version of /etc/vbox/vbox.cfg, removing."
|
---|
57 | rm /etc/vbox/vbox.cfg
|
---|
58 | fi
|
---|
59 |
|
---|
60 | # create users groups (disable with INSTALL_NO_GROUP=1 in /etc/default/virtualbox)
|
---|
61 | if [ "$INSTALL_NO_GROUP" != "1" ]; then
|
---|
62 | db_input low virtualbox/group-vboxusers || true
|
---|
63 | db_go || true
|
---|
64 | addgroup --system vboxusers || true
|
---|
65 | fi
|
---|
66 |
|
---|
67 | # The starters need to be Suid root. They drop the privileges before starting
|
---|
68 | # the real frontend.
|
---|
69 | if test -e /usr/lib/virtualbox/VirtualBoxVM; then
|
---|
70 | if ! dpkg-statoverride --list /usr/lib/virtualbox/VirtualBoxVM > /dev/null 2>&1; then
|
---|
71 | chmod 4511 /usr/lib/virtualbox/VirtualBoxVM
|
---|
72 | fi
|
---|
73 | else
|
---|
74 | if ! dpkg-statoverride --list /usr/lib/virtualbox/VirtualBox > /dev/null 2>&1; then
|
---|
75 | chmod 4511 /usr/lib/virtualbox/VirtualBox
|
---|
76 | fi
|
---|
77 | fi
|
---|
78 | if ! dpkg-statoverride --list /usr/lib/virtualbox/VBoxHeadless > /dev/null 2>&1; then
|
---|
79 | chmod 4511 /usr/lib/virtualbox/VBoxHeadless
|
---|
80 | fi
|
---|
81 | if [ -x /usr/lib/virtualbox/VBoxSDL ]; then
|
---|
82 | if ! dpkg-statoverride --list /usr/lib/virtualbox/VBoxSDL > /dev/null 2>&1; then
|
---|
83 | chmod 4511 /usr/lib/virtualbox/VBoxSDL
|
---|
84 | fi
|
---|
85 | fi
|
---|
86 | if ! dpkg-statoverride --list /usr/lib/virtualbox/VBoxNetDHCP > /dev/null 2>&1; then
|
---|
87 | chmod 4511 /usr/lib/virtualbox/VBoxNetDHCP
|
---|
88 | fi
|
---|
89 | if ! dpkg-statoverride --list /usr/lib/virtualbox/VBoxNetNAT > /dev/null 2>&1; then
|
---|
90 | chmod 4511 /usr/lib/virtualbox/VBoxNetNAT
|
---|
91 | fi
|
---|
92 | if ! dpkg-statoverride --list /usr/lib/virtualbox/VBoxNetAdpCtl > /dev/null 2>&1; then
|
---|
93 | chmod 4511 /usr/lib/virtualbox/VBoxNetAdpCtl
|
---|
94 | fi
|
---|
95 | if [ -x /usr/lib/virtualbox/VBoxVolInfo ]; then
|
---|
96 | if ! dpkg-statoverride --list /usr/lib/virtualbox/VBoxVolInfo > /dev/null 2>&1; then
|
---|
97 | chmod 4511 /usr/lib/virtualbox/VBoxVolInfo
|
---|
98 | fi
|
---|
99 | fi
|
---|
100 | fi # $1 = "configure"
|
---|
101 |
|
---|
102 | #DEBHELPER#
|
---|
103 |
|
---|
104 | if test "${INSTALL_NO_VBOXDRV}" = 1; then
|
---|
105 | POSTINST_START=--nostart
|
---|
106 | else
|
---|
107 | POSTINST_START=
|
---|
108 | fi
|
---|
109 |
|
---|
110 | # Install and start the new service scripts.
|
---|
111 | /usr/lib/virtualbox/prerm-common.sh || true
|
---|
112 | /usr/lib/virtualbox/postinst-common.sh ${POSTINST_START} > /dev/null || true
|
---|
113 |
|
---|
114 | exit 0
|
---|