VirtualBox

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

Last change on this file since 67053 was 67053, checked in by vboxsync, 8 years ago

bugref:8834: Makeself installers/Linux: indicate problems better in the exit codes
Do not attempt to start the services part of VirtualBox on Linux hosts if building the kernel modules fails. This makes it easier to test an installer failure path, as starting the services caused another build attempt to be started with default settings, which made it hard to cause a build failure.

  • 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 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.
29TARGET=`readlink -e -- "${0}"` || exit 1
30MY_PATH="${TARGET%/[!/]*}"
31cd "${MY_PATH}"
32. "./routines.sh"
33
34START=true
35while 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
46done
47
48# Remove any traces of DKMS from previous installations.
49for i in vboxhost vboxdrv vboxnetflt vboxnetadp; do
50 rm -rf "/var/lib/dkms/${i}"*
51done
52
53# Install runlevel scripts and systemd unit files
54install_init_script "${MY_PATH}/vboxdrv.sh" vboxdrv
55install_init_script "${MY_PATH}/vboxballoonctrl-service.sh" vboxballoonctrl-service
56install_init_script "${MY_PATH}/vboxautostart-service.sh" vboxautostart-service
57install_init_script "${MY_PATH}/vboxweb-service.sh" vboxweb-service
58
59delrunlevel vboxdrv
60addrunlevel vboxdrv
61delrunlevel vboxballoonctrl-service
62addrunlevel vboxballoonctrl-service
63delrunlevel vboxautostart-service
64addrunlevel vboxautostart-service
65delrunlevel vboxweb-service
66addrunlevel vboxweb-service
67
68ln -sf "${MY_PATH}/postinst-common.sh" /sbin/vboxconfig
69
70# Set SELinux permissions
71# XXX SELinux: allow text relocation entries
72if [ -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
95fi
96
97test -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}
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