1 | #!/bin/sh
|
---|
2 | # $Id: postinst-common.sh 67053 2017-05-24 08:02:36Z vboxsync $
|
---|
3 | ## @file
|
---|
4 | # Oracle VM VirtualBox
|
---|
5 | # VirtualBox Linux post-installer common portions
|
---|
6 | #
|
---|
7 |
|
---|
8 | # Copyright (C) 2015 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 | # Put bits of the post-installation here which should work the same for all of
|
---|
20 | # the Linux installers. We do not use special helpers (e.g. dh_* on Debian),
|
---|
21 | # but that should not matter, as we know what those helpers actually do, and we
|
---|
22 | # have to work on those systems anyway when installed using the all
|
---|
23 | # distributions installer.
|
---|
24 | #
|
---|
25 | # We assume that all required files are in the same folder as this script
|
---|
26 | # (e.g. /opt/VirtualBox, /usr/lib/VirtualBox, the build output directory).
|
---|
27 |
|
---|
28 | # The below is GNU-specific. See VBox.sh for the longer Solaris/OS X version.
|
---|
29 | TARGET=`readlink -e -- "${0}"` || exit 1
|
---|
30 | MY_PATH="${TARGET%/[!/]*}"
|
---|
31 | cd "${MY_PATH}"
|
---|
32 | . "./routines.sh"
|
---|
33 |
|
---|
34 | START=true
|
---|
35 | while test -n "${1}"; do
|
---|
36 | case "${1}" in
|
---|
37 | --nostart)
|
---|
38 | START=
|
---|
39 | ;;
|
---|
40 | *)
|
---|
41 | echo "Bad argument ${1}" >&2
|
---|
42 | exit 1
|
---|
43 | ;;
|
---|
44 | esac
|
---|
45 | shift
|
---|
46 | done
|
---|
47 |
|
---|
48 | # Remove any traces of DKMS from previous installations.
|
---|
49 | for i in vboxhost vboxdrv vboxnetflt vboxnetadp; do
|
---|
50 | rm -rf "/var/lib/dkms/${i}"*
|
---|
51 | done
|
---|
52 |
|
---|
53 | # Install runlevel scripts and systemd unit files
|
---|
54 | install_init_script "${MY_PATH}/vboxdrv.sh" vboxdrv
|
---|
55 | install_init_script "${MY_PATH}/vboxballoonctrl-service.sh" vboxballoonctrl-service
|
---|
56 | install_init_script "${MY_PATH}/vboxautostart-service.sh" vboxautostart-service
|
---|
57 | install_init_script "${MY_PATH}/vboxweb-service.sh" vboxweb-service
|
---|
58 |
|
---|
59 | delrunlevel vboxdrv
|
---|
60 | addrunlevel vboxdrv
|
---|
61 | delrunlevel vboxballoonctrl-service
|
---|
62 | addrunlevel vboxballoonctrl-service
|
---|
63 | delrunlevel vboxautostart-service
|
---|
64 | addrunlevel vboxautostart-service
|
---|
65 | delrunlevel vboxweb-service
|
---|
66 | addrunlevel vboxweb-service
|
---|
67 |
|
---|
68 | ln -sf "${MY_PATH}/postinst-common.sh" /sbin/vboxconfig
|
---|
69 |
|
---|
70 | # Set SELinux permissions
|
---|
71 | # XXX SELinux: allow text relocation entries
|
---|
72 | if [ -x /usr/bin/chcon ]; then
|
---|
73 | chcon -t texrel_shlib_t "${MY_PATH}"/*VBox* > /dev/null 2>&1
|
---|
74 | chcon -t texrel_shlib_t "${MY_PATH}"/VBoxAuth.so \
|
---|
75 | > /dev/null 2>&1
|
---|
76 | chcon -t texrel_shlib_t "${MY_PATH}"/VirtualBox.so \
|
---|
77 | > /dev/null 2>&1
|
---|
78 | chcon -t texrel_shlib_t "${MY_PATH}"/components/VBox*.so \
|
---|
79 | > /dev/null 2>&1
|
---|
80 | chcon -t java_exec_t "${MY_PATH}"/VirtualBox > /dev/null 2>&1
|
---|
81 | chcon -t java_exec_t "${MY_PATH}"/VBoxSDL > /dev/null 2>&1
|
---|
82 | chcon -t java_exec_t "${MY_PATH}"/VBoxHeadless \
|
---|
83 | > /dev/null 2>&1
|
---|
84 | chcon -t java_exec_t "${MY_PATH}"/VBoxNetDHCP \
|
---|
85 | > /dev/null 2>&1
|
---|
86 | chcon -t java_exec_t "${MY_PATH}"/VBoxNetNAT \
|
---|
87 | > /dev/null 2>&1
|
---|
88 | chcon -t java_exec_t "${MY_PATH}"/VBoxExtPackHelperApp \
|
---|
89 | > /dev/null 2>&1
|
---|
90 | chcon -t java_exec_t "${MY_PATH}"/vboxwebsrv > /dev/null 2>&1
|
---|
91 | chcon -t bin_t "${MY_PATH}"/src/vboxhost/build_in_tmp \
|
---|
92 | > /dev/null 2>&1
|
---|
93 | chcon -t bin_t /usr/share/virtualbox/src/vboxhost/build_in_tmp \
|
---|
94 | > /dev/null 2>&1
|
---|
95 | fi
|
---|
96 |
|
---|
97 | test -n "${START}" &&
|
---|
98 | {
|
---|
99 | if ! "${MY_PATH}/vboxdrv.sh" setup; then
|
---|
100 | "${MY_PATH}/check_module_dependencies.sh" >&2
|
---|
101 | echo >&2
|
---|
102 | echo "There were problems setting up VirtualBox. To re-start the set-up process, run" >&2
|
---|
103 | echo " /sbin/vboxconfig" >&2
|
---|
104 | echo "as root." >&2
|
---|
105 | else
|
---|
106 | start_init_script vboxdrv
|
---|
107 | start_init_script vboxballoonctrl-service
|
---|
108 | start_init_script vboxautostart-service
|
---|
109 | start_init_script vboxweb-service
|
---|
110 | fi
|
---|
111 | }
|
---|