VirtualBox

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

Last change on this file since 103131 was 98681, checked in by vboxsync, 20 months ago

Installer/*: Similar adjustments for VBOX_WITH_WEBSERVICES. Fix for solaris typo two commits back. bugref:10030

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 4.9 KB
Line 
1#!/bin/sh
2# $Id: postinst-common.sh 98681 2023-02-21 16:01:22Z 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
66if [ -f ${MY_PATH}/vboxballoonctrl-service.sh ]; then
67 install_init_script "${MY_PATH}/vboxballoonctrl-service.sh" vboxballoonctrl-service
68fi
69if [ -f ${MY_PATH}/vboxautostart-service.sh ]; then
70 install_init_script "${MY_PATH}/vboxautostart-service.sh" vboxautostart-service
71fi
72if [ -f ${MY_PATH}/vboxweb-service.sh ]; then
73 install_init_script "${MY_PATH}/vboxweb-service.sh" vboxweb-service
74fi
75finish_init_script_install
76
77delrunlevel vboxdrv
78addrunlevel vboxdrv
79delrunlevel vboxballoonctrl-service
80if [ -f ${MY_PATH}/vboxballoonctrl-service.sh ]; then
81 addrunlevel vboxballoonctrl-service
82fi
83delrunlevel vboxautostart-service
84if [ -f ${MY_PATH}/vboxautostart-service.sh ]; then
85 addrunlevel vboxautostart-service
86fi
87delrunlevel vboxweb-service
88if [ -f ${MY_PATH}/vboxweb-service.sh ]; then
89 addrunlevel vboxweb-service
90fi
91
92ln -sf "${MY_PATH}/postinst-common.sh" /sbin/vboxconfig
93
94# Set SELinux permissions
95# XXX SELinux: allow text relocation entries
96if [ -x /usr/bin/chcon ]; then
97 chcon -t texrel_shlib_t "${MY_PATH}"/*VBox* > /dev/null 2>&1
98 chcon -t texrel_shlib_t "${MY_PATH}"/VBoxAuth.so \
99 > /dev/null 2>&1
100 chcon -t texrel_shlib_t "${MY_PATH}"/VirtualBox.so \
101 > /dev/null 2>&1
102 chcon -t texrel_shlib_t "${MY_PATH}"/components/VBox*.so \
103 > /dev/null 2>&1
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 \
107 > /dev/null 2>&1
108 chcon -t java_exec_t "${MY_PATH}"/VBoxNetDHCP \
109 > /dev/null 2>&1
110 chcon -t java_exec_t "${MY_PATH}"/VBoxNetNAT \
111 > /dev/null 2>&1
112 chcon -t java_exec_t "${MY_PATH}"/VBoxExtPackHelperApp \
113 > /dev/null 2>&1
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 \
116 > /dev/null 2>&1
117 chcon -t bin_t /usr/share/virtualbox/src/vboxhost/build_in_tmp \
118 > /dev/null 2>&1
119fi
120
121test -n "${START}" &&
122{
123 if ! "${MY_PATH}/vboxdrv.sh" setup; then
124 "${MY_PATH}/check_module_dependencies.sh" >&2
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
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
130 echo "them. Please see your Linux system's documentation for more information." >&2
131 else
132 start_init_script vboxdrv
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
139 start_init_script vboxweb-service
140 fi
141}
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