[3848] | 1 | #!/bin/sh
|
---|
[82441] | 2 | # $Id: postinst 98103 2023-01-17 14:15:46Z vboxsync $
|
---|
| 3 | ## @file
|
---|
| 4 | # VirtualBox postinst
|
---|
[6316] | 5 | #
|
---|
[82441] | 6 |
|
---|
[6316] | 7 | #
|
---|
[98103] | 8 | # Copyright (C) 2006-2023 Oracle and/or its affiliates.
|
---|
[82441] | 9 | #
|
---|
[96407] | 10 | # This file is part of VirtualBox base platform packages, as
|
---|
| 11 | # available from https://www.virtualbox.org.
|
---|
[6316] | 12 | #
|
---|
[96407] | 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 | #
|
---|
[3848] | 28 |
|
---|
[31999] | 29 | # we can be called with the following arguments (6.5 of Debian policy):
|
---|
[23991] | 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 |
|
---|
[82441] | 35 | ## @todo Do we really gain anything from not just executing everything
|
---|
| 36 | ## unconditionally?
|
---|
[39266] | 37 |
|
---|
[3848] | 38 | LOG="/var/log/vbox-install.log"
|
---|
| 39 |
|
---|
[31999] | 40 | # defaults
|
---|
| 41 | [ -r /etc/default/virtualbox ] && . /etc/default/virtualbox
|
---|
| 42 |
|
---|
[23991] | 43 | if [ "$1" = "configure" ]; then
|
---|
[3848] | 44 |
|
---|
[23991] | 45 | # for debconf
|
---|
| 46 | . /usr/share/debconf/confmodule
|
---|
| 47 | db_version 2.0
|
---|
[3848] | 48 |
|
---|
[23991] | 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 |
|
---|
[31999] | 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
|
---|
[3848] | 66 |
|
---|
[23991] | 67 | # The starters need to be Suid root. They drop the privileges before starting
|
---|
| 68 | # the real frontend.
|
---|
[82441] | 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
|
---|
[23991] | 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
|
---|
[84968] | 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
|
---|
[23991] | 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
|
---|
[47894] | 89 | if ! dpkg-statoverride --list /usr/lib/virtualbox/VBoxNetNAT > /dev/null 2>&1; then
|
---|
| 90 | chmod 4511 /usr/lib/virtualbox/VBoxNetNAT
|
---|
[47884] | 91 | fi
|
---|
[23991] | 92 | if ! dpkg-statoverride --list /usr/lib/virtualbox/VBoxNetAdpCtl > /dev/null 2>&1; then
|
---|
| 93 | chmod 4511 /usr/lib/virtualbox/VBoxNetAdpCtl
|
---|
| 94 | fi
|
---|
[44866] | 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
|
---|
[43715] | 99 | fi
|
---|
[23991] | 100 | fi # $1 = "configure"
|
---|
| 101 |
|
---|
[3848] | 102 | #DEBHELPER#
|
---|
| 103 |
|
---|
[82441] | 104 | if test "${INSTALL_NO_VBOXDRV}" = 1; then
|
---|
| 105 | POSTINST_START=--nostart
|
---|
| 106 | else
|
---|
| 107 | POSTINST_START=
|
---|
| 108 | fi
|
---|
[32183] | 109 |
|
---|
[82441] | 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
|
---|
[32183] | 113 |
|
---|
[3848] | 114 | exit 0
|
---|