VirtualBox

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

Last change on this file since 72096 was 69500, checked in by vboxsync, 7 years ago

*: scm --update-copyright-year

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