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