[59426] | 1 | #!/bin/sh
|
---|
| 2 | # $Id: postinst-common.sh 98681 2023-02-21 16:01:22Z vboxsync $
|
---|
| 3 | ## @file
|
---|
[57712] | 4 | # Oracle VM VirtualBox
|
---|
| 5 | # VirtualBox Linux post-installer common portions
|
---|
| 6 | #
|
---|
| 7 |
|
---|
[69402] | 8 | #
|
---|
[98103] | 9 | # Copyright (C) 2015-2023 Oracle and/or its affiliates.
|
---|
[57712] | 10 | #
|
---|
[96407] | 11 | # This file is part of VirtualBox base platform packages, as
|
---|
| 12 | # available from https://www.virtualbox.org.
|
---|
[58214] | 13 | #
|
---|
[96407] | 14 | # This program is free software; you can redistribute it and/or
|
---|
| 15 | # modify it under the terms of the GNU General Public License
|
---|
| 16 | # as published by the Free Software Foundation, in version 3 of the
|
---|
| 17 | # License.
|
---|
| 18 | #
|
---|
| 19 | # This program is distributed in the hope that it will be useful, but
|
---|
| 20 | # WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 21 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
| 22 | # General Public License for more details.
|
---|
| 23 | #
|
---|
| 24 | # You should have received a copy of the GNU General Public License
|
---|
| 25 | # along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
| 26 | #
|
---|
| 27 | # SPDX-License-Identifier: GPL-3.0-only
|
---|
| 28 | #
|
---|
[57712] | 29 |
|
---|
| 30 | # Put bits of the post-installation here which should work the same for all of
|
---|
| 31 | # the Linux installers. We do not use special helpers (e.g. dh_* on Debian),
|
---|
| 32 | # but that should not matter, as we know what those helpers actually do, and we
|
---|
| 33 | # have to work on those systems anyway when installed using the all
|
---|
| 34 | # distributions installer.
|
---|
| 35 | #
|
---|
| 36 | # We assume that all required files are in the same folder as this script
|
---|
| 37 | # (e.g. /opt/VirtualBox, /usr/lib/VirtualBox, the build output directory).
|
---|
| 38 |
|
---|
[58324] | 39 | # The below is GNU-specific. See VBox.sh for the longer Solaris/OS X version.
|
---|
| 40 | TARGET=`readlink -e -- "${0}"` || exit 1
|
---|
| 41 | MY_PATH="${TARGET%/[!/]*}"
|
---|
[76611] | 42 | cd "${MY_PATH}"
|
---|
[57712] | 43 | . "./routines.sh"
|
---|
| 44 |
|
---|
[58090] | 45 | START=true
|
---|
| 46 | while test -n "${1}"; do
|
---|
| 47 | case "${1}" in
|
---|
| 48 | --nostart)
|
---|
| 49 | START=
|
---|
[57712] | 50 | ;;
|
---|
| 51 | *)
|
---|
[58090] | 52 | echo "Bad argument ${1}" >&2
|
---|
| 53 | exit 1
|
---|
[57712] | 54 | ;;
|
---|
| 55 | esac
|
---|
[58090] | 56 | shift
|
---|
[57712] | 57 | done
|
---|
| 58 |
|
---|
[57969] | 59 | # Remove any traces of DKMS from previous installations.
|
---|
| 60 | for i in vboxhost vboxdrv vboxnetflt vboxnetadp; do
|
---|
| 61 | rm -rf "/var/lib/dkms/${i}"*
|
---|
| 62 | done
|
---|
| 63 |
|
---|
[57712] | 64 | # Install runlevel scripts and systemd unit files
|
---|
[76611] | 65 | install_init_script "${MY_PATH}/vboxdrv.sh" vboxdrv
|
---|
[98680] | 66 | if [ -f ${MY_PATH}/vboxballoonctrl-service.sh ]; then
|
---|
| 67 | install_init_script "${MY_PATH}/vboxballoonctrl-service.sh" vboxballoonctrl-service
|
---|
| 68 | fi
|
---|
| 69 | if [ -f ${MY_PATH}/vboxautostart-service.sh ]; then
|
---|
| 70 | install_init_script "${MY_PATH}/vboxautostart-service.sh" vboxautostart-service
|
---|
| 71 | fi
|
---|
[98681] | 72 | if [ -f ${MY_PATH}/vboxweb-service.sh ]; then
|
---|
| 73 | install_init_script "${MY_PATH}/vboxweb-service.sh" vboxweb-service
|
---|
| 74 | fi
|
---|
[76046] | 75 | finish_init_script_install
|
---|
[57712] | 76 |
|
---|
| 77 | delrunlevel vboxdrv
|
---|
| 78 | addrunlevel vboxdrv
|
---|
| 79 | delrunlevel vboxballoonctrl-service
|
---|
[98680] | 80 | if [ -f ${MY_PATH}/vboxballoonctrl-service.sh ]; then
|
---|
| 81 | addrunlevel vboxballoonctrl-service
|
---|
| 82 | fi
|
---|
[57712] | 83 | delrunlevel vboxautostart-service
|
---|
[98680] | 84 | if [ -f ${MY_PATH}/vboxautostart-service.sh ]; then
|
---|
| 85 | addrunlevel vboxautostart-service
|
---|
| 86 | fi
|
---|
[57712] | 87 | delrunlevel vboxweb-service
|
---|
[98681] | 88 | if [ -f ${MY_PATH}/vboxweb-service.sh ]; then
|
---|
| 89 | addrunlevel vboxweb-service
|
---|
| 90 | fi
|
---|
[57712] | 91 |
|
---|
[76611] | 92 | ln -sf "${MY_PATH}/postinst-common.sh" /sbin/vboxconfig
|
---|
[58090] | 93 |
|
---|
[58399] | 94 | # Set SELinux permissions
|
---|
| 95 | # XXX SELinux: allow text relocation entries
|
---|
| 96 | if [ -x /usr/bin/chcon ]; then
|
---|
[76611] | 97 | chcon -t texrel_shlib_t "${MY_PATH}"/*VBox* > /dev/null 2>&1
|
---|
| 98 | chcon -t texrel_shlib_t "${MY_PATH}"/VBoxAuth.so \
|
---|
[58399] | 99 | > /dev/null 2>&1
|
---|
[76611] | 100 | chcon -t texrel_shlib_t "${MY_PATH}"/VirtualBox.so \
|
---|
[58399] | 101 | > /dev/null 2>&1
|
---|
[76611] | 102 | chcon -t texrel_shlib_t "${MY_PATH}"/components/VBox*.so \
|
---|
[58399] | 103 | > /dev/null 2>&1
|
---|
[76611] | 104 | chcon -t java_exec_t "${MY_PATH}"/VirtualBox > /dev/null 2>&1
|
---|
| 105 | chcon -t java_exec_t "${MY_PATH}"/VBoxSDL > /dev/null 2>&1
|
---|
| 106 | chcon -t java_exec_t "${MY_PATH}"/VBoxHeadless \
|
---|
[58399] | 107 | > /dev/null 2>&1
|
---|
[76611] | 108 | chcon -t java_exec_t "${MY_PATH}"/VBoxNetDHCP \
|
---|
[58399] | 109 | > /dev/null 2>&1
|
---|
[76611] | 110 | chcon -t java_exec_t "${MY_PATH}"/VBoxNetNAT \
|
---|
[58399] | 111 | > /dev/null 2>&1
|
---|
[76611] | 112 | chcon -t java_exec_t "${MY_PATH}"/VBoxExtPackHelperApp \
|
---|
[58399] | 113 | > /dev/null 2>&1
|
---|
[76611] | 114 | chcon -t java_exec_t "${MY_PATH}"/vboxwebsrv > /dev/null 2>&1
|
---|
| 115 | chcon -t bin_t "${MY_PATH}"/src/vboxhost/build_in_tmp \
|
---|
[58399] | 116 | > /dev/null 2>&1
|
---|
| 117 | chcon -t bin_t /usr/share/virtualbox/src/vboxhost/build_in_tmp \
|
---|
| 118 | > /dev/null 2>&1
|
---|
| 119 | fi
|
---|
| 120 |
|
---|
[76611] | 121 | test -n "${START}" &&
|
---|
[57712] | 122 | {
|
---|
[76611] | 123 | if ! "${MY_PATH}/vboxdrv.sh" setup; then
|
---|
| 124 | "${MY_PATH}/check_module_dependencies.sh" >&2
|
---|
[59883] | 125 | echo >&2
|
---|
| 126 | echo "There were problems setting up VirtualBox. To re-start the set-up process, run" >&2
|
---|
| 127 | echo " /sbin/vboxconfig" >&2
|
---|
[77196] | 128 | echo "as root. If your system is using EFI Secure Boot you may need to sign the" >&2
|
---|
| 129 | echo "kernel modules (vboxdrv, vboxnetflt, vboxnetadp, vboxpci) before you can load" >&2
|
---|
[78174] | 130 | echo "them. Please see your Linux system's documentation for more information." >&2
|
---|
[67053] | 131 | else
|
---|
| 132 | start_init_script vboxdrv
|
---|
[98680] | 133 | if [ -f ${MY_PATH}/vboxballoonctrl-service.sh ]; then
|
---|
| 134 | start_init_script vboxballoonctrl-service
|
---|
| 135 | fi
|
---|
| 136 | if [ -f ${MY_PATH}/vboxautostart-service.sh ]; then
|
---|
| 137 | start_init_script vboxautostart-service
|
---|
| 138 | fi
|
---|
[67053] | 139 | start_init_script vboxweb-service
|
---|
[59883] | 140 | fi
|
---|
[57712] | 141 | }
|
---|