VirtualBox

source: vbox/trunk/src/VBox/Installer/linux/postinst-common.sh@ 98278

Last change on this file since 98278 was 98103, checked in by vboxsync, 2 years ago

Copyright year updates by scm.

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 4.4 KB
Line 
1#!/bin/sh
2# $Id: postinst-common.sh 98103 2023-01-17 14:15:46Z vboxsync $
3## @file
4# Oracle VM VirtualBox
5# VirtualBox Linux post-installer common portions
6#
7
8#
9# Copyright (C) 2015-2023 Oracle and/or its affiliates.
10#
11# This file is part of VirtualBox base platform packages, as
12# available from https://www.virtualbox.org.
13#
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#
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
39# The below is GNU-specific. See VBox.sh for the longer Solaris/OS X version.
40TARGET=`readlink -e -- "${0}"` || exit 1
41MY_PATH="${TARGET%/[!/]*}"
42cd "${MY_PATH}"
43. "./routines.sh"
44
45START=true
46while test -n "${1}"; do
47 case "${1}" in
48 --nostart)
49 START=
50 ;;
51 *)
52 echo "Bad argument ${1}" >&2
53 exit 1
54 ;;
55 esac
56 shift
57done
58
59# Remove any traces of DKMS from previous installations.
60for i in vboxhost vboxdrv vboxnetflt vboxnetadp; do
61 rm -rf "/var/lib/dkms/${i}"*
62done
63
64# Install runlevel scripts and systemd unit files
65install_init_script "${MY_PATH}/vboxdrv.sh" vboxdrv
66install_init_script "${MY_PATH}/vboxballoonctrl-service.sh" vboxballoonctrl-service
67install_init_script "${MY_PATH}/vboxautostart-service.sh" vboxautostart-service
68install_init_script "${MY_PATH}/vboxweb-service.sh" vboxweb-service
69finish_init_script_install
70
71delrunlevel vboxdrv
72addrunlevel vboxdrv
73delrunlevel vboxballoonctrl-service
74addrunlevel vboxballoonctrl-service
75delrunlevel vboxautostart-service
76addrunlevel vboxautostart-service
77delrunlevel vboxweb-service
78addrunlevel vboxweb-service
79
80ln -sf "${MY_PATH}/postinst-common.sh" /sbin/vboxconfig
81
82# Set SELinux permissions
83# XXX SELinux: allow text relocation entries
84if [ -x /usr/bin/chcon ]; then
85 chcon -t texrel_shlib_t "${MY_PATH}"/*VBox* > /dev/null 2>&1
86 chcon -t texrel_shlib_t "${MY_PATH}"/VBoxAuth.so \
87 > /dev/null 2>&1
88 chcon -t texrel_shlib_t "${MY_PATH}"/VirtualBox.so \
89 > /dev/null 2>&1
90 chcon -t texrel_shlib_t "${MY_PATH}"/components/VBox*.so \
91 > /dev/null 2>&1
92 chcon -t java_exec_t "${MY_PATH}"/VirtualBox > /dev/null 2>&1
93 chcon -t java_exec_t "${MY_PATH}"/VBoxSDL > /dev/null 2>&1
94 chcon -t java_exec_t "${MY_PATH}"/VBoxHeadless \
95 > /dev/null 2>&1
96 chcon -t java_exec_t "${MY_PATH}"/VBoxNetDHCP \
97 > /dev/null 2>&1
98 chcon -t java_exec_t "${MY_PATH}"/VBoxNetNAT \
99 > /dev/null 2>&1
100 chcon -t java_exec_t "${MY_PATH}"/VBoxExtPackHelperApp \
101 > /dev/null 2>&1
102 chcon -t java_exec_t "${MY_PATH}"/vboxwebsrv > /dev/null 2>&1
103 chcon -t bin_t "${MY_PATH}"/src/vboxhost/build_in_tmp \
104 > /dev/null 2>&1
105 chcon -t bin_t /usr/share/virtualbox/src/vboxhost/build_in_tmp \
106 > /dev/null 2>&1
107fi
108
109test -n "${START}" &&
110{
111 if ! "${MY_PATH}/vboxdrv.sh" setup; then
112 "${MY_PATH}/check_module_dependencies.sh" >&2
113 echo >&2
114 echo "There were problems setting up VirtualBox. To re-start the set-up process, run" >&2
115 echo " /sbin/vboxconfig" >&2
116 echo "as root. If your system is using EFI Secure Boot you may need to sign the" >&2
117 echo "kernel modules (vboxdrv, vboxnetflt, vboxnetadp, vboxpci) before you can load" >&2
118 echo "them. Please see your Linux system's documentation for more information." >&2
119 else
120 start_init_script vboxdrv
121 start_init_script vboxballoonctrl-service
122 start_init_script vboxautostart-service
123 start_init_script vboxweb-service
124 fi
125}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette