1 | # Oracle VM VirtualBox
|
---|
2 | # VirtualBox Linux post-installer common portions
|
---|
3 | #
|
---|
4 |
|
---|
5 | # Copyright (C) 2015 Oracle Corporation
|
---|
6 | #
|
---|
7 | # This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
8 | # available from http://www.virtualbox.org. This file is free software;
|
---|
9 | # you can redistribute it and/or modify it under the terms of the GNU
|
---|
10 | # General Public License (GPL) as published by the Free Software
|
---|
11 | # Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
12 | # VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
13 | # hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
14 | #
|
---|
15 |
|
---|
16 | # Put bits of the post-installation here which should work the same for all of
|
---|
17 | # the Linux installers. We do not use special helpers (e.g. dh_* on Debian),
|
---|
18 | # but that should not matter, as we know what those helpers actually do, and we
|
---|
19 | # have to work on those systems anyway when installed using the all
|
---|
20 | # distributions installer.
|
---|
21 | #
|
---|
22 | # We assume that all required files are in the same folder as this script
|
---|
23 | # (e.g. /opt/VirtualBox, /usr/lib/VirtualBox, the build output directory).
|
---|
24 |
|
---|
25 | # The below is GNU-specific. See VBox.sh for the longer Solaris/OS X version.
|
---|
26 | TARGET=`readlink -e -- "${0}"` || exit 1
|
---|
27 | MY_PATH="${TARGET%/[!/]*}"
|
---|
28 | cd "${MY_PATH}"
|
---|
29 | . "./routines.sh"
|
---|
30 |
|
---|
31 | START=true
|
---|
32 | while test -n "${1}"; do
|
---|
33 | case "${1}" in
|
---|
34 | --nostart)
|
---|
35 | START=
|
---|
36 | ;;
|
---|
37 | *)
|
---|
38 | echo "Bad argument ${1}" >&2
|
---|
39 | exit 1
|
---|
40 | ;;
|
---|
41 | esac
|
---|
42 | shift
|
---|
43 | done
|
---|
44 |
|
---|
45 | # Remove any traces of DKMS from previous installations.
|
---|
46 | for i in vboxhost vboxdrv vboxnetflt vboxnetadp; do
|
---|
47 | rm -rf "/var/lib/dkms/${i}"*
|
---|
48 | done
|
---|
49 |
|
---|
50 | # Install runlevel scripts and systemd unit files
|
---|
51 | install_init_script "${MY_PATH}/vboxdrv.sh" vboxdrv
|
---|
52 | install_init_script "${MY_PATH}/vboxballoonctrl-service.sh" vboxballoonctrl-service
|
---|
53 | install_init_script "${MY_PATH}/vboxautostart-service.sh" vboxautostart-service
|
---|
54 | install_init_script "${MY_PATH}/vboxweb-service.sh" vboxweb-service
|
---|
55 |
|
---|
56 | delrunlevel vboxdrv
|
---|
57 | addrunlevel vboxdrv
|
---|
58 | delrunlevel vboxballoonctrl-service
|
---|
59 | addrunlevel vboxballoonctrl-service
|
---|
60 | delrunlevel vboxautostart-service
|
---|
61 | addrunlevel vboxautostart-service
|
---|
62 | delrunlevel vboxweb-service
|
---|
63 | addrunlevel vboxweb-service
|
---|
64 |
|
---|
65 | ln -sf "${MY_PATH}/postinst-common.sh" /sbin/vboxconfig
|
---|
66 |
|
---|
67 | # Set SELinux permissions
|
---|
68 | # XXX SELinux: allow text relocation entries
|
---|
69 | if [ -x /usr/bin/chcon ]; then
|
---|
70 | chcon -t texrel_shlib_t "${MY_PATH}"/*VBox* > /dev/null 2>&1
|
---|
71 | chcon -t texrel_shlib_t "${MY_PATH}"/VBoxAuth.so \
|
---|
72 | > /dev/null 2>&1
|
---|
73 | chcon -t texrel_shlib_t "${MY_PATH}"/VirtualBox.so \
|
---|
74 | > /dev/null 2>&1
|
---|
75 | chcon -t texrel_shlib_t "${MY_PATH}"/components/VBox*.so \
|
---|
76 | > /dev/null 2>&1
|
---|
77 | chcon -t java_exec_t "${MY_PATH}"/VirtualBox > /dev/null 2>&1
|
---|
78 | chcon -t java_exec_t "${MY_PATH}"/VBoxSDL > /dev/null 2>&1
|
---|
79 | chcon -t java_exec_t "${MY_PATH}"/VBoxHeadless \
|
---|
80 | > /dev/null 2>&1
|
---|
81 | chcon -t java_exec_t "${MY_PATH}"/VBoxNetDHCP \
|
---|
82 | > /dev/null 2>&1
|
---|
83 | chcon -t java_exec_t "${MY_PATH}"/VBoxNetNAT \
|
---|
84 | > /dev/null 2>&1
|
---|
85 | chcon -t java_exec_t "${MY_PATH}"/VBoxExtPackHelperApp \
|
---|
86 | > /dev/null 2>&1
|
---|
87 | chcon -t java_exec_t "${MY_PATH}"/vboxwebsrv > /dev/null 2>&1
|
---|
88 | chcon -t java_exec_t "${MY_PATH}"/webtest > /dev/null 2>&1
|
---|
89 | chcon -t bin_t "${MY_PATH}"/src/vboxhost/build_in_tmp \
|
---|
90 | > /dev/null 2>&1
|
---|
91 | chcon -t bin_t /usr/share/virtualbox/src/vboxhost/build_in_tmp \
|
---|
92 | > /dev/null 2>&1
|
---|
93 | fi
|
---|
94 |
|
---|
95 | test -n "${START}" &&
|
---|
96 | {
|
---|
97 | start_init_script vboxdrv
|
---|
98 | start_init_script vboxballoonctrl-service
|
---|
99 | start_init_script vboxautostart-service
|
---|
100 | start_init_script vboxweb-service
|
---|
101 | }
|
---|