diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2014-03-26 19:21:20 +0000 |
---|---|---|
committer | <> | 2014-05-08 15:03:54 +0000 |
commit | fb123f93f9f5ce42c8e5785d2f8e0edaf951740e (patch) | |
tree | c2103d76aec5f1f10892cd1d3a38e24f665ae5db /src/VBox/Installer/linux/scripts | |
parent | 58ed4748338f9466599adfc8a9171280ed99e23f (diff) | |
download | VirtualBox-master.tar.gz |
Imported from /home/lorry/working-area/delta_VirtualBox/VirtualBox-4.3.10.tar.bz2.HEADVirtualBox-4.3.10master
Diffstat (limited to 'src/VBox/Installer/linux/scripts')
-rwxr-xr-x | src/VBox/Installer/linux/scripts/VBoxHeadlessXOrg.sh | 379 | ||||
-rwxr-xr-x | src/VBox/Installer/linux/scripts/check_module_dependencies.sh | 488 | ||||
-rwxr-xr-x | src/VBox/Installer/linux/scripts/install.sh | 270 |
3 files changed, 1137 insertions, 0 deletions
diff --git a/src/VBox/Installer/linux/scripts/VBoxHeadlessXOrg.sh b/src/VBox/Installer/linux/scripts/VBoxHeadlessXOrg.sh new file mode 100755 index 00000000..fd76d1ea --- /dev/null +++ b/src/VBox/Installer/linux/scripts/VBoxHeadlessXOrg.sh @@ -0,0 +1,379 @@ +#!/bin/sh +# $Id: VBoxHeadlessXOrg.sh $ +# +# VirtualBox X Server auto-start service. +# +# Copyright (C) 2012-2013 Oracle Corporation +# +# This file is part of VirtualBox Open Source Edition (OSE), as +# available from http://www.virtualbox.org. This file is free software; +# you can redistribute it and/or modify it under the terms of the GNU +# General Public License (GPL) as published by the Free Software +# Foundation, in version 2 as it comes in the "COPYING" file of the +# VirtualBox OSE distribution. VirtualBox OSE is distributed in the +# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. +# + +PATH=$PATH:/bin:/sbin:/usr/sbin + +## Start one or several X servers in the background for use with headless +# rendering. For details, options and configuration see the usage() function +# further down. +# +# I have tried to follow the best practices I could find for writing a Linux +# service (and doing it in shell script) which should work well with +# traditional and modern service systems using minimal init or service files. +# In our case this boils down to: +# * Start with a single command line, stop using one of ${EXIT_SIGNALS} below. +# * Stopping with a signal can be done safely using the pid stored in the +# pid-file and our (presumably unique) command name. For this reason we +# only support running one instance of the service though. +# * Start in the foreground. Systems without proper service control can take +# care of the backgrounding in the init script. +# * Clean up all sub-processes (X servers) ourselves when we are stopped +# cleanly and don't provide any other way to clean them up automatically (in +# case we are stopped uncleanly) as we don't know of a generic safe way to +# do so, though some service management systems (i.e. systemd) can do so. +# (A more thorough automatic clean-up would be possible if Xorg didn't +# potentially have to be run as root, so that we could run all processes +# using a service-specific user account and just terminate all processes +# run by that user to clean up.) + +## Default configuration file name. +# @note This is not very nice - /etc/default is actually Debian-specific. +CONFIGURATION_FILE=/etc/default/virtualbox +## The name of this script. +SCRIPT_NAME="$0" +## The service name. +SERVICE_NAME="vboxheadlessxorg" +## The service description. +SERVICE_DESCRIPTION="Headless rendering service" +## Signals and conditions which may be used to terminate the service. +EXIT_SIGNALS="EXIT HUP INT QUIT ABRT TERM" +## The default run-time data folder. +DEFAULT_RUN_FOLDER="/var/run/${SERVICE_NAME}/" +## The default X server configuration directory. +DEFAULT_CONFIGURATION_FOLDER="${DEFAULT_RUN_FOLDER}/xorg.conf.d/" +## The extra data key used to provide the list of available X server displays. +EXTRA_DATA_KEY_DISPLAYS="HeadlessXServer/Displays" +## The extra data key used to specify the X server authority file. +EXTRA_DATA_KEY_AUTH="HeadlessXServer/AuthFile" + +## Print usage information for the service script. +## @todo Perhaps we should support some of the configuration file options from +# the command line. Opinions welcome. +## @todo Possibly extract this information for the user manual. +usage() { + cat << EOF +Usage: + + $(basename "${SCRIPT_NAME}") [<options>] + +Start one or several X servers in the background for use with headless +rendering. We only support X.Org Server at the moment. On service start-up available graphics devices are detected and an X server configuration file is +generated for each. We attempt to start an X server process for each +configuration file. The process is configurable by setting values in a file as +described below. + +Options: + + -c|--conf-file Specify an alternative locations for the configuration + file. The default location is: + "${CONFIGURATION_FILE}" + + --install Install the service to run at system start-up. + + --uninstall Revert the installation done by the "--install" option. + + --help|--usage Print this text. + +The optional configuration file should contain a series of lines of the form +"KEY=value". It will be read in as a command shell sub-script. Here is the +current list of possible key settings with a short explanation. Usually it +should be sufficient to change the value of \${HEADLESS_X_ORG_USERS} and to +leave all other settings unchanged. + + HEADLESS_X_ORG_CONFIGURATION_FOLDER + The folder where the X server configuration files are to be created. + + HEADLESS_X_ORG_LOG_FOLDER + The folder where log files will be saved. + + HEADLESS_X_ORG_LOG_FILE + The main log file name. + + HEADLESS_X_ORG_RUN_FOLDER + The folder to store run-time data in. + + HEADLESS_X_ORG_WAIT_FOR_PREREQUISITES + Command to execute to wait until all dependencies for the X servers are + available. The default command waits until the udev event queue has + settled. The command may return failure to signal that it has given up. + No arguments may be passsed. + + HEADLESS_X_ORG_USERS + List of users who will have access to the X servers started and for whom we + will provide the configuration details via VirtualBox extra data. This + variable is only used by the commands in the default configuration + (\${HEADLESS_X_ORG_SERVER_PRE_COMMAND} and + \${HEADLESS_X_ORG_SERVER_POST_COMMAND}), and not by the service itself. + + HEADLESS_X_ORG_FIRST_DISPLAY + The first display number which will be used for a started X server. The + others will use the following numbers. + + HEADLESS_X_ORG_SERVER_PRE_COMMAND + Command to execute once to perform any set-up needed before starting the + X servers, such as setting up the X server authentication. The default + command creates an authority file for each of the users in the list + \${HEADLESS_X_ORG_USERS} and generates server configuration files for all + detected graphics cards. No arguments may be passed. + + HEADLESS_X_ORG_SERVER_COMMAND + The default X server start-up command. It will be passed three parameters + - in order, the screen number to use, the path of the X.Org configuration + file to use and the path of the X server log file to create. + + HEADLESS_X_ORG_SERVER_POST_COMMAND + Command to execute once the X servers have been successfully started. It + will be passed a single parameter which is a space-separated list of the + X server screen numbers. By default this stores the service configuration + information to VirtualBox extra data for each of the users in the list + from the variable HEADLESS_X_ORG_USERS: the list of displays is set to the + key "${EXTRA_DATA_KEY_DISPLAYS}" and the path of the authority file to + "${EXTRA_DATA_KEY_AUTH}". +EOF +} + +# Default configuration. +HEADLESS_X_ORG_CONFIGURATION_FOLDER="${DEFAULT_CONFIGURATION_FOLDER}" +HEADLESS_X_ORG_LOG_FOLDER="/var/log/${SERVICE_NAME}" +HEADLESS_X_ORG_LOG_FILE="${SERVICE_NAME}.log" +HEADLESS_X_ORG_RUN_FOLDER="/var/run/${SERVICE_NAME}" +HEADLESS_X_ORG_USERS="" +HEADLESS_X_ORG_FIRST_DISPLAY=40 +X_AUTH_FILE="${HEADLESS_X_ORG_RUN_FOLDER}/xauth" + +default_wait_for_prerequisites() +{ + udevadm settle || udevsettle # Fails if no udevadm. +} +HEADLESS_X_ORG_WAIT_FOR_PREREQUISITES="default_wait_for_prerequisites" + +default_pre_command() +{ + # Create new authority file. + echo > "${X_AUTH_FILE}" + # Create the xorg.conf files. + mkdir -p "${HEADLESS_X_ORG_CONFIGURATION_FOLDER}" || return 1 + display="${HEADLESS_X_ORG_FIRST_DISPLAY}" + for i in /sys/bus/pci/devices/*; do + read class < "${i}/class" + case "${class}" in *03????) + address="${i##*/}" + address="${address%%:*}${address#*:}" + address="PCI:${address%%.*}:${address#*.}" + read vendor < "${i}/vendor" + case "${vendor}" in *10de|*10DE) # NVIDIA + cat > "${HEADLESS_X_ORG_CONFIGURATION_FOLDER}/xorg.conf.${display}" << EOF +Section "Module" + Load "glx" +EndSection +Section "Device" + Identifier "Device${display}" + Driver "nvidia" + Option "UseDisplayDevice" "none" +EndSection +Section "Screen" + Identifier "Screen${display}" + Device "Device${display}" +EndSection +Section "ServerLayout" + Identifier "Layout${display}" + Screen "Screen${display}" + Option "AllowMouseOpenFail" "true" + Option "AutoAddDevices" "false" + Option "AutoAddGPU" "false" + Option "AutoEnableDevices" "false" + Option "IsolateDevice" "${address}" +EndSection +EOF + esac + # Add key to the authority file. + key="$(dd if=/dev/urandom count=1 bs=16 2>/dev/null | od -An -x)" + xauth -f "${X_AUTH_FILE}" add :${display} . "${key}" + display=`expr ${display} + 1` + esac + done + # Duplicate the authority file. + for i in ${HEADLESS_X_ORG_USERS}; do + cp "${X_AUTH_FILE}" "${X_AUTH_FILE}.${i}" + chown "${i}" "${X_AUTH_FILE}.${i}" + done +} +HEADLESS_X_ORG_SERVER_PRE_COMMAND="default_pre_command" + +default_command() +{ + auth="${HEADLESS_X_ORG_RUN_FOLDER}/xauth" + # screen=$1 + # conf_file=$2 + # log_file=$3 + trap "kill \${PID}; sleep 5; kill -KILL \${PID} 2>/dev/null" ${EXIT_SIGNALS} + Xorg :"${1}" -auth "${auth}" -config "${2}" -logverbose 0 -logfile /dev/null -verbose 7 > "${3}" 2>&1 & + PID="$!" + wait + exit +} +HEADLESS_X_ORG_SERVER_COMMAND="default_command" + +default_post_command() +{ + # screens=$1 + for i in ${HEADLESS_X_ORG_USERS}; do + su ${i} -c "VBoxManage setextradata global ${EXTRA_DATA_KEY_DISPLAYS} \"${1}\"" + su ${i} -c "VBoxManage setextradata global ${EXTRA_DATA_KEY_AUTH} \"${HEADLESS_X_ORG_RUN_FOLDER}/xauth\"" + done +} +HEADLESS_X_ORG_SERVER_POST_COMMAND="default_post_command" + +## The function definition at the start of every non-trivial shell script! +abort() { + ## $@, ... Error text to output to standard error in printf format. + printf "$@" >&2 + exit 1 +} + +## Milder version of abort, when we can't continue because of a valid condition. +abandon() { + ## $@, ... Text to output to standard error in printf format. + printf "$@" >&2 + exit 0 +} + +abort_usage() { + usage >&2 + abort "$@" +} + +# Print a banner message +banner() { + cat << EOF +${VBOX_PRODUCT} VBoxHeadless X Server start-up service Version ${VBOX_VERSION_STRING} +(C) 2005-${VBOX_C_YEAR} ${VBOX_VENDOR} +All rights reserved. + +EOF +} + +# Get the directory where the script is located. +SCRIPT_FOLDER=$(dirname "${SCRIPT_NAME}")"/" +[ -r "${SCRIPT_FOLDER}generated.sh" ] || + abort "${LOG_FILE}" "Failed to find installation information.\n" +. "${SCRIPT_FOLDER}generated.sh" + +# Parse our arguments. +do_install="" +while [ "$#" -gt 0 ]; do + case $1 in + -c|--conf-file) + [ "$#" -gt 1 ] || + { + banner + abort "%s requires at least one argument.\n" "$1" + } + CONFIGURATION_FILE="$2" + shift + ;; + --help|--usage) + banner + usage + exit 0 + ;; + --install) + do_install="install" + ;; + --uninstall) + do_install="uninstall" + ;; + *) + banner + abort_usage "Unknown argument $1.\n" + ;; + esac + shift +done + +[ -r "${CONFIGURATION_FILE}" ] && . "${CONFIGURATION_FILE}" + +if [ -n "${do_install}" ]; then + SCRIPT_FOLDER=$(cd "${SCRIPT_FOLDER}" && pwd)"/" + CONFIGURATION_FILE_ESCAPED=$(echo "${CONFIGURATION_FILE}" | sed 's/\([ \%]\)/\\\1/g') + if [ "x${do_install}" = "xinstall" ]; then + ${SCRIPT_FOLDER}install_service --enable -- --command "${SCRIPT_FOLDER}"$(basename "${SCRIPT_NAME}") --arguments "--conf-file ${CONFIGURATION_FILE_ESCAPED}" --service-name "${SERVICE_NAME}" --description "${SERVICE_DESCRIPTION}" + else + ${SCRIPT_FOLDER}install_service --remove -- --service-name "${SERVICE_NAME}" + fi + exit 0 +fi + +# Change to the root directory so we don't hold any other open. +cd / + +# If something fails here we will catch it when we create the directory. +[ -e "${HEADLESS_X_ORG_LOG_FOLDER}" ] && + [ -d "${HEADLESS_X_ORG_LOG_FOLDER}" ] && + rm -rf "${HEADLESS_X_ORG_LOG_FOLDER}.old" 2> /dev/null && +mv "${HEADLESS_X_ORG_LOG_FOLDER}" "${HEADLESS_X_ORG_LOG_FOLDER}.old" 2> /dev/null +mkdir -p "${HEADLESS_X_ORG_LOG_FOLDER}" 2>/dev/null || +{ + banner + abort "Failed to create log folder \"${HEADLESS_X_ORG_LOG_FOLDER}\".\n" +} +mkdir -p "${HEADLESS_X_ORG_RUN_FOLDER}" 2>/dev/null || +{ + banner + abort "Failed to create run folder \"${HEADLESS_X_ORG_RUN_FOLDER}\".\n" +} +exec > "${HEADLESS_X_ORG_LOG_FOLDER}/${HEADLESS_X_ORG_LOG_FILE}" 2>&1 + +banner + +# Wait for our dependencies to become available. +if [ -n "${HEADLESS_X_ORG_WAIT_FOR_PREREQUISITES}" ]; then + "${HEADLESS_X_ORG_WAIT_FOR_PREREQUISITES}" || + abort "Service prerequisites not available.\n" +fi + +# Do any pre-start setup. +if [ -n "${HEADLESS_X_ORG_SERVER_PRE_COMMAND}" ]; then + "${HEADLESS_X_ORG_SERVER_PRE_COMMAND}" || + abort "Pre-requisite failed.\n" +fi + +X_SERVER_PIDS="" +X_SERVER_SCREENS="" +trap "kill \${X_SERVER_PIDS} 2>/dev/null" ${EXIT_SIGNALS} +space="" # Hack to put spaces between the pids but not before or after. +for conf_file in "${HEADLESS_X_ORG_CONFIGURATION_FOLDER}"/*; do + [ x"${conf_file}" = x"${HEADLESS_X_ORG_CONFIGURATION_FOLDER}/*" ] && + ! [ -e "${conf_file}" ] && + abort "No configuration files found.\n" + filename="$(basename "${conf_file}")" + screen="$(expr "${filename}" : "xorg\.conf\.\(.*\)")" + [ 0 -le "${screen}" ] 2>/dev/null || + abort "Badly formed file name \"${conf_file}\".\n" + log_file="${HEADLESS_X_ORG_LOG_FOLDER}/Xorg.${screen}.log" + "${HEADLESS_X_ORG_SERVER_COMMAND}" "${screen}" "${conf_file}" "${log_file}" & + X_SERVER_PIDS="${X_SERVER_PIDS}${space}$!" + X_SERVER_SCREENS="${X_SERVER_SCREENS}${space}${screen}" + space=" " +done + +# Do any post-start work. +if [ -n "${HEADLESS_X_ORG_SERVER_POST_COMMAND}" ]; then + "${HEADLESS_X_ORG_SERVER_POST_COMMAND}" "${X_SERVER_SCREENS}" || + abort "Post-command failed.\n" +fi + +wait diff --git a/src/VBox/Installer/linux/scripts/check_module_dependencies.sh b/src/VBox/Installer/linux/scripts/check_module_dependencies.sh new file mode 100755 index 00000000..b3baf039 --- /dev/null +++ b/src/VBox/Installer/linux/scripts/check_module_dependencies.sh @@ -0,0 +1,488 @@ +#!/bin/sh +# +# Oracle VM VirtualBox +# VirtualBox linux installation script + +# +# Copyright (C) 2007-2012 Oracle Corporation +# +# This file is part of VirtualBox Open Source Edition (OSE), as +# available from http://www.virtualbox.org. This file is free software; +# you can redistribute it and/or modify it under the terms of the GNU +# General Public License (GPL) as published by the Free Software +# Foundation, in version 2 as it comes in the "COPYING" file of the +# VirtualBox OSE distribution. VirtualBox OSE is distributed in the +# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. +# + +# This script tests whether a Linux system is set up to build kernel modules, +# and if not attempts to discover and optionally perform the necessary steps to +# set up the system correctly, based on knowledge of popular Linux +# distributions. It is written for use with the VirtualBox and the VirtualBox +# Guest Additions kernel modules but should be useful for any package which +# needs to build kernel modules on an unknown target system. While patches to +# extend the range of distributions supported are welcome, please bear in mind +# that we try to keep distribution-specific parts as small as possible, and to +# cover as many distributions as possible in single "families". Any +# distribution which requires specific code to support should be sufficiently +# widely used to justify the addition. + +PATH=$PATH:/bin:/sbin:/usr/sbin + +## @todo include routines.sh once it has been cleaned up + +## Set all commands used in the script to their normal values. These are the +# script's interface to the outside world and should be overridden for self +# testing. +set_up_helpers() +{ + exit=exit + get_kernel_version="uname -r" + file_exists="test -f" + string_in_file="grep -q -s" + do_type=type + find_rpm_for_file="rpm -q --whatprovides" + find_deb_for_file="dpkg -S" +} + + +## uname -r stand-in for self testing +test_get_kernel_version() +{ + echo "$test_uname_r"; +} + + +## test -f $1 or grep $1 $2 stand-in for self testing +test_file_exists() +{ + test '(' -z "$2" -a "$test_test_f" = "$1" ')' -o \ + '(' "$test_grep_string" = "$1" -a "$test_grep_file" = "$2" ')'; +} + + +## rpm -q --whatprovides stand-in for self testing +test_find_rpm_for_file() +{ + echo "$test_rpm_q"; +} + + +## exit stand-in for self testing +test_exit() +{ + test_exit_return="$1"; +} + + +## dpkg -S stand-in for self testing +test_find_deb_for_file() +{ + echo "$test_dpkg_s"; +} + + +## type stand-in for self testing +test_type() +{ + test "$1" = "$test_type_binary" && echo "$test_type_binary"; +} + + +## Evaluate a line describing the results of a self test. Outputs a line of +# text describing each failure. +eval_test_line() +{ + ## @param test_line The test description line to evaluate in the + # format: + # "<line num>: <variable to set>=<value> ...=><variable to check>=<expected value>..." + # All output variables will be nulled first. Unused + # "variables to set" should be explicitly set to + # null in the list. Spaces in variable names are + # not allowed, in values they can be escaped with + # backslash, and "=>" can be embedded as "=\>". + test_line="$1" + ## @param test_function The function to call after setting the variables + # from the test line + test_function="$2" + + line_num=${test_line%%:*=>*} + env_all=${test_line#*:} + env_in=${env_all%%=>*} + env_out=${env_all#*=>} + # Blank out output variables first. + eval set $env_out # Trick for dealing with escaped embedded spaces. + for j in "$@"; do + var_name="${j%%=*}" + eval $var_name= + done + # Set input variables. + eval set $env_in + for j in "$@"; do + var_name=${j%%=*} + var_value="${j#*=}" + eval $var_name=\"$var_value\" # More tricks + done + eval $test_function + eval set $env_out + for j in "$@"; do + var_name=${j%%=*} + var_value="$(eval echo \$$var_name)" + var_expected="${j#*=}" + case $var_value in + $var_expected) ;; + *) + echo "$test_function: failure: $var_name=$var_value in line $line_num" + ;; + esac + done +} + + +## List of tests to be executed in a test run +self_tests= + + +## Aborts the script and prints a printf-type error message to stderr. +abort() +{ + ## Message to print to stderr before aborting. + message="$1" + + echo 1>&2 "$message" + echo 1>&2 "Unable to continue." + $exit 1 +} + + +## Abort if we are not running as root +check_root() { + case $(id -u) in 0) ;; *) + abort "This program must be run with administrator privileges." + esac +} + + +## Get information about the kernel running on the system (version and path +# information). +# @param KERN_VER [out] Full kernel version (e.g. 3.0.0-15-generic). +# @param KERN_VER_BASE [out] Base kernel version (e.g. 3.0.0). +# @param KERN_VER_SHORT [out] Kernel major and minor version (e.g. 3.0). +# @param KERN_VER_EXTRA [out] Kernel version "extra" information (e.g. +# -15-generic). +# @param KERN_DIR [out] The directory where kernel modules and headers +# live (e.g. /lib/modules/3.0.0-15-generic) +get_kernel_information() +{ + KERN_VER=$($get_kernel_version 2>/dev/null || abort "'uname' tool not found.") + kern_ver_rest=${KERN_VER#*.*.} + kern_ver_micro=${kern_ver_rest%%[!0-9]*} + KERN_VER_EXTRA=${kern_ver_rest#$kern_ver_micro} + KERN_VER_BASE=${KERN_VER%$KERN_VER_EXTRA} + KERN_VER_SHORT=${KERN_VER_BASE%.*} + KERN_DIR="/lib/modules/$KERN_VER" +} + + +## Self test for the "get_kernel_information" function. Outputs a line of +# text describing each failure. +test_get_kernel_information() +{ + get_kernel_version=test_get_kernel_version + for i in \ + "1: test_uname_r=3.0.0-15-generic=>KERN_VER=3.0.0-15-generic KERN_VER_BASE=3.0.0 KERN_VER_SHORT=3.0 KERN_VER_EXTRA=-15-generic KERN_DIR=/lib/modules/3.0.0-15-generic" \ + "2: test_uname_r=2.4.21-50.EL=>KERN_VER=2.4.21-50.EL KERN_VER_BASE=2.4.21 KERN_VER_SHORT=2.4 KERN_VER_EXTRA=-50.EL KERN_DIR=/lib/modules/2.4.21-50.EL" + do eval_test_line "$i" get_kernel_information; done +} + +self_tests="$self_tests test_get_kernel_information" + + +## Test whether a three-digit kernel version number is less than a second one. +kernel_version_lt() +{ + major1=${1%.*.*} + major2=${2%.*.*} + short1=${1%.*} + short2=${2%.*} + minor1=${short1#*.} + minor2=${short2#*.} + micro1=${1#*.*.} + micro2=${2#*.*.} + test $major1 -lt $major2 -o \ + '(' $major1 -eq $major2 -a $minor1 -lt $minor2 ')' -o \ + '(' $major1 -eq $major2 -a $minor1 -eq $minor2 -a $micro1 -lt $micro2 ')' +} + + +## Self test for the "kernel_version_lt" function. Outputs a line of +# text describing each failure. +test_kernel_version_lt() +{ + for i in \ + "1: ver1=2.4.6 ver2=3.4.6 =>lt=true" \ + "2: ver1=3.4.6 ver2=3.4.6 =>lt=" \ + "3: ver1=2.4.6 ver2=2.4.7 =>lt=true" \ + "4: ver1=2.4.60 ver2=2.4.7 =>lt=" \ + "5: ver1=2.31.7 ver2=2.4.7 =>lt=" + do eval_test_line "$i" "kernel_version_lt \$ver1 \$ver2 && lt=true"; done +} + +self_tests="$self_tests test_kernel_version_lt" + + +# Some SUSE systems match three packages to the kernel directory. Selecting +# the first is not quite right, but doesn't matter on those systems. +FIND_KERNEL_RPM='rpm_q_out=$(echo $($find_rpm_for_file "$KERN_DIR/kernel")); KERN_PACKAGE=${rpm_q_out%%\ *}' +FIND_KERNEL_DEB='dpkg_s_out=$($find_deb_for_file "$KERN_DIR/kernel"); KERN_PACKAGE=${dpkg_s_out%\: $KERN_DIR/kernel}' + + +## Determine the command patterns needed to install gcc, make and the kernel +# headers on the current distribution. +# @note We want to support the distributions we do with the least possible +# special logic, so please do not add new code if existing code can +# catch a new distribution (e.g. it is similar to another). +# @note This function is very long, but contains nearly all the distribution- +# specific logic in the file. +# @param KERN_VER_BASE The three-point kernel version. +# @param GET_KERN_PACKAGE [out] Command to find the kernel package name +# given the path $KERN_DIR. +# @param PATTERN_GCC_MAKE [out] A pattern to be resolved to get the +# command to install gcc and make. +# @param PATTERN_HEADERS [out] A pattern to be resolved to get the +# command to install the kernel headers for +# the currently running kernel. +# @param PATTERN_HEADERS_META [out] A pattern to be resolved to get the +# command to install a dependency on the +# current kernel headers. May be empty. +# @note These patterns may all depend on $KERN_VER (uname -r output), +# $KERN_PACKAGE_BASE (distribution kernel package name without any +# version information at all), $KERN_DEBIAN_SUFFIX (the Debian-style +# "-generic", "-586" etc kernel name suffix) and $KERN_RPM_SUFFIX +# (the kernel-version-plus-rpm-version for the current kernel RPM). +get_system_information() +{ + # SUSE and Man*/Mageia must come before Redhat. + if $file_exists /etc/SuSE-release; then # SUSE-based, before Red Hat + GET_KERN_PACKAGE="$FIND_KERNEL_RPM" + PATTERN_GCC_MAKE='zypper\ install\ gcc\ make' + if kernel_version_lt "$KERN_VER_BASE" '2.6.30'; then + PATTERN_HEADERS='zypper\ install\ kernel-source-$KERN_RPM_SUFFIX\ kernel-syms-$KERN_RPM_SUFFIX' + PATTERN_HEADERS_META='zypper\ install\ kernel-source\ kernel-syms' + else + PATTERN_HEADERS='zypper\ install\ ${KERN_PACKAGE_BASE}devel-$KERN_RPM_SUFFIX' + PATTERN_HEADERS_META='zypper\ install\ ${KERN_PACKAGE_BASE}devel' + fi + elif $file_exists /etc/pclinuxos-release; then # PCLinuxOS - before Mandrake + GET_KERN_PACKAGE= + PATTERN_GCC_MAKE= + PATTERN_HEADERS= + PATTERN_HEADERS_META= + elif $file_exists /etc/mandrake-release; then # Mandrake family + GET_KERN_PACKAGE="$FIND_KERNEL_RPM" + PATTERN_GCC_MAKE='urpmi\ gcc\ make' + if kernel_version_lt "$KERN_VER_BASE" '2.6.0'; then + PATTERN_HEADERS='urpmi\ kernel-source-$KERN_VER' + PATTERN_HEADERS_META='urpmi\ kernel-source' + elif kernel_version_lt "$KERN_VER_BASE" '2.6.8'; then + PATTERN_HEADERS='urpmi\ kernel-source-stripped-$KERN_VER' + PATTERN_HEADERS_META='urpmi\ kernel-source-stripped' + # Mandrake/Mandriva had a funny naming scheme for a few kernel versions + elif kernel_version_lt "$KERN_VER_BASE" '2.6.17'; then + PATTERN_HEADERS='urpmi\ kernel-source-stripped-2.6-${KERN_VER%-*}' + PATTERN_HEADERS_META='urpmi\ kernel-source-stripped-2.6' + elif kernel_version_lt "$KERN_VER_BASE" '2.6.22'; then + PATTERN_HEADERS='urpmi\ kernel-source-stripped-$KERN_RPM_SUFFIX' + PATTERN_HEADERS_META='urpmi\ kernel-source-stripped-latest' + else + PATTERN_HEADERS='urpmi\ ${KERN_PACKAGE_BASE}devel-$KERN_RPM_SUFFIX' + PATTERN_HEADERS_META='urpmi\ ${KERN_PACKAGE_BASE}devel-latest' + fi + elif $file_exists /etc/redhat-release; then # Red Hat family + GET_KERN_PACKAGE="$FIND_KERNEL_RPM" + if $do_type yum >/dev/null 2>&1; then + PACKAGE_INSTALLER="yum install" + else + PACKAGE_INSTALLER=up2date + fi + PATTERN_GCC_MAKE='$PACKAGE_INSTALLER\ gcc\ make' + if kernel_version_lt "$KERN_VER_BASE" '2.6.9'; then + PATTERN_HEADERS='$PACKAGE_INSTALLER\ kernel-source-$KERN_RPM_SUFFIX' + PATTERN_HEADERS_META='$PACKAGE_INSTALLER\ kernel-source' + else + PATTERN_HEADERS='$PACKAGE_INSTALLER\ ${KERN_PACKAGE_BASE}devel-$KERN_RPM_SUFFIX' + PATTERN_HEADERS_META='$PACKAGE_INSTALLER\ ${KERN_PACKAGE_BASE}devel' + fi + # Ubuntu must come before Debian. + elif $string_in_file Ubuntu /etc/lsb-release; then # Ubuntu before Debian + GET_KERN_PACKAGE="$FIND_KERNEL_DEB" + PATTERN_GCC_MAKE='apt-get\ install\ gcc\ make' + if kernel_version_lt "$KERN_VER_BASE" '2.6.9'; then + PATTERN_HEADERS='apt-get\ install\ ${KERN_PACKAGE_BASE%-image*}-headers-$KERN_VER_SHORT$KERN_VER' + PATTERN_HEADERS_META='apt-get\ install\ ${KERN_PACKAGE_BASE%-image*}-headers-$KERN_VER_SHORT$KERN_DEBIAN_SUFFIX' + else + PATTERN_HEADERS='apt-get\ install\ ${KERN_PACKAGE_BASE%-image*}-headers-$KERN_VER' + PATTERN_HEADERS_META='apt-get\ install\ ${KERN_PACKAGE_BASE%-image*}-headers$KERN_DEBIAN_SUFFIX' + fi + elif $file_exists /etc/debian_version; then # Debian family + GET_KERN_PACKAGE="$FIND_KERNEL_DEB" + PATTERN_GCC_MAKE='apt-get\ install\ gcc\ make' + if kernel_version_lt "$KERN_VER_BASE" '2.4.17'; then + PATTERN_HEADERS='apt-get\ install\ ${KERN_PACKAGE_BASE%-image*}-headers-$KERN_VER' + PATTERN_HEADERS_META= + elif kernel_version_lt "$KERN_VER_BASE" '3.0.0'; then + PATTERN_HEADERS='apt-get\ install\ ${KERN_PACKAGE_BASE%-image*}-headers-$KERN_VER' + PATTERN_HEADERS_META='apt-get\ install\ ${KERN_PACKAGE_BASE%-image*}-headers-$KERN_VER_SHORT$KERN_DEBIAN_SUFFIX' + else + PATTERN_HEADERS='apt-get\ install\ ${KERN_PACKAGE_BASE%-image*}-headers-$KERN_VER' + PATTERN_HEADERS_META='apt-get\ install\ ${KERN_PACKAGE_BASE%-image*}-headers$KERN_DEBIAN_SUFFIX' + fi + elif $file_exists /etc/gentoo-release; then # Gentoo + GET_KERN_PACKAGE= + PATTERN_GCC_MAKE= + PATTERN_HEADERS= + PATTERN_HEADERS_META= + elif $file_exists /etc/lfs-release -a -d /etc/rc.d/init.d; then # LFS + GET_KERN_PACKAGE= + PATTERN_GCC_MAKE= + PATTERN_HEADERS= + PATTERN_HEADERS_META= + elif $file_exists /etc/pardus-release; then # Pardus + GET_KERN_PACKAGE= + PATTERN_GCC_MAKE= + PATTERN_HEADERS= + PATTERN_HEADERS_META= + elif $file_exists /etc/slackware-version; then # Slackware + GET_KERN_PACKAGE= + PATTERN_GCC_MAKE= + PATTERN_HEADERS= + PATTERN_HEADERS_META= + elif $file_exists /etc/arch-release; then # Arch Linux + GET_KERN_PACKAGE= + PATTERN_GCC_MAKE= + PATTERN_HEADERS= + PATTERN_HEADERS_META= + else abort "Linux distribution base type not recognised." + fi +} + + +## Determine the commands needed to install gcc, make and the kernel headers on +# the current system. +# @param INSTALL_GCC_MAKE [out] Command to install gcc and make. +# @param INSTALL_HEADERS [out] Command to install gcc and make. +# @param INSTALL_HEADERS_META [out] Command to install a dependency on the +# current kernel headers. May be empty. +generate_install_commands() +{ + get_kernel_information + get_system_information + case "$GET_KERN_PACKAGE" in + ?*) + eval $GET_KERN_PACKAGE ;; + "") + abort "Unable to determine the software packaging system in use." ;; + esac + # Needed for many installers + KERN_PACKAGE_BASE="${KERN_PACKAGE%%$KERN_VER_BASE*}" + KERN_RPM_SUFFIX="${KERN_PACKAGE#"$KERN_PACKAGE_BASE"}" + KERN_DEBIAN_SUFFIX="$(expr "$KERN_VER_EXTRA" : '-[0-9]*\(.*\)')" + INSTALL_GCC_MAKE=$(eval echo "$PATTERN_GCC_MAKE") + INSTALL_HEADERS=$(eval echo "$PATTERN_HEADERS") + INSTALL_HEADERS_META=$(eval echo "$PATTERN_HEADERS_META") +} + + +test_generate_install_commands() +{ + get_kernel_version=test_get_kernel_version + file_exists=test_file_exists + string_in_file=test_file_exists + exit=test_exit + do_type=test_type + find_rpm_for_file=test_find_rpm_for_file + find_deb_for_file=test_find_deb_for_file + for i in \ + "1: test_uname_r=2.4.21-50.EL test_test_f=/etc/redhat-release test_type_binary=yum test_rpm_q=kernel-2.4.21-50.EL test_dpkg_s= =>INSTALL_GCC_MAKE=yum\ install\ gcc\ make INSTALL_HEADERS=yum\ install\ kernel-source-2.4.21-50.EL INSTALL_HEADERS_META=yum\ install\ kernel-source" \ + "2: test_uname_r=2.6.34-12-default test_test_f=/etc/SuSE-release test_rpm_q=kernel-default-2.6.34-12.3 =>INSTALL_GCC_MAKE=zypper\ install\ gcc\ make INSTALL_HEADERS=zypper\ install\ kernel-default-devel-2.6.34-12.3 INSTALL_HEADERS_META=zypper\ install\ kernel-default-devel" \ + "3: test_uname_r=2.6.8.1-12mdkenterprise test_test_f=/etc/mandrake-release test_rpm_q=kernel-enterprise-2.6.8.1.12mdk-1-1mdk test_dpkg_s= =>INSTALL_GCC_MAKE=urpmi\ gcc\ make INSTALL_HEADERS=urpmi\ kernel-source-stripped-2.6-2.6.8.1 INSTALL_HEADERS_META=urpmi\ kernel-source-stripped-2.6" \ + "4: test_uname_r=2.6.26-2-686 test_test_f=/etc/debian_version test_rpm_q= test_dpkg_s=linux-image-2.6.26-2-686:\ /lib/modules/2.6.26-2-686/kernel =>INSTALL_GCC_MAKE=apt-get\ install\ gcc\ make INSTALL_HEADERS=apt-get\ install\ linux-headers-2.6.26-2-686 INSTALL_HEADERS_META=apt-get\ install\ linux-headers-2.6-686" \ + "5: test_uname_r=3.0.0-15-generic test_string_grep=Ubuntu test_string_file=/etc/lsb-release test_rpm_q= test_dpkg_s=linux-image-3.0.0-15-generic:\ /lib/modules/3.0.0-15-generic/kernel =>INSTALL_GCC_MAKE=apt-get\ install\ gcc\ make INSTALL_HEADERS=apt-get\ install\ linux-headers-3.0.0-15-generic INSTALL_HEADERS_META=apt-get\ install\ linux-headers-generic" \ + "6: test_uname_r=2.4.16-686-smp test_test_f=/etc/debian_version test_rpm_q= test_dpkg_s=kernel-image-2.4.16-686-smp =>INSTALL_GCC_MAKE=apt-get\ install\ gcc\ make INSTALL_HEADERS=apt-get\ install\ kernel-headers-2.4.16-686-smp INSTALL_HEADERS_META=" \ + "7: test_uname_r=2.6.38.8-desktop-9.mga test_test_f=/etc/mandrake-release test_rpm_q=kernel-desktop-2.6.38.8-9.mga-1-1.mga1 test_dpkg_s= =>INSTALL_GCC_MAKE=urpmi\ gcc\ make INSTALL_HEADERS=urpmi\ kernel-desktop-devel-2.6.38.8-9.mga-1-1.mga1 INSTALL_HEADERS_META=urpmi\ kernel-desktop-devel-latest" \ + "8: test_uname_r=2.6.17-13mdv test_test_f=/etc/mandrake-release test_rpm_q=kernel-2.6.17.13mdv-1-1mdv2007.1 test_dpkg_s= =>INSTALL_GCC_MAKE=urpmi\ gcc\ make INSTALL_HEADERS=urpmi\ kernel-source-stripped-2.6.17.13mdv-1-1mdv2007.1 INSTALL_HEADERS_META=urpmi\ kernel-source-stripped-latest" \ + "9: test_uname_r=2.6.27.7-9-default test_test_f=/etc/SuSE-release test_rpm_q=kernel-default-base-2.6.27.7-9.1\ kernel-default-2.6.27.7-9.1\ kernel-default-extra-2.6.27.7-9.1 test_dpkg_s= =>INSTALL_GCC_MAKE=zypper\ install\ gcc\ make INSTALL_HEADERS=zypper\ install\ kernel-source-2.6.27.7-9.1\ kernel-syms-2.6.27.7-9.1 INSTALL_HEADERS_META=zypper\ install\ kernel-source\ kernel-syms" \ + "10: test_exit_return= test_test_f=/etc/Windows-release =>test_exit_return=1" + do eval_test_line "$i" "generate_install_commands 2> /dev/null"; done +} + +self_tests="$self_tests test_generate_install_commands" + + +## Check whether gcc, make and the kernel headers are installed on the system. +# @param MISSING_GCC [out] non-empty if make needs to be installed. +# @todo Should we check the version of gcc? +# @param MISSING_MAKE [out] non-empty if make needs to be installed. +# @param MISSING_HEADERS [out] non-empty if kernel headers need to be +# installed. +check_missing_packages() +{ + if $do_type gcc >/dev/null 2>&1; then + MISSING_GCC= + else + MISSING_GCC=gcc + fi + if $do_type make >/dev/null 2>&1; then + MISSING_MAKE= + else + MISSING_MAKE=make + fi + # The following test looks valid on all distributions I have checked so + # far. + MISSING_HEADERS=$($file_exists "$KERN_DIR"/build/Makefile || echo headers) +} + + +case "$1" in livetest) LIVE_TEST=true ;; *) LIVE_TEST= ;; esac +case "$1" in +test) + for i in $self_tests; do $i; done ;; +*) + set_up_helpers + get_kernel_information + check_missing_packages + case "$MISSING_GCC$MISSING_MAKE$MISSING_HEADERS$LIVE_TEST" in "") + exit 0 + esac + generate_install_commands + case "$1" in install) + check_root + $INSTALL_GCC_MAKE || abort "Unable to install tools for building kernel modules." + case "$INSTALL_HEADERS_META" in + "") + $INSTALL_HEADERS || abort "Unable to install files needed to build modules for the current kernel." ;; + *) + $INSTALL_HEADERS || printf >&2 "Unable to install files needed to build modules for the current kernel.\nYou may need to restart your system to complete the installation." + $INSTALL_HEADERS_META || abort "Unable to install files needed to build kernel modules." + esac + ;; + *) + echo "This system is not currently set up to build kernel modules (system extensions)." + echo "Running the following commands should set the system up correctly:" + echo + case "$MISSING_GCC$MISSING_MAKE$LIVE_TEST" in ?*) + echo " $INSTALL_GCC_MAKE" ;; + esac + case "$MISSING_HEADERS$LIVE_TEST" in ?*) + echo " $INSTALL_HEADERS" + echo "(The last command may fail if your system is not fully updated.)" + case "$INSTALL_HEADERS_META" in ?*) + echo " $INSTALL_HEADERS_META" ;; + esac + ;; + esac + exit 1 + ;; + esac + ;; +esac diff --git a/src/VBox/Installer/linux/scripts/install.sh b/src/VBox/Installer/linux/scripts/install.sh new file mode 100755 index 00000000..576eb4e9 --- /dev/null +++ b/src/VBox/Installer/linux/scripts/install.sh @@ -0,0 +1,270 @@ +#!/bin/sh + +# +# Script to handle VirtualBox installation on a Linux host. +# +# Copyright (C) 2013 Oracle Corporation +# +# This file is part of VirtualBox Open Source Edition (OSE), as +# available from http://www.virtualbox.org. This file is free software; +# you can redistribute it and/or modify it under the terms of the GNU +# General Public License (GPL) as published by the Free Software +# Foundation, in version 2 as it comes in the "COPYING" file of the +# VirtualBox OSE distribution. VirtualBox OSE is distributed in the +# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. +# + +# This script is invoked as part of the installation of VirtualBox on a Linux +# host system (see next paragraph for details). When we install using the +# makeself installer it will be executed at installation time, whereas with RPM +# or deb packages it will be executed by the %install section of the template, +# respectively the binary rule from the rules file when the package is created. +# The plan is to gradually move anything here which is identical across the +# three installer types and to put new things in here straight away. We should +# maintain an uninstall.sh script in parallel, but this will only be needed by +# the makeself installer as the other two deal with that automatically. Perhaps +# once we have made some progress at factoring out common bits in the three +# installers we can even try doing it accross other POSIX platforms. +# +# The general idea (mine at least) of how this works/should work is that the +# build system installs everything needed for VirtualBox to run (provided all +# drivers it needs are currently loaded) into the output bin/ folder. The +# Makeself installer duplicates this folder as /opt/VirtualBox (or whatever), +# the other two as <prefix>/lib/virtualbox (again, or whatever). The installer +# then installs scripts into <prefix>/bin to start binaries in the duplicated +# main folder, builds drivers which are put into the kernel module directories +# and creates init/start-up scripts which load drivers and/or start binaries in +# the main folder. As mentioned above, this installation is done at the time +# the package is created for RPM/deb packages and shouldn't create anything +# which is not supposed to be included in a package file list (other things can +# be done in a post-install step). + +# Clean up before we start. +cr=" +" +tab=" " +IFS=" ${cr}${tab}" +'unset' -f unalias +'unalias' -a 2>/dev/null +'unset' -f command +PATH=/bin:/sbin:/usr/bin:/usr/sbin:$PATH + +# Exit on any errors. +set -e + +# Get the folder we are installed to, as we need other files there. May be +# relative to the current directory. +# I hope we never install to a folder with a new-line at the end of the name, +# but the code should(!) still work. +INSTALL_SOURCE=`expr "$0" : '\(.*/\)[^/][^/]*/*'`".." +. "${INSTALL_SOURCE}/scripts/generated.sh" + +# Default settings values. +## Root of installation target file system. +ROOT="" +## Prefix to install to. +RELATIVE_PREFIX="/usr" +## Package name. +PACKAGE="VirtualBox" +## Init script folder. Scripts will not be installed at this stage if empty. +INIT_FOLDER="" +## Do not install Qt front-end-related files. +NO_QT="" +## Do a headless installation. +HEADLESS="" +## Do not install the web service. +NO_WEB_SERVICE="" +## OSE installation - does this still mean anything? +OSE="" +## Do not create <prefix>/share/<package>. +NO_SHARE_PACKAGE="" +## Delete the helpers and scripts folders. +NO_HELPERS="" +## The command to use to run the Python interpreter. +PYTHON_COMMAND="python" +## The folder where the main VirtualBox binaries and libraries will be, relative +# to <prefix>. +INSTALL_FOLDER="/lib/${PACKAGE}" + +while test "${#}" -gt 0; do + case $1 in + --prefix) + test "${#}" -gt 1 || + { + echo "${1} requires at least one argument." >&2 + exit 1 + } + RELATIVE_PREFIX="${2}" + shift + ;; + --root) + test "${#}" -gt 1 || + { + echo "${1} requires at least one argument." >&2 + exit 1 + } + ROOT="${2}" + shift + ;; + --package) + test "${#}" -gt 1 || + { + echo "${1} requires at least one argument." >&2 + exit 1 + } + PACKAGE="${2}" + shift + ;; + --init-folder) + test "${#}" -gt 1 || + { + echo "${1} requires at least one argument." >&2 + exit 1 + } + INIT_FOLDER="${2}" + shift + ;; + --no-qt) + NO_QT="true" + ;; + --headless) + HEADLESS="true" + ;; + --no-web-service) + NO_WEB_SERVICE="true" + ;; + --ose) + OSE="true" + ;; + --no-share-package) + NO_SHARE_PACKAGE="true" + ;; + --no-helpers) + NO_HELPERS="true" + ;; + --python-command) + test "${#}" -gt 1 || + { + echo "${1} requires at least one argument." >&2 + exit 1 + } + PYTHON_COMMAND="${2}" + shift + ;; + + --install-folder) + test "${#}" -gt 1 || + { + echo "${1} requires at least one argument." >&2 + exit 1 + } + INSTALL_FOLDER="${2}" + shift + ;; + *) + echo "Unknown argument ${1}." + exit 1 + ;; + esac + shift +done + +PREFIX="${ROOT}${RELATIVE_PREFIX}" + +# Note: install(1) is not POSIX, but it is available on Linux, Darwin and all +# Solaris versions I could check (the oldest was 2.6). It is a BSD command. +install -d -g 0 -o 0 "${PREFIX}/bin" +install -d -g 0 -o 0 "${PREFIX}/share/applications" +# We use this as our base install folder. +test -z "${NO_QT}" && + mv "${INSTALL_SOURCE}/virtualbox.desktop" "${PREFIX}/share/applications/" +install -d -g 0 -o 0 "${PREFIX}/share/pixmaps" +test -z "${NO_QT}" && + install -d -g 0 -o 0 "${PREFIX}/share/icons/hicolor" +test -z "${NO_QT}" && + cp "${INSTALL_SOURCE}/icons/128x128/virtualbox.png" "${PREFIX}/share/pixmaps/" +test -z "${NO_QT}" && + for i in "${INSTALL_SOURCE}/icons/"*; do + folder=`expr "${i}/" : '.*/\([^/][^/]*/\)/*'` + if test -f "${i}/virtualbox."*; then + install -d -g 0 -o 0 "${PREFIX}/share/icons/hicolor/${folder}/apps" + mv "${i}/virtualbox."* "${PREFIX}/share/icons/hicolor/${folder}/apps" + fi + install -d -g 0 -o 0 "${PREFIX}/share/icons/hicolor/${folder}/mimetypes" + mv "${i}/"* "${PREFIX}/share/icons/hicolor/${folder}/mimetypes" 2>/dev/null || true + rmdir "${i}" + done +test -z "${NO_QT}" && + rmdir "${INSTALL_SOURCE}/icons" +if test -w "${INSTALL_SOURCE}/virtualbox.xml"; then + install -d -g 0 -o 0 "${PREFIX}/share/mime/packages" + mv "${INSTALL_SOURCE}/virtualbox.xml" "${PREFIX}/share/mime/packages/" +fi +mv "${INSTALL_SOURCE}/VBox.png" "${PREFIX}/share/pixmaps/" +test -n "${NO_QT}" && + test ! -r ${INSTALL_SOURCE}/VBoxTestOGL +test -n "${NO_QT}" && + test ! -r ${INSTALL_SOURCE}/nls +install -D -g 0 -o 0 -m 644 "${INSTALL_SOURCE}/VBox.sh" "${PREFIX}/bin/VBox" +rm "${INSTALL_SOURCE}/VBox.sh" +( + cd "${INSTALL_SOURCE}/sdk/installer" + export VBOX_INSTALL_PATH="${RELATIVE_PREFIX}${INSTALL_FOLDER}" + "${PYTHON_COMMAND}" "vboxapisetup.py" install --root "${ROOT}" --prefix "${RELATIVE_PREFIX}" +) +rm -rf ${INSTALL_SOURCE}/sdk/installer +test -n "${HEADLESS}" && + test ! -r "${INSTALL_SOURCE}/VBoxSDL" +test -n "${NO_QT}" && + test ! -r "${INSTALL_SOURCE}/VirtualBox" +test -n "${NO_WEB_SERVICE}" && + test ! -r "${INSTALL_SOURCE}/vboxwebsrv" +test -n "${NO_WEB_SERVICE}" && + test ! -r "${INSTALL_SOURCE}/webtest" +mv "${INSTALL_SOURCE}/VBoxTunctl" "${PREFIX}/bin" +test -n "${OSE}" || test -n "${NO_QT}" && + test ! -r ${INSTALL_SOURCE}/kchmviewer +test -z "${OSE}" && test -z "${HEADLESS}" && + mv "${INSTALL_SOURCE}/rdesktop-vrdp" "${PREFIX}/bin" +if test -z "${NO_SHARE_PACKAGE}"; then + install -d -g 0 -o 0 "${PREFIX}/share/${PACKAGE}" + mv "${INSTALL_SOURCE}/VBoxSysInfo.sh" "${PREFIX}/share/${PACKAGE}" + mv "${INSTALL_SOURCE}/VBoxCreateUSBNode.sh" "${PREFIX}/share/${PACKAGE}" + mv "${INSTALL_SOURCE}/src" "${PREFIX}/share/${PACKAGE}" + test -z "${NO_QT}" && + mv "${INSTALL_SOURCE}/nls" "${PREFIX}/share/${PACKAGE}" + mv "${INSTALL_SOURCE}/additions/VBoxGuestAdditions.iso" "${PREFIX}/share/${PACKAGE}" + # The original code did not fail if this file did not exist. + test -z "${OSE}" && test -f "${INSTALL_SOURCE}/rdesktop-vrdp.tar.gz" && + mv "${INSTALL_SOURCE}/rdesktop-vrdp.tar.gz" "${PREFIX}/share/${PACKAGE}" + test -z "${OSE}" && test -z "${HEADLESS}" && + mv "${INSTALL_SOURCE}/rdesktop-vrdp-keymaps" "${PREFIX}/share/${PACKAGE}" + ln -s "../share/virtualbox/src/vboxhost" "${PREFIX}/src/vboxhost-${VBOX_VERSION_STRING}" +else + mv "${INSTALL_SOURCE}/src/vboxhost" "${PREFIX}/src/vboxhost-${VBOX_VERSION_STRING}" +fi +test -z "${NO_QT}" && ln -s "VBox" "${PREFIX}/bin/VirtualBox" +test -z "${NO_QT}" && ln -sf "VBox" "${PREFIX}/bin/virtualbox" +ln -s "VBox" "${PREFIX}/bin/VBoxManage" +ln -sf "VBox" "${PREFIX}/bin/vboxmanage" +test -z "${HEADLESS}" && ln -s "VBox" "${PREFIX}/bin/VBoxSDL" +test -z "${HEADLESS}" && ln -sf "VBox" "${PREFIX}/bin/vboxsdl" +test -z "${OSE}" && ln -s "VBox" "${PREFIX}/bin/VBoxVRDP" +ln -s "VBox" "${PREFIX}/bin/VBoxHeadless" +ln -sf "VBox" "${PREFIX}/bin/vboxheadless" +ln -s "VBox" "${PREFIX}/bin/VBoxBalloonCtrl" +ln -sf "VBox" "${PREFIX}/bin/vboxballoonctrl" +ln -s "VBox" "${PREFIX}/bin/VBoxAutostart" +ln -s "VBox" "${PREFIX}/bin/vboxautostart" +test -z "${NO_WEB_SERVICE}" && ln -s "VBox" "${PREFIX}/bin/vboxwebsrv" +rmdir ${INSTALL_SOURCE}/additions +rm "${INSTALL_SOURCE}/scripts/install.sh" +## @todo Move this to a make file. +install -d -g 0 -o 0 "${INSTALL_SOURCE}/ExtensionPacks" +# For now. +test -n "${NO_HELPERS}" && + rm -r "${INSTALL_SOURCE}/helpers" +# And the very last bit. +test -n "${NO_HELPERS}" && + rm -r "${INSTALL_SOURCE}/scripts" +exit 0 |