summaryrefslogtreecommitdiff
path: root/src/VBox/Installer/linux
diff options
context:
space:
mode:
Diffstat (limited to 'src/VBox/Installer/linux')
-rw-r--r--src/VBox/Installer/linux/Makefile.kmk106
-rwxr-xr-xsrc/VBox/Installer/linux/VBox.sh21
-rwxr-xr-xsrc/VBox/Installer/linux/VBoxCreateUSBNode.sh2
-rwxr-xr-xsrc/VBox/Installer/linux/VBoxSysInfo.sh2
-rw-r--r--src/VBox/Installer/linux/debian/LocalConfig.kmk2
-rwxr-xr-xsrc/VBox/Installer/linux/debian/VBox.sh102
-rw-r--r--src/VBox/Installer/linux/debian/control12
-rw-r--r--src/VBox/Installer/linux/debian/dirs1
-rw-r--r--src/VBox/Installer/linux/debian/lintian-override.in1
-rwxr-xr-xsrc/VBox/Installer/linux/debian/postinst.in10
-rwxr-xr-xsrc/VBox/Installer/linux/debian/postrm2
-rwxr-xr-xsrc/VBox/Installer/linux/debian/preinst.in2
-rwxr-xr-xsrc/VBox/Installer/linux/debian/prerm.in4
-rwxr-xr-xsrc/VBox/Installer/linux/debian/rules143
-rw-r--r--src/VBox/Installer/linux/distributions_deb14
-rw-r--r--src/VBox/Installer/linux/distributions_rpm24
-rwxr-xr-xsrc/VBox/Installer/linux/install.sh22
-rw-r--r--src/VBox/Installer/linux/install_service/Makefile.kmk49
-rw-r--r--src/VBox/Installer/linux/install_service/generate_service_file.cpp912
-rwxr-xr-xsrc/VBox/Installer/linux/install_service/init_template.sh317
-rwxr-xr-xsrc/VBox/Installer/linux/install_service/install_service.sh209
-rw-r--r--src/VBox/Installer/linux/installer-common.sh7
-rw-r--r--src/VBox/Installer/linux/routines.sh3
-rw-r--r--src/VBox/Installer/linux/rpm/LocalConfig.kmk2
-rw-r--r--src/VBox/Installer/linux/rpm/VirtualBox.tmpl.spec30
-rwxr-xr-xsrc/VBox/Installer/linux/rpm/rules55
-rwxr-xr-xsrc/VBox/Installer/linux/run-inst.sh251
-rwxr-xr-xsrc/VBox/Installer/linux/scripts/VBoxHeadlessXOrg.sh379
-rwxr-xr-xsrc/VBox/Installer/linux/scripts/check_module_dependencies.sh (renamed from src/VBox/Installer/linux/helpers/install_module_dependencies.sh)6
-rwxr-xr-xsrc/VBox/Installer/linux/scripts/install.sh270
-rw-r--r--src/VBox/Installer/linux/testcase/Makefile.kmk12
-rwxr-xr-xsrc/VBox/Installer/linux/testcase/tstHeadlessXOrg.sh305
-rwxr-xr-xsrc/VBox/Installer/linux/testcase/tstInstallInit.sh365
-rwxr-xr-xsrc/VBox/Installer/linux/testcase/tstInstallerLinux.sh2
-rwxr-xr-xsrc/VBox/Installer/linux/uninstall.sh5
-rwxr-xr-xsrc/VBox/Installer/linux/vboxautostart-service.sh (renamed from src/VBox/Installer/linux/vboxautostart-service.sh.in)34
-rwxr-xr-xsrc/VBox/Installer/linux/vboxballoonctrl-service.sh (renamed from src/VBox/Installer/linux/vboxballoonctrl-service.sh.in)60
-rwxr-xr-xsrc/VBox/Installer/linux/vboxdrv.sh.in18
-rwxr-xr-xsrc/VBox/Installer/linux/vboxweb-service.sh (renamed from src/VBox/Installer/linux/vboxweb-service.sh.in)14
39 files changed, 3253 insertions, 522 deletions
diff --git a/src/VBox/Installer/linux/Makefile.kmk b/src/VBox/Installer/linux/Makefile.kmk
index 4259c8e9..78112730 100644
--- a/src/VBox/Installer/linux/Makefile.kmk
+++ b/src/VBox/Installer/linux/Makefile.kmk
@@ -4,7 +4,7 @@
#
#
-# Copyright (C) 2006-2012 Oracle Corporation
+# Copyright (C) 2006-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;
@@ -18,7 +18,8 @@
SUB_DEPTH = ../../../..
include $(KBUILD_PATH)/subheader.kmk
-# Include sub-makefile.
+# Include sub-makefiles.
+include $(PATH_SUB_CURRENT)/install_service/Makefile.kmk
ifdef VBOX_WITH_TESTCASES
include $(PATH_SUB_CURRENT)/testcase/Makefile.kmk
endif
@@ -33,6 +34,7 @@ endif
VBOX_PATH_LNX_INST_SRC := $(PATH_SUB_CURRENT)
VBOX_LNX_INST_OUT_DIR := $(PATH_TARGET)/Installer/linux
VBOX_LNX_INST_STAGE_DIR := $(PATH_TARGET)/Installer/linux/install
+VBOX_LNX_INST_STAGE_DIR_REL := obj/Installer/linux/install
VBOX_LNX_DBG_PATH := usr/lib/debug/opt/VirtualBox
VBOX_LNX_PACKAGE_NAME = VirtualBox-$(VBOX_VERSION_STRING)-r$(VBOX_SVN_REV).run
@@ -49,20 +51,12 @@ endif
OTHER_CLEAN += \
$(addprefix $(VBOX_LNX_INST_STAGE_DIR)/,\
install.sh \
- uninstall.sh \
- deffiles \
- routines.sh \
- vboxautostart-service.sh \
- vboxballoonctrl-service.sh \
vboxdrv.sh \
- vboxweb-service.sh \
VirtualBox.tar.bz2 \
LICENSE) \
$(wildcard $(VBOX_LNX_INST_OUT_DIR)/VirtualBox-*) \
$(addprefix $(VBOX_LNX_INST_OUT_DIR)/,\
- vboxballoonctrl-service.sh \
vboxdrv.sh \
- vboxweb-service.sh \
install.sh)
#
@@ -72,11 +66,25 @@ INSTALLS += linux-bin
linux-bin_INST = bin/
linux-bin_MODE = a+rx,u+w
linux-bin_SOURCES = \
+ scripts/install.sh=>scripts/install.sh \
+ scripts/VBoxHeadlessXOrg.sh=>scripts/VBoxHeadlessXOrg.sh \
VBoxSysInfo.sh \
VBoxCreateUSBNode.sh \
VBox.sh=>VBox.sh \
$(if $(VBOX_WITH_PYTHON),$(PATH_ROOT)/src/VBox/Frontends/VBoxShell/vboxshell.py=>vboxshell.py,)
+INSTALLS += linux-scripts
+linux-scripts_INST = $(VBOX_LNX_INST_STAGE_DIR_REL)/
+linux-scripts_MODE = a+rx,u+w
+linux-scripts_SOURCES = \
+ deffiles \
+ routines.sh \
+ uninstall.sh \
+ vboxautostart-service.sh \
+ vboxballoonctrl-service.sh \
+ vboxdrv-pardus.py \
+ vboxweb-service.sh
+
INSTALLS += linux-misc
linux-misc_INST = bin/
linux-misc_MODE = a+r,u+w
@@ -84,8 +92,19 @@ linux-misc_SOURCES = \
$(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/$(if $(VBOX_OSE),OSE,NonOSE)/VirtualBox_32px.png=>VBox.png \
$(PATH_ROOT)/src/VBox/Installer/common/virtualbox.xml \
$(if $(VBOX_OSE),,$(VBOX_BRAND_LICENSE_TXT)=>LICENSE) \
+ $(linux-misc_0_OUTDIR)/generated.sh=>scripts/generated.sh \
$(if $(VBOX_WITH_QTGUI),$(linux-misc_0_OUTDIR)/virtualbox.desktop,)
-linux-misc_CLEAN = $(linux-misc_0_OUTDIR)/virtualbox.desktop
+linux-misc_CLEAN = \
+ $(linux-misc_0_OUTDIR)/generated.sh \
+ $(linux-misc_0_OUTDIR)/virtualbox.desktop
+
+$$(linux-misc_0_OUTDIR)/generated.sh: $(VBOX_VERSION_STAMP) $(VBOX_LNX_INST_DEP_ON_MAKEFILE) | $$(dir $$@)
+ $(call MSG_GENERATE,,$@,$<)
+ $(QUIET)$(RM) -f '$@'
+ $(QUIET)$(APPEND) '$@' 'VBOX_PRODUCT="$(VBOX_PRODUCT)"'
+ $(QUIET)$(APPEND) '$@' 'VBOX_VERSION_STRING="$(VBOX_VERSION_STRING)"'
+ $(QUIET)$(APPEND) '$@' 'VBOX_C_YEAR="$(VBOX_C_YEAR)"'
+ $(QUIET)$(APPEND) '$@' 'VBOX_VENDOR="$(VBOX_VENDOR)"'
$$(linux-misc_0_OUTDIR)/virtualbox.desktop: $(PATH_ROOT)/src/VBox/Installer/common/virtualbox.desktop.in $(VBOX_VERSION_STAMP) | $$(dir $$@)
$(call MSG_GENERATE,,$@,$<)
@@ -131,7 +150,9 @@ VBOX_LNX_STRIP_BIN = \
VBoxBalloonCtrl \
VBoxManage \
VBoxNetDHCP $(if $(VBOX_WITH_HARDENING),VBoxNetDHCP.so,) \
+ $(if $(VBOX_WITH_LWIP_NAT),VBoxNetNAT $(if $(VBOX_WITH_HARDENING),VBoxNetNAT.so,),) \
VBoxNetAdpCtl \
+ $(if $(VBOX_WITH_DEVMAPPER),VBoxVolInfo,) \
VBoxSVC \
VBoxXPCOM.so \
VBoxXPCOMC.so \
@@ -150,7 +171,8 @@ VBOX_LNX_STRIP_BIN = \
$(if $(and $(VBOX_WITH_EXTPACK_VNC),$(VBOX_WITHOUT_EXTPACK_VNC_PACKING)), \
ExtensionPacks/VNC/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/VBoxVNC.so \
ExtensionPacks/VNC/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/VBoxVNCMain.so,) \
- VBoxTunctl
+ VBoxTunctl \
+ helpers/generate_service_file
# Do not remove relocation information of these binaries
VBOX_LNX_STRIP_OBJ = \
@@ -180,7 +202,8 @@ VBOX_LNX_NO_STRIP = \
VBoxSysInfo.sh \
VBoxCreateUSBNode.sh \
VBox.sh \
- VBox.png
+ VBox.png \
+ scripts
ifdef VBOX_WITH_EXTPACK
VBOX_LNX_STRIP_BIN += \
@@ -275,13 +298,6 @@ ifdef VBOX_WITH_HEADLESS
$(if $(VBOX_WITH_HARDENING),VBoxHeadless.so)
endif
-# BFE
-ifdef VBOX_WITH_BFE
- VBOX_LNX_STRIP_BIN += \
- VBoxBFE \
- $(if $(VBOX_WITH_HARDENING),VBoxBFE.so)
-endif
-
# Webservices
ifdef VBOX_WITH_WEBSERVICES
VBOX_LNX_STRIP_BIN += \
@@ -305,7 +321,8 @@ VBOX_MIME_ICONS = \
VBOX_DESKTOP_ICONS = \
$(addprefix $(PATH_ROOT)/src/VBox/Resources/$(if $(VBOX_OSE),OSE,NonOSE)/,\
$(foreach s,16 20 32 40 48 64 128,\
- virtualbox-$(s)px.png=>$(s)x$(s)/virtualbox.png))
+ virtualbox-$(s)px.png=>$(s)x$(s)/virtualbox.png) \
+ virtualbox.svg=>scalable/virtualbox.svg)
#
# All the bin files that goes into the archives.
@@ -316,59 +333,27 @@ VBOX_LNX_ARCH_FILES := $(VBOX_LNX_STRIP_BIN) $(VBOX_LNX_STRIP_OBJ) $(VBOX_LNX_NO
OTHER_CLEAN += $(addprefix $(VBOX_LNX_INST_OUT_DIR)/archive/,$(VBOX_LNX_ARCH_FILES)) \
$(addprefix $(VBOX_LNX_INST_OUT_DIR)/archive-dbg/$(VBOX_LNX_DBG_PATH)/,$(VBOX_LNX_STRIP_BIN))
-
#
# The generic installer.
#
$(PATH_STAGE_BIN)/$(VBOX_LNX_PACKAGE_NAME): \
$(VBOX_LNX_INST_STAGE_DIR)/VirtualBox.tar.bz2 \
$(VBOX_VERSION_STAMP) \
- $(VBOX_PATH_LNX_INST_SRC)/routines.sh \
- $(VBOX_PATH_LNX_INST_SRC)/deffiles \
$(if $(VBOX_OSE),,$(VBOX_BRAND_LICENSE_TXT)) \
- $(VBOX_LNX_INST_OUT_DIR)/vboxautostart-service.sh \
- $(VBOX_LNX_INST_OUT_DIR)/vboxballoonctrl-service.sh \
$(VBOX_LNX_INST_OUT_DIR)/vboxdrv.sh \
- $(VBOX_LNX_INST_OUT_DIR)/vboxweb-service.sh \
$(VBOX_LNX_INST_OUT_DIR)/install.sh \
$(VBOX_PATH_LNX_INST_SRC)/installer-common.sh \
- $(VBOX_PATH_LNX_INST_SRC)/vboxdrv-pardus.py \
- $(VBOX_PATH_LNX_INST_SRC)/uninstall.sh
+ $$(linux-scripts_2_STAGE_TARGETS)
$(call MSG_TOOL,makeself,,$@)
$(QUIET)$(RM) -f $(wildcard $(PATH_STAGE_BIN)/VirtualBox-*.run)
- $(QUIET)$(INSTALL) -m 0755 $(VBOX_PATH_LNX_INST_SRC)/routines.sh $(VBOX_LNX_INST_STAGE_DIR)/
- $(QUIET)$(INSTALL) -m 0755 $(VBOX_PATH_LNX_INST_SRC)/deffiles $(VBOX_LNX_INST_STAGE_DIR)/
$(QUIET)$(if $(VBOX_OSE),,$(INSTALL) -m 0644 $(VBOX_BRAND_LICENSE_TXT) $(VBOX_LNX_INST_STAGE_DIR)/LICENSE)
- $(QUIET)$(INSTALL) -m 0755 $(VBOX_LNX_INST_OUT_DIR)/vboxautostart-service.sh $(VBOX_LNX_INST_STAGE_DIR)/
- $(QUIET)$(INSTALL) -m 0755 $(VBOX_LNX_INST_OUT_DIR)/vboxballoonctrl-service.sh $(VBOX_LNX_INST_STAGE_DIR)/
$(QUIET)$(INSTALL) -m 0755 $(VBOX_LNX_INST_OUT_DIR)/vboxdrv.sh $(VBOX_LNX_INST_STAGE_DIR)/
- $(QUIET)$(INSTALL) -m 0755 $(VBOX_LNX_INST_OUT_DIR)/vboxweb-service.sh $(VBOX_LNX_INST_STAGE_DIR)/
- $(QUIET)$(INSTALL) -m 0755 $(VBOX_PATH_LNX_INST_SRC)/vboxdrv-pardus.py $(VBOX_LNX_INST_STAGE_DIR)/
$(QUIET)$(INSTALL) -m 0755 $(VBOX_LNX_INST_OUT_DIR)/install.sh $(VBOX_LNX_INST_STAGE_DIR)/
- $(QUIET)$(INSTALL) -m 0755 $(VBOX_PATH_LNX_INST_SRC)/uninstall.sh $(VBOX_LNX_INST_STAGE_DIR)/
$(QUIET)$(RM) -f $@
$(QUIET)$(VBOX_MAKESELF) --follow --nocomp $(VBOX_LNX_INST_STAGE_DIR) $@ \
"VirtualBox for Linux installation" ./install.sh "\$$0 1> /dev/null"
# files that needs editing before they can be included in the generic installer.
-$(VBOX_LNX_INST_OUT_DIR)/vboxautostart-service.sh: $(VBOX_PATH_LNX_INST_SRC)/vboxautostart-service.sh.in | $$(dir $$@)
- $(QUIET)$(SED_EXT) \
- -e "s|%NOLSB%|yes|g" \
- -e "s|%DEBIAN%||g" \
- -e "s|%PACKAGE%|virtualbox|g" \
- -e "s|%VERSION%|$(VBOX_VERSION_STRING)|g" \
- --output $@ \
- $<
-
-$(VBOX_LNX_INST_OUT_DIR)/vboxballoonctrl-service.sh: $(VBOX_PATH_LNX_INST_SRC)/vboxballoonctrl-service.sh.in | $$(dir $$@)
- $(QUIET)$(SED_EXT) \
- -e "s|%NOLSB%|yes|g" \
- -e "s|%DEBIAN%||g" \
- -e "s|%PACKAGE%|virtualbox|g" \
- -e "s|%VERSION%|$(VBOX_VERSION_STRING)|g" \
- --output $@ \
- $<
-
$(VBOX_LNX_INST_OUT_DIR)/vboxdrv.sh: $(VBOX_PATH_LNX_INST_SRC)/vboxdrv.sh.in | $$(dir $$@)
$(QUIET)$(SED_EXT) \
-e "s|%NOLSB%|yes|g" \
@@ -379,14 +364,6 @@ $(VBOX_LNX_INST_OUT_DIR)/vboxdrv.sh: $(VBOX_PATH_LNX_INST_SRC)/vboxdrv.sh.in | $
--output $@ \
$<
-$(VBOX_LNX_INST_OUT_DIR)/vboxweb-service.sh: $(VBOX_PATH_LNX_INST_SRC)/vboxweb-service.sh.in | $$(dir $$@)
- $(QUIET)$(SED_EXT) \
- -e "s|%NOLSB%|yes|g" \
- -e "s|%DEBIAN%||g" \
- -e "s|%PACKAGE%|virtualbox|g" \
- --output $@ \
- $<
-
$(VBOX_LNX_INST_OUT_DIR)/install.sh: $(VBOX_PATH_LNX_INST_SRC)/install.sh $(VBOX_PATH_LNX_INST_SRC)/installer-common.sh $(VBOX_VERSION_STAMP) $(VBOX_SVN_REV_KMK).ts | $$(dir $$@)
$(QUIET)$(SED) \
-e "s;_VERSION_;$(VBOX_VERSION_STRING);g" \
@@ -416,7 +393,8 @@ VBOX_LNX_INST_ARCH_DEPS := \
$(wildcard $(PATH_STAGE_BIN)/src/*) \
$(wildcard $(PATH_STAGE_BIN)/src/*/*) \
$(wildcard $(PATH_STAGE_BIN)/src/*/*/*) \
- $(wildcard $(PATH_STAGE_BIN)/src/*/*/*/*)
+ $(wildcard $(PATH_STAGE_BIN)/src/*/*/*/*) \
+ $(wildcard $(PATH_STAGE_BIN)/scripts/*)
#
@@ -496,6 +474,7 @@ $(addprefix $(VBOX_LNX_INST_OUT_DIR)/archive/,$(VBOX_LNX_NO_STRIP)): \
BLDDIRS += $(foreach d,\
archive \
archive/components \
+ archive/helpers \
archive/nls \
$(if $(VBOX_WITH_QT4_SUN),archive/accessible,) \
$(if $(VBOX_WITH_PYTHON),\
@@ -542,6 +521,7 @@ $(addprefix $(VBOX_LNX_INST_OUT_DIR)/archive-dbg/$(VBOX_LNX_DBG_PATH)/,$(VBOX_LN
BLDDIRS += $(foreach d,\
$(VBOX_LNX_DBG_PATH) \
$(VBOX_LNX_DBG_PATH)/components \
+ $(VBOX_LNX_DBG_PATH)/helpers \
,$(VBOX_LNX_INST_OUT_DIR)/archive-dbg/$(d)/)
include $(FILE_KBUILD_SUB_FOOTER)
diff --git a/src/VBox/Installer/linux/VBox.sh b/src/VBox/Installer/linux/VBox.sh
index 2243798f..6201a66e 100755
--- a/src/VBox/Installer/linux/VBox.sh
+++ b/src/VBox/Installer/linux/VBox.sh
@@ -2,7 +2,7 @@
#
# Oracle VM VirtualBox startup script, Linux hosts.
#
-# Copyright (C) 2006-2011 Oracle Corporation
+# Copyright (C) 2006-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;
@@ -16,12 +16,16 @@
PATH="/usr/bin:/bin:/usr/sbin:/sbin"
CONFIG="/etc/vbox/vbox.cfg"
-if [ ! -r "$CONFIG" ]; then
- echo "Could not find VirtualBox installation. Please reinstall."
- exit 1
-fi
-
-. "$CONFIG"
+test -r "${CONFIG}" &&
+ . "${CONFIG}"
+test -z "${INSTALL_DIR}" &&
+ if test -f /usr/lib/virtualbox/VirtualBox &&
+ test -x /usr/lib/virtualbox/VirtualBox; then
+ INSTALL_DIR=/usr/lib/virtualbox
+ else
+ echo "Could not find VirtualBox installation. Please reinstall."
+ exit 1
+ fi
# Note: This script must not fail if the module was not successfully installed
# because the user might not want to run a VM but only change VM params!
@@ -100,9 +104,6 @@ case "$APP" in
vboxwebsrv)
exec "$INSTALL_DIR/vboxwebsrv" "$@"
;;
- VBoxBFE|vboxbfe)
- exec "$INSTALL_DIR/VBoxBFE" "$@"
- ;;
*)
echo "Unknown application - $APP"
exit 1
diff --git a/src/VBox/Installer/linux/VBoxCreateUSBNode.sh b/src/VBox/Installer/linux/VBoxCreateUSBNode.sh
index 9c9a8df9..ebf6254b 100755
--- a/src/VBox/Installer/linux/VBoxCreateUSBNode.sh
+++ b/src/VBox/Installer/linux/VBoxCreateUSBNode.sh
@@ -6,7 +6,7 @@
#
#
-# Copyright (C) 2010 Oracle Corporation
+# Copyright (C) 2010-2011 Oracle Corporation
#
# This file is part of VirtualBox Open Source Edition (OSE), as
# available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Installer/linux/VBoxSysInfo.sh b/src/VBox/Installer/linux/VBoxSysInfo.sh
index 8166b288..cf1f326b 100755
--- a/src/VBox/Installer/linux/VBoxSysInfo.sh
+++ b/src/VBox/Installer/linux/VBoxSysInfo.sh
@@ -5,7 +5,7 @@
# Installer (Unix-like)
# Information about the host system/Linux distribution
-# Copyright (C) 2006-2007 Oracle Corporation
+# Copyright (C) 2006-2011 Oracle Corporation
#
# This file is part of VirtualBox Open Source Edition (OSE), as
# available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Installer/linux/debian/LocalConfig.kmk b/src/VBox/Installer/linux/debian/LocalConfig.kmk
index d25294ab..72251cb9 100644
--- a/src/VBox/Installer/linux/debian/LocalConfig.kmk
+++ b/src/VBox/Installer/linux/debian/LocalConfig.kmk
@@ -4,7 +4,7 @@
#
#
-# Copyright (C) 2006-2010 Oracle Corporation
+# Copyright (C) 2006-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;
diff --git a/src/VBox/Installer/linux/debian/VBox.sh b/src/VBox/Installer/linux/debian/VBox.sh
deleted file mode 100755
index d7c21e20..00000000
--- a/src/VBox/Installer/linux/debian/VBox.sh
+++ /dev/null
@@ -1,102 +0,0 @@
-#!/bin/sh
-#
-# Oracle VM VirtualBox startup script, Linux hosts.
-#
-# Copyright (C) 2006-2011 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="/usr/bin:/bin:/usr/sbin:/sbin"
-
-# Note: This script must not fail if the module was not successfully installed
-# because the user might not want to run a VM but only change VM params!
-
-if [ "$1" = "shutdown" ]; then
- SHUTDOWN="true"
-elif ! lsmod|grep -q vboxdrv; then
- cat << EOF
-WARNING: The vboxdrv kernel module is not loaded. Either there is no module
- available for the current kernel (`uname -r`) or it failed to
- load. Please recompile the kernel module and install it by
-
- sudo /etc/init.d/vboxdrv setup
-
- You will not be able to start VMs until this problem is fixed.
-EOF
-elif [ ! -c /dev/vboxdrv ]; then
- cat << EOF
-WARNING: The character device /dev/vboxdrv does not exist. Try
-
- sudo /etc/init.d/vboxdrv restart
-
- and if that is not successful, try to re-install the package.
-
- You will not be able to start VMs until this problem is fixed.
-EOF
-fi
-
-if [ -f /etc/vbox/module_not_compiled ]; then
- cat << EOF
-WARNING: The compilation of the vboxdrv.ko kernel module failed during the
- installation for some reason. Starting a VM will not be possible.
- Please consult the User Manual for build instructions.
-EOF
-fi
-
-SERVER_PID=`ps -U \`whoami\` | grep VBoxSVC | awk '{ print $1 }'`
-if [ -z "$SERVER_PID" ]; then
- # Server not running yet/anymore, cleanup socket path.
- # See IPC_GetDefaultSocketPath()!
- if [ -n "$LOGNAME" ]; then
- rm -rf /tmp/.vbox-$LOGNAME-ipc > /dev/null 2>&1
- else
- rm -rf /tmp/.vbox-$USER-ipc > /dev/null 2>&1
- fi
-fi
-
-if [ "$SHUTDOWN" = "true" ]; then
- if [ -n "$SERVER_PID" ]; then
- kill -TERM $SERVER_PID
- sleep 2
- fi
- exit 0
-fi
-
-INSTALL_DIR=/usr/lib/virtualbox
-
-APP=`basename $0`
-case "$APP" in
- VirtualBox|virtualbox)
- exec "$INSTALL_DIR/VirtualBox" "$@"
- ;;
- VBoxManage|vboxmanage)
- exec "$INSTALL_DIR/VBoxManage" "$@"
- ;;
- VBoxSDL|vboxsdl)
- exec "$INSTALL_DIR/VBoxSDL" "$@"
- ;;
- VBoxVRDP|VBoxHeadless|vboxheadless)
- exec "$INSTALL_DIR/VBoxHeadless" "$@"
- ;;
- VBoxBalloonCtrl|vboxballoonctrl)
- exec "$INSTALL_DIR/VBoxBalloonCtrl" "$@"
- ;;
- vboxwebsrv)
- exec "$INSTALL_DIR/vboxwebsrv" "$@"
- ;;
- VBoxBFE|vboxbfe)
- exec "$INSTALL_DIR/VBoxBFE" "$@"
- ;;
- *)
- echo "Unknown application - $APP"
- exit 1
- ;;
-esac
-exit 0
diff --git a/src/VBox/Installer/linux/debian/control b/src/VBox/Installer/linux/debian/control
index 0b286c7b..457b3c88 100644
--- a/src/VBox/Installer/linux/debian/control
+++ b/src/VBox/Installer/linux/debian/control
@@ -1,4 +1,4 @@
-Source: virtualbox-4.2
+Source: virtualbox-4.3
Section: contrib/misc
Priority: optional
Maintainer: Oracle Corporation <info@virtualbox.org>
@@ -13,16 +13,16 @@ Build-Depends: debhelper (>= 5), libz-dev, libssl-dev, libqt4-dev,
libxext-dev, libcurl-dev, libxrandr-dev, openjdk-6-jdk | sun-java6-jdk
XS-Python-Version: >= 2.4
-Package: virtualbox-4.2
+Package: virtualbox-4.3
Architecture: i386 amd64
Pre-Depends: debconf (>= 1.1) | debconf-2.0
Depends: ${shlibs:Depends}, debconf (>= 0.5) | debconf-2.0, psmisc, adduser
Recommends: ${alsa}, ${pulse}, ${sdlttf}, ${dkms},
linux-headers, gcc, make, binutils,
- pdf-viewer, libgl1, python-central
+ pdf-viewer, libgl1
Provides: virtualbox
Replaces: virtualbox
-Conflicts: virtualbox, virtualbox-ose
+Conflicts: virtualbox, virtualbox-ose, virtualbox-guest-additions-iso
Description: Oracle VM VirtualBox
VirtualBox is a powerful PC virtualization solution allowing you to run a
wide range of PC operating systems on your Linux system. This includes
@@ -31,9 +31,9 @@ Description: Oracle VM VirtualBox
software solution on the market.
XB-Python-Version: ${python:Versions}
-Package: virtualbox-4.2-dbg
+Package: virtualbox-4.3-dbg
Architecture: i386 amd64
-Depends: virtualbox-4.2 (= ${Source-Version})
+Depends: virtualbox-4.3 (= ${Source-Version})
Provides: virtualbox-dbg
Replaces: virtualbox-dbg
Conflicts: virtualbox-dbg, virtualbox-ose-dbg
diff --git a/src/VBox/Installer/linux/debian/dirs b/src/VBox/Installer/linux/debian/dirs
index 1f68187f..1549fd3a 100644
--- a/src/VBox/Installer/linux/debian/dirs
+++ b/src/VBox/Installer/linux/debian/dirs
@@ -2,4 +2,3 @@
/etc/vbox
/etc/init.d
/usr/src
-/usr/lib/virtualbox
diff --git a/src/VBox/Installer/linux/debian/lintian-override.in b/src/VBox/Installer/linux/debian/lintian-override.in
index c23755cf..e4a9eee3 100644
--- a/src/VBox/Installer/linux/debian/lintian-override.in
+++ b/src/VBox/Installer/linux/debian/lintian-override.in
@@ -15,6 +15,7 @@
%VERPKG%: shlib-with-non-pic-code usr/lib/virtualbox/VBoxHostChannel.so
%VERPKG%: shlib-with-non-pic-code usr/lib/virtualbox/VBoxDragAndDropSvc.so
%VERPKG%: shlib-with-non-pic-code usr/lib/virtualbox/VBoxNetDHCP.so
+%VERPKG%: shlib-with-non-pic-code usr/lib/virtualbox/VBoxNetNAT.so
%VERPKG%: shlib-with-non-pic-code usr/lib/virtualbox/VBoxVRDP.so
%VERPKG%: shlib-with-non-pic-code usr/lib/virtualbox/VBoxAuth.so
%VERPKG%: shlib-with-non-pic-code usr/lib/virtualbox/components/VBoxSVCM.so
diff --git a/src/VBox/Installer/linux/debian/postinst.in b/src/VBox/Installer/linux/debian/postinst.in
index 102ba7b1..01a16382 100755
--- a/src/VBox/Installer/linux/debian/postinst.in
+++ b/src/VBox/Installer/linux/debian/postinst.in
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (C) 2006-2011 Oracle Corporation
+# Copyright (C) 2006-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;
@@ -66,9 +66,17 @@ if [ "$1" = "configure" ]; then
if ! dpkg-statoverride --list /usr/lib/virtualbox/VBoxNetDHCP > /dev/null 2>&1; then
chmod 4511 /usr/lib/virtualbox/VBoxNetDHCP
fi
+ if ! dpkg-statoverride --list /usr/lib/virtualbox/VBoxNetNAT > /dev/null 2>&1; then
+ chmod 4511 /usr/lib/virtualbox/VBoxNetNAT
+ fi
if ! dpkg-statoverride --list /usr/lib/virtualbox/VBoxNetAdpCtl > /dev/null 2>&1; then
chmod 4511 /usr/lib/virtualbox/VBoxNetAdpCtl
fi
+ if [ -x /usr/lib/virtualbox/VBoxVolInfo ]; then
+ if ! dpkg-statoverride --list /usr/lib/virtualbox/VBoxVolInfo > /dev/null 2>&1; then
+ chmod 4511 /usr/lib/virtualbox/VBoxVolInfo
+ fi
+ fi
# if INSTALL_NO_VBOXDRV is set to 1, remove all shipped modules
if [ "$INSTALL_NO_VBOXDRV" = "1" ]; then
diff --git a/src/VBox/Installer/linux/debian/postrm b/src/VBox/Installer/linux/debian/postrm
index 60a9f6fd..799412d4 100755
--- a/src/VBox/Installer/linux/debian/postrm
+++ b/src/VBox/Installer/linux/debian/postrm
@@ -1,7 +1,7 @@
#!/bin/sh
#
-# Copyright (C) 2006-2010 Oracle Corporation
+# Copyright (C) 2006-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;
diff --git a/src/VBox/Installer/linux/debian/preinst.in b/src/VBox/Installer/linux/debian/preinst.in
index 10861b48..d065ead9 100755
--- a/src/VBox/Installer/linux/debian/preinst.in
+++ b/src/VBox/Installer/linux/debian/preinst.in
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# Copyright (C) 2006-2011 Oracle Corporation
+# Copyright (C) 2006-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;
diff --git a/src/VBox/Installer/linux/debian/prerm.in b/src/VBox/Installer/linux/debian/prerm.in
index d26ed562..496bbf8e 100755
--- a/src/VBox/Installer/linux/debian/prerm.in
+++ b/src/VBox/Installer/linux/debian/prerm.in
@@ -1,7 +1,7 @@
#!/bin/sh
#
-# Copyright (C) 2006-2010 Oracle Corporation
+# Copyright (C) 2006-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;
@@ -19,7 +19,7 @@
# purge: (our version): purge this package
# deconfigure: (our version): removing conflicting version
-rm -f /etc/udev/rules.d/10-vboxdrv.rules
+rm -f /etc/udev/rules.d/60-vboxdrv.rules
rm -f /etc/vbox/license_agreed
rm -f /etc/vbox/module_not_compiled
diff --git a/src/VBox/Installer/linux/debian/rules b/src/VBox/Installer/linux/debian/rules
index f987cb96..e9ea88c1 100755
--- a/src/VBox/Installer/linux/debian/rules
+++ b/src/VBox/Installer/linux/debian/rules
@@ -41,18 +41,18 @@ export DH_COMPAT=4
# BLEEDING_EDGE=xyz
package := virtualbox
-verpkg := virtualbox-4.2
+verpkg := virtualbox-4.3
current := $(shell pwd)
vboxroot := $(shell cd ../../../..; pwd)
pkgdir := $(if $(PKGDIR),$(PKGDIR),$(shell cd ../../../../..; pwd))
-builddir := $(current)/debian/builddir
-moddir := $(current)/debian/modules
+builddir := $(vboxroot)/out/debian/builddir
+moddir := $(vboxroot)/out/debian/modules
prefix := $(current)/debian/$(verpkg)
arch := $(shell dpkg --print-architecture)
verfile := $(builddir)/version-generated.mk
ose := $(if $(OSE),1,$(if $(wildcard $(vboxroot)/src/VBox/RDP/server),,1))
-include $(vboxroot)/SVN_REVISION
-svnrev :=$(if $(svn_revision),$(svn_revision),0)
+svnrev :=$(if $(svn_revision),$(svn_revision),)
NOMODS ?= $(ose)
NOQT ?= $(HEADLESS)
@@ -94,12 +94,12 @@ endif
qtstdc6 := /home/vbox/Qt-4.7.4-stdc++6-$(arch)
cfg_flags := $(if $(NOQT),--disable-qt,) \
- $(if $(filter _Ubuntu_hardy _Debian_lenny,$(debrel)),--with-qt4-dir=$(qtstdc6)) \
+ $(if $(filter _Debian_squeeze,$(debrel)),--build-libvpx,) \
$(if $(ose),--ose,) $(if $(LINUX),--with-linux=$(LINUX),) \
$(if $(HEADLESS),--build-headless,) \
$(if $(DEBUG),--build-debug,) \
$(if $(NOWINE),,--setup-wine) \
- $(if $(NOWEBSVC),,--enable-webservice) \
+ $(if $(NOWEBSVC),,$(if $(ose),--enable-webservice,)) \
$(if $(VNC),--enable-vnc,) \
--disable-extpack
@@ -109,17 +109,15 @@ bld_flags := AUTOCFG=$(current)/debian/AutoConfig.kmk \
VBOX_WITHOUT_EXTPACK_PUEL_PACKING=1 \
VBOX_WITHOUT_EXTPACK_VNC_PACKING=1 \
VBOX_DO_STRIP= \
- VBOX_DO_STRIP_MODULES= \
VBOX_WITH_MULTIVERSION_PYTHON= \
VBOX_PATH_PACKAGE_DOCS="\"/usr/share/doc/$(verpkg)\"" \
$(if $(ose),,VBOX_WITH_DOCS_CHM=1) \
VBOX_PACKAGE_DIST=$(debdist) \
- VBOX_SVN_REV=$(svnrev) \
+ $(if $(svnrev),VBOX_SVN_REV=$(svnrev),) \
$(if $(NODOCS),VBOX_WITH_DOCS= ,) \
$(if $(VERBOSE),--print-directory KBUILD_VERBOSE=2,--no-print-directory) \
$(if $(STAGEDISO),VBOX_WITHOUT_ADDITIONS=1,) \
- $(if $(BLEEDING_EDGE),VBOX_BLEEDING_EDGE=$(BLEEDING_EDGE),) \
- $(if $(filter _Ubuntu_hardy,$(debrel)),,VBOX_WITH_SYSFS_BY_DEFAULT=1)
+ $(if $(BLEEDING_EDGE),VBOX_BLEEDING_EDGE=$(BLEEDING_EDGE),)
configure: debian/configure-stamp
debian/configure-stamp:
@@ -139,8 +137,8 @@ debian/build-stamp $(verfile):
$(if $(STAGEDISO),cp $(STAGEDISO)/VBoxGuestAdditions.iso $(builddir)/bin/additions,)
. debian/env.sh && kmk -C $(vboxroot) $(bld_flags) \
VBOX_NO_LINUX_RUN_INSTALLER=1 \
- VBOX_LNX_ADD_ARCHIVE.x86=$(builddir)/bin/additions/VBoxGuestAdditions-x86-r$(svnrev).tar.bz2 \
- VBOX_LNX_ADD_ARCHIVE.amd64=$(builddir)/bin/additions/VBoxGuestAdditions-amd64-r$(svnrev).tar.bz2 \
+ VBOX_LNX_ADD_ARCHIVE.x86=$(builddir)/bin/additions/VBoxGuestAdditions-x86.tar.bz2 \
+ VBOX_LNX_ADD_ARCHIVE.amd64=$(builddir)/bin/additions/VBoxGuestAdditions-amd64.tar.bz2 \
VBOX_PATH_ADDITIONS.linux.x86=$(builddir)/bin/additions \
VBOX_PATH_ADDITIONS.linux.amd64=$(builddir)/bin/additions \
packing
@@ -207,68 +205,17 @@ binary binary-arch binary-indep: build $(if $(NOMODS),,modules)
dh_clean -k
dh_installdirs
tar -xjC $(prefix)/opt -f $(builddir)/bin/VirtualBox.tar.bz2
- install -d -g 0 -o 0 $(prefix)/usr/share/applications
- install -d -g 0 -o 0 $(prefix)/usr/lib
- install -d -g 0 -o 0 $(prefix)/usr/bin
- install -d -g 0 -o 0 $(prefix)/usr/lib/$(package)
- install -d -g 0 -o 0 $(prefix)/usr/share/$(package)
+ $(if $(NOQT),,mv $(archdir)/virtualbox.xml debian/$(verpkg).sharedmimeinfo)
+ $(archdir)/scripts/install.sh --package $(package) --root $(prefix) \
+ --prefix /usr $(if $(NOQT),--no-qt) $(if $(ose),--ose) \
+ $(if $(HEADLESS),--headless) $(if $(NOWEBSVC),--no-web-service) \
+ --install-folder /lib/$(package) --no-helpers
install -d -g 0 -o 0 $(prefix)/usr/share/doc/$(verpkg)
- $(if $(NOQT),,mv $(archdir)/virtualbox.desktop \
- $(prefix)/usr/share/applications/virtualbox.desktop)
- install -d -g 0 -o 0 $(prefix)/usr/share/pixmaps
- install -d -g 0 -o 0 $(prefix)/usr/share/icons/hicolor
- cp $(archdir)/icons/128x128/virtualbox.png \
- $(prefix)/usr/share/pixmaps/virtualbox.png
- cd $(archdir)/icons; for i in *; do \
- if [ -f $$i/virtualbox.png ]; then \
- install -d -g 0 -o 0 $(prefix)/usr/share/icons/hicolor/$$i/apps; \
- mv $$i/virtualbox.png $(prefix)/usr/share/icons/hicolor/$$i/apps; \
- fi; \
- install -d -g 0 -o 0 $(prefix)/usr/share/icons/hicolor/$$i/mimetypes; \
- mv $$i/* $(prefix)/usr/share/icons/hicolor/$$i/mimetypes || true; \
- rmdir $$i; \
- done
- rmdir $(archdir)/icons
- install -d -g 0 -o 0 $(prefix)/usr/lib/$(package)/ExtensionPacks
- mv $(archdir)/virtualbox.xml debian/$(verpkg).sharedmimeinfo
install -d -g 0 -o 0 $(prefix)/usr/share/lintian/overrides
sed \
-e 's|%VERPKG%|$(verpkg)|g' \
debian/lintian-override.in > \
$(prefix)/usr/share/lintian/overrides/$(verpkg)
- mv $(archdir)/VBoxEFI32.fd $(prefix)/usr/lib/$(package)
- mv $(archdir)/VBoxEFI64.fd $(prefix)/usr/lib/$(package)
- mv $(archdir)/VBox.png \
- $(prefix)/usr/share/pixmaps/VBox.png
- mv $(archdir)/*.gc $(prefix)/usr/lib/$(package)
- mv $(archdir)/*.r0 $(prefix)/usr/lib/$(package)
- mv $(archdir)/*.rel $(prefix)/usr/lib/$(package) || true
- mv $(archdir)/VBoxNetDHCP $(prefix)/usr/lib/$(package)
- mv $(archdir)/VBoxNetAdpCtl $(prefix)/usr/lib/$(package)
- mv $(archdir)/VBoxXPCOMIPCD $(prefix)/usr/lib/$(package)
- mv $(archdir)/components $(prefix)/usr/lib/$(package)/components
- mv $(archdir)/*.so $(prefix)/usr/lib/$(package)
- mv $(archdir)/*.so.4 $(prefix)/usr/lib/$(package) || true
- $(if $(NOQT),,mv $(archdir)/VBoxTestOGL $(prefix)/usr/lib/$(package))
- $(if $(NOQT),,mv $(archdir)/nls $(prefix)/usr/share/$(package))
- mv $(archdir)/src $(prefix)/usr/share/$(package)
- rm $(archdir)/VBox.sh
- export VBOX_INSTALL_PATH=/usr/lib/$(package) && \
- cd ./debian/builddir/bin/sdk/installer && \
- python ./vboxapisetup.py install --root $(prefix)
- rm -rf $(archdir)/sdk/installer
- mv $(archdir)/vboxshell.py $(prefix)/usr/lib/$(package)
- mv $(archdir)/sdk $(prefix)/usr/lib/$(package)
- install -D -g 0 -o 0 -m 644 debian/VBox.sh $(prefix)/usr/bin/VBox
- mv $(archdir)/VBoxSysInfo.sh $(prefix)/usr/share/$(package)
- mv $(archdir)/VBoxCreateUSBNode.sh $(prefix)/usr/share/$(package)
- for i in VBoxManage VBoxSVC $(if $(HEADLESS),,VBoxSDL) \
- $(if $(NOQT),,VirtualBox) VBoxHeadless \
- VBoxExtPackHelperApp VBoxBalloonCtrl VBoxAutostart \
- $(if $(NOWEBSVC),,vboxwebsrv webtest); do \
- mv $(archdir)/$$i $(prefix)/usr/lib/$(package); done
- $(if $(VNC),mv $(archdir)/ExtensionPacks/VNC $(prefix)/usr/lib/$(package)/ExtensionPacks,)
- mv $(archdir)/VBoxTunctl $(prefix)/usr/bin
$(if $(NOMODS),,for d in $(moddir)/*; do \
if [ -f $$d/vboxdrv.ko -a -f $$d/vboxnetflt.ko -a -f $$d/vboxnetadp.ko -a -f $$d/vboxpci.ko ]; then \
install -D -g 0 -o 0 -m 0644 \
@@ -282,44 +229,19 @@ binary binary-arch binary-indep: build $(if $(NOMODS),,modules)
fi \
done)
ifeq ($(ose),)
- $(if $(NOQT),,mv $(archdir)/kchmviewer $(prefix)/usr/lib/$(package))
dh_installdocs \
$(archdir)/UserManual*.pdf $(archdir)/VirtualBox*.chm \
$(addprefix $(archdir)/, LICENSE)
rm $(addprefix $(archdir)/,UserManual*.pdf VirtualBox*.chm \
LICENSE)
- for i in rdesktop-vrdp.tar.gz additions/VBoxGuestAdditions.iso; do \
- mv $(archdir)/$$i $(prefix)/usr/share/$(package); done
- $(if $(HEADLESS),,mv $(archdir)/rdesktop-vrdp $(prefix)/usr/bin)
- $(if $(HEADLESS),,mv $(archdir)/rdesktop-vrdp-keymaps $(prefix)/usr/share/$(package))
- if [ -d $(archdir)/accessible ]; then mv $(archdir)/accessible $(prefix)/usr/lib/virtualbox; fi
else
dh_installdocs \
$(archdir)/UserManual*.pdf
rm $(addprefix $(archdir)/,UserManual*.pdf)
- for i in additions/VBoxGuestAdditions.iso; do \
- mv $(archdir)/$$i $(prefix)/usr/share/$(package); done
endif
- rmdir $(archdir)/additions
- $(if $(VNC),rmdir $(archdir)/ExtensionPacks)
- rmdir $(archdir)
+ mv $(archdir) $(prefix)/usr/lib/$(package)
+ ln -s ../VBoxVMM.so $(prefix)/usr/lib/$(package)/components/VBoxVMM.so
rmdir $(prefix)/opt
- dh_link \
- $(if $(NOQT),,usr/bin/VBox usr/bin/VirtualBox) \
- $(if $(NOQT),,usr/bin/VBox usr/bin/virtualbox) \
- usr/bin/VBox usr/bin/VBoxManage \
- usr/bin/VBox usr/bin/vboxmanage \
- $(if $(HEADLESS),,usr/bin/VBox usr/bin/VBoxSDL) \
- $(if $(HEADLESS),,usr/bin/VBox usr/bin/vboxsdl) \
- $(if $(ose),,usr/bin/VBox usr/bin/VBoxVRDP) \
- usr/bin/VBox usr/bin/VBoxHeadless \
- usr/bin/VBox usr/bin/vboxheadless \
- usr/bin/VBox usr/bin/VBoxBalloonCtrl \
- usr/bin/VBox usr/bin/vboxballoonctrl \
- usr/bin/VBox usr/bin/VBoxAutostart \
- usr/bin/VBox usr/bin/vboxautostart \
- $(if $(NOWEBSVC),,usr/bin/VBox usr/bin/vboxwebsrv) \
- usr/share/virtualbox/src/vboxhost usr/src/vboxhost-$(ver)
dh_desktop
$(if $(NOMODS),,dh_installmodules)
sed \
@@ -330,23 +252,11 @@ endif
-e "s|%GROUP%|$(if $(VBOX_WITHOUT_HARDENING),vboxusers,root)|g" \
$(vboxroot)/src/VBox/Installer/linux/vboxdrv.sh.in > debian/vboxdrv.init
dh_installinit --name=vboxdrv --noscripts
- sed \
- -e 's|%NOLSB%||g' \
- -e 's|%DEBIAN%|yes|g' \
- -e 's|%PACKAGE%|virtualbox|g' \
- $(vboxroot)/src/VBox/Installer/linux/vboxballoonctrl-service.sh.in > debian/vboxballoonctrl-service.init
+ cp $(vboxroot)/src/VBox/Installer/linux/vboxballoonctrl-service.sh debian/vboxballoonctrl-service.init
dh_installinit --name=vboxballoonctrl-service --noscripts
- sed \
- -e 's|%NOLSB%||g' \
- -e 's|%DEBIAN%|yes|g' \
- -e 's|%PACKAGE%|virtualbox|g' \
- $(vboxroot)/src/VBox/Installer/linux/vboxautostart-service.sh.in > debian/vboxautostart-service.init
+ cp $(vboxroot)/src/VBox/Installer/linux/vboxautostart-service.sh debian/vboxautostart-service.init
dh_installinit --name=vboxautostart-service --noscripts
- sed \
- -e 's|%NOLSB%||g' \
- -e 's|%DEBIAN%|yes|g' \
- -e 's|%PACKAGE%|virtualbox|g' \
- $(vboxroot)/src/VBox/Installer/linux/vboxweb-service.sh.in > debian/vboxweb-service.init
+ cp $(vboxroot)/src/VBox/Installer/linux/vboxweb-service.sh debian/vboxweb-service.init
dh_installinit --name=vboxweb-service --noscripts
sed -e 's|%VER%|$(debver)|g' \
-e 's|%DATE%|$(shell date -R)|g' \
@@ -370,21 +280,12 @@ endif
dh_link
ifeq ($(DEBUG),)
dh_strip --keep-debug --exclude=libQtCoreVBox.so.4 --exclude=libQtGuiVBox.so.4 --exclude=libQtNetworkVBox.so.4 --exclude=libQtOpenGLVBox.so.4 --exclude=libqtaccessiblewidgets.so
- # manually strip our R0/GC modules, dh_strip cannot handle them
- for f in \
- $(prefix)/usr/lib/$(package)/*.r0 $(prefix)/usr/lib/$(package)/*.gc; do \
- objcopy --only-keep-debug \
- $$f \
- $(prefix)/usr/lib/debug/usr/lib/$(package)/`basename $$f`; \
- strip -S --remove-section=.comment $$f; \
- objcopy --add-gnu-debuglink=$(prefix)/usr/lib/debug/usr/lib/$(package)/`basename $$f` $$f; \
- done
endif
mkdir -p $(current)/debian/$(verpkg)-dbg/usr/lib
ifeq ($(DEBUG),)
mv $(current)/debian/$(verpkg)/usr/lib/debug $(current)/debian/$(verpkg)-dbg/usr/lib
endif
- dh_pycentral
+ $(if $(filter _Ubuntu_hardy _Ubuntu_lucid,$(debrel)),dh_pycentral,dh_python2)
dh_compress -X.pdf -X.chm -X LICENSE -X.py
dh_fixperms
dh_makeshlibs
@@ -399,7 +300,7 @@ endif
-Vdkms=$(if $(filter _Debian_lenny,$(debrel)),,dkms)
dh_md5sums
dh_builddeb --destdir $(pkgdir) -- \
- $(if $(filter _Ubuntu_hardy _Ubuntu_lucid,$(debrel)),,-Zxz)
+ $(if $(filter _Ubuntu_lucid,$(debrel)),,-Zxz)
endif
.PHONY: binary modules binary-arch binary-indep clean checkroot
diff --git a/src/VBox/Installer/linux/distributions_deb b/src/VBox/Installer/linux/distributions_deb
index 3e668628..9b8f3461 100644
--- a/src/VBox/Installer/linux/distributions_deb
+++ b/src/VBox/Installer/linux/distributions_deb
@@ -1,19 +1,7 @@
_Debian_sid = DEBIAN_7_0
_Debian_wheezy = DEBIAN_7_0
_Debian_squeeze = DEBIAN_6_0
-_Debian_lenny = DEBIAN_5_0
-_Debian_etch = DEBIAN_4_0
-_Debian_sarge = DEBIAN_3_1
+_Ubuntu_raring = UBUNTU_13_04
_Ubuntu_quantal = UBUNTU_12_10
_Ubuntu_precise = UBUNTU_12_04
-_Ubuntu_oneiric = UBUNTU_11_10
-_Ubuntu_natty = UBUNTU_11_04
-_Ubuntu_maverick = UBUNTU_10_10
_Ubuntu_lucid = UBUNTU_10_04
-_Ubuntu_karmic = UBUNTU_9_10
-_Ubuntu_jaunty = UBUNTU_9_04
-_Ubuntu_intrepid = UBUNTU_8_10
-_Ubuntu_hardy = UBUNTU_8_04
-_Ubuntu_gutsy = UBUNTU_7_10
-_Ubuntu_dapper = UBUNTU_6_06
-_xandros4.1 = XANDROS_4_1
diff --git a/src/VBox/Installer/linux/distributions_rpm b/src/VBox/Installer/linux/distributions_rpm
index 17e3e6ae..f0591237 100644
--- a/src/VBox/Installer/linux/distributions_rpm
+++ b/src/VBox/Installer/linux/distributions_rpm
@@ -1,36 +1,16 @@
+openSUSE123 = OPENSUSE_12_3
openSUSE114 = OPENSUSE_11_4
openSUSE113 = OPENSUSE_11_3
-openSUSE112 = OPENSUSE_11_2
-openSUSE111 = OPENSUSE_11_1
-openSUSE110 = OPENSUSE_11_0
-openSUSE103 = OPENSUSE_10_3
-openSUSE102 = OPENSUSE_10_2
sles11.0 = SLES_11_0
sles10.1 = SLES_10_1
mdv2011.0 = MANDRIVA_2011_0
-mdv2010.0 = MANDRIVA_2010_0
-mdv2009.1 = MANDRIVA_2009_1
-mdv2008.0 = MANDRIVA_2008_0
-mdv2007.1 = MANDRIVA_2007_1
+fedora18 = FEDORA_18
fedora17 = FEDORA_17
fedora16 = FEDORA_16
fedora15 = FEDORA_15
-fedora14 = FEDORA_14
-fedora13 = FEDORA_13
-fedora12 = FEDORA_12
-fedora11 = FEDORA_11
-fedora9 = FEDORA_9
-fedora8 = FEDORA_8
-fedora7 = FEDORA_7
-fedora6 = FEDORA_6
el6 = EL_6
el5 = EL_5
-el4 = EL_4
centos6 = CENTOS_6
centos5 = CENTOS_5
-centos4 = CENTOS_4
-pclinuxos2007 = PCLINUXOS_2007
-turbolinux11 = TURBOLINUX_11
ol6 = ORACLE_6
ol5 = ORACLE_5
-ol4 = ORACLE_4
diff --git a/src/VBox/Installer/linux/install.sh b/src/VBox/Installer/linux/install.sh
index 67e79b4a..a590e8ae 100755
--- a/src/VBox/Installer/linux/install.sh
+++ b/src/VBox/Installer/linux/install.sh
@@ -4,7 +4,7 @@
# VirtualBox linux installation script
#
-# Copyright (C) 2007-2011 Oracle Corporation
+# 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;
@@ -246,6 +246,7 @@ if [ "$ACTION" = "install" ]; then
# Terminate Server and VBoxNetDHCP if running
terminate_proc VBoxSVC
terminate_proc VBoxNetDHCP
+ terminate_proc VBoxNetNAT
# Remove previous installation
if [ -n "$PREV_INSTALLATION" -a -z "$FORCE_UPGRADE" -a ! "$VERSION" = "$INSTALL_VER" ] &&
@@ -355,22 +356,21 @@ if [ "$ACTION" = "install" ]; then
# create symlinks for working around unsupported $ORIGIN/.. in VBoxC.so (setuid),
# and finally make sure the directory is only writable by the user (paranoid).
if [ -n "$HARDENED" ]; then
- test -e $INSTALLATION_DIR/VirtualBox && chmod 4511 $INSTALLATION_DIR/VirtualBox
- test -e $INSTALLATION_DIR/VBoxSDL && chmod 4511 $INSTALLATION_DIR/VBoxSDL
- test -e $INSTALLATION_DIR/VBoxHeadless && chmod 4511 $INSTALLATION_DIR/VBoxHeadless
- test -e $INSTALLATION_DIR/VBoxNetDHCP && chmod 4511 $INSTALLATION_DIR/VBoxNetDHCP
+ test -e $INSTALLATION_DIR/VirtualBox && chmod 4511 $INSTALLATION_DIR/VirtualBox
+ test -e $INSTALLATION_DIR/VBoxSDL && chmod 4511 $INSTALLATION_DIR/VBoxSDL
+ test -e $INSTALLATION_DIR/VBoxHeadless && chmod 4511 $INSTALLATION_DIR/VBoxHeadless
+ test -e $INSTALLATION_DIR/VBoxNetDHCP && chmod 4511 $INSTALLATION_DIR/VBoxNetDHCP
+ test -e $INSTALLATION_DIR/VBoxNetNAT && chmod 4511 $INSTALLATION_DIR/VBoxNetNAT
ln -sf $INSTALLATION_DIR/VBoxVMM.so $INSTALLATION_DIR/components/VBoxVMM.so
- ln -sf $INSTALLATION_DIR/VBoxREM.so $INSTALLATION_DIR/components/VBoxREM.so
ln -sf $INSTALLATION_DIR/VBoxRT.so $INSTALLATION_DIR/components/VBoxRT.so
- ln -sf $INSTALLATION_DIR/VBoxDDU.so $INSTALLATION_DIR/components/VBoxDDU.so
- ln -sf $INSTALLATION_DIR/VBoxXPCOM.so $INSTALLATION_DIR/components/VBoxXPCOM.so
chmod go-w $INSTALLATION_DIR
fi
- # This binary needs to be suid root in any case, even if not hardened
+ # This binaries need to be suid root in any case, even if not hardened
test -e $INSTALLATION_DIR/VBoxNetAdpCtl && chmod 4511 $INSTALLATION_DIR/VBoxNetAdpCtl
+ test -e $INSTALLATION_DIR/VBoxVolInfo && chmod 4511 $INSTALLATION_DIR/VBoxVolInfo
# Install runlevel scripts
# Note: vboxdrv is also handled by setup_init_script. This function will
@@ -391,7 +391,7 @@ if [ "$ACTION" = "install" ]; then
addrunlevel vboxweb-service 25 75 # This may produce useful output
# Create users group
- groupadd $GROUPNAME 2> /dev/null
+ groupadd -r -f $GROUPNAME 2> /dev/null
# Create symlinks to start binaries
ln -sf $INSTALLATION_DIR/VBox.sh /usr/bin/VirtualBox
@@ -423,7 +423,7 @@ if [ "$ACTION" = "install" ]; then
cd $i
if [ -d /usr/share/icons/hicolor/$i ]; then
for j in *; do
- if [ "$j" = "virtualbox.png" ]; then
+ if expr "$j" : "virtualbox\..*" > /dev/null; then
dst=apps
else
dst=mimetypes
diff --git a/src/VBox/Installer/linux/install_service/Makefile.kmk b/src/VBox/Installer/linux/install_service/Makefile.kmk
new file mode 100644
index 00000000..812a75ea
--- /dev/null
+++ b/src/VBox/Installer/linux/install_service/Makefile.kmk
@@ -0,0 +1,49 @@
+# $Id: Makefile.kmk $
+## @file
+# Sub-Makefile for the Linux installer init file generator.
+#
+
+#
+# Copyright (C) 2006-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.
+#
+
+SUB_DEPTH = ../../../../..
+include $(KBUILD_PATH)/subheader.kmk
+
+#
+# generate_service_file
+#
+PROGRAMS.linux += generate_service_file
+
+generate_service_file_TEMPLATE = VBOXR3EXE
+generate_service_file_SOURCES = generate_service_file.cpp
+generate_service_file_INST = $(INST_BIN)helpers/
+generate_service_file_LIBS = $(LIB_RUNTIME)
+ifdef VBOX_WITH_RUNPATH
+ generate_service_file_LDFLAGS = '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)'
+else ifdef VBOX_WITH_RELATIVE_RUNPATH
+ generate_service_file_LDFLAGS = '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)/..'
+endif
+
+INSTALLS.linux += linux-install-service-bin
+linux-install-service-bin_INST = bin/scripts/
+linux-install-service-bin_MODE = a+rx,u+w
+linux-install-service-bin_SOURCES = \
+ install_service.sh=>install_service
+
+INSTALLS.linux += linux-install-service-nobin
+linux-install-service-nobin_INST = bin/scripts/
+linux-install-service-nobin_MODE = a+r,u+w
+linux-install-service-nobin_SOURCES = \
+ init_template.sh
+
+include $(FILE_KBUILD_SUB_FOOTER)
+
diff --git a/src/VBox/Installer/linux/install_service/generate_service_file.cpp b/src/VBox/Installer/linux/install_service/generate_service_file.cpp
new file mode 100644
index 00000000..2ff27573
--- /dev/null
+++ b/src/VBox/Installer/linux/install_service/generate_service_file.cpp
@@ -0,0 +1,912 @@
+/* $Id: generate_service_file.cpp $ */
+/** @file
+ * Read a service file template from standard input and output a service file
+ * to standard output generated from the template based on arguments passed to
+ * the utility. See the usage text for more information.
+ */
+
+/*
+ * 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.
+ */
+
+/**
+ * Description of the generation process.
+ *
+ * A template for the service file to be generated is fed into standard input
+ * and the service file is sent to standard output. The following
+ * substitutions are performed based on the command line parameters supplied,
+ * with all quoting appropriate to the format of the template as specified on
+ * the command line.
+ *
+ * %COMMAND% -> path to the service binary or script.
+ * %ARGUMENTS% -> the arguments to pass to the binary when starting the
+ * service.
+ * %SERVICE_NAME% -> the name of the service.
+ * %DESCRIPTION% -> the short description of the service.
+ * %STOP_COMMAND% -> path to the command used to stop the service.
+ * %STOP_ARGUMENTS% -> the arguments for the stop command
+ * %STATUS_COMMAND% -> path to the command used to determine the service
+ * status.
+ * %STATUS_ARGUMENTS% -> the arguments for the status command
+
+ * %NO_STOP_COMMAND% -> if no stop command was specified, this and all text
+ * following it on the line (including the end-of-
+ * line) will be removed, otherwise only the marker
+ * will be removed.
+ * %HAVE_STOP_COMMAND% -> like above, but text on the line will be removed
+ * if a stop command was supplied.
+ * %NO_STATUS_COMMAND% -> Analogue to %NO_STOP_COMMAND% for the status
+ * command.
+ * %HAVE_STATUS_COMMAND% -> Analogue to %HAVE_STOP_COMMAND% for the status
+ * command.
+ * %HAVE_ONESHOT% -> like above, text on the line will be removed unless
+ * --one-shot was specified on the command line.
+ * %HAVE_DAEMON% -> the same if --one-shot was not specified.
+ *
+ * %% will be replaced with a single %.
+ */
+
+#include <VBox/version.h>
+
+#include <iprt/ctype.h>
+#include <iprt/getopt.h>
+#include <iprt/initterm.h>
+#include <iprt/mem.h>
+#include <iprt/message.h>
+#include <iprt/path.h>
+#include <iprt/stream.h>
+#include <iprt/string.h>
+
+#ifndef READ_SIZE
+/** How much of the input we read at a time. Override to something small for
+ * testing. */
+# define READ_SIZE _1M
+#endif
+
+/* Macros for the template substitution sequences to guard against mis-types. */
+#define COMMAND "%COMMAND%"
+#define ARGUMENTS "%ARGUMENTS%"
+#define DESCRIPTION "%DESCRIPTION%"
+#define SERVICE_NAME "%SERVICE_NAME%"
+#define HAVE_ONESHOT "%HAVE_ONESHOT%"
+#define HAVE_DAEMON "%HAVE_DAEMON%"
+#define STOP_COMMAND "%STOP_COMMAND%"
+#define STOP_ARGUMENTS "%STOP_ARGUMENTS%"
+#define HAVE_STOP_COMMAND "%HAVE_STOP_COMMAND%"
+#define NO_STOP_COMMAND "%NO_STOP_COMMAND%"
+#define STATUS_COMMAND "%STATUS_COMMAND%"
+#define STATUS_ARGUMENTS "%STATUS_ARGUMENTS%"
+#define HAVE_STATUS_COMMAND "%HAVE_STATUS_COMMAND%"
+#define NO_STATUS_COMMAND "%NO_STATUS_COMMAND%"
+
+void showLogo(void)
+{
+ static bool s_fShown; /* show only once */
+
+ RTPrintf(VBOX_PRODUCT " Service File Generator Version "
+ VBOX_VERSION_STRING "\n"
+ "(C) 2012" /* "-" VBOX_C_YEAR */ " " VBOX_VENDOR "\n"
+ "All rights reserved.\n"
+ "\n");
+}
+
+static void showOptions(void);
+
+void showUsage(const char *pcszArgv0)
+{
+ const char *pcszName = strrchr(pcszArgv0, '/');
+ if (!pcszName)
+ pcszName = pcszArgv0;
+ RTPrintf(
+"Usage:\n"
+"\n"
+" %s --help|-h|-?|--version|-V|--format <format> <parameters...>\n\n",
+ pcszArgv0);
+ RTPrintf(
+"Read a service file template from standard input and output a service file to\n"
+"standard output which was generated from the template based on parameters\n"
+"passed on the utility's command line. Generation is done by replacing well-\n"
+"known text sequences in the template with strings based on the parameters.\n"
+"All strings should be in UTF-8 format. Processing will stop if a sequence is\n"
+"read which cannot be replace based on the parameters supplied.\n\n");
+
+ RTPrintf(
+" --help|-h|-?\n"
+" Print this help text and exit.\n\n"
+" --version|-V\n"
+" Print version information and exit.\n\n"
+" --format <shell>\n"
+" The format of the template. Currently only \"shell\" for shell script\n"
+" is supported. This affects escaping of strings substituted.\n\n");
+ RTPrintf(
+"Parameters:\n"
+"\n");
+ RTPrintf(
+" --command <command>\n"
+" The absolute path of the executable file to be started by the service.\n"
+" No form of quoting should be used here.\n\n");
+ RTPrintf(
+" --description <description>\n"
+" A short description of the service which can also be used in sentences\n"
+" like \"<description> failed to start.\", as a single parameter. Characters\n"
+" 0 to 31 and 127 should not be used.\n\n"
+ );
+ RTPrintf(
+" --arguments <arguments>\n"
+" The arguments to pass to the executable file when it is started, as a\n"
+" single parameter. Characters \" \", \"\\\" and \"%%\" must be escaped with\n"
+" back-slashes and C string-style back-slash escapes are recognised. Some\n"
+" systemd-style \"%%\" sequences may be added at a future time.\n\n");
+ RTPrintf(
+" --service-name <name>\n"
+" Specify the name of the service. By default the base name without the\n"
+" extension of the command binary is used. Only ASCII characters 33 to 126\n"
+" should be used.\n\n");
+ RTPrintf(
+" --one-shot\n"
+" The service command is expected to do some work and exit immediately with"
+" a status indicating success or failure.\n\n"
+ );
+ RTPrintf(
+" --stop-command <command>\n"
+" The command which should be used to stop the service before sending the\n"
+" termination signal to the main process. No form of quoting should be\n"
+" used here.\n\n"
+ );
+ RTPrintf(
+" --stop-arguments <arguments>\n"
+" Arguments for the stop command. This may only be used in combination\n"
+" with \"--stop-command\". Quoting is the same as for \"--arguments\".\n\n"
+ );
+ RTPrintf(
+" --status-command <command>\n"
+" The command which should be used to determine the status of the service.\n"
+" This may not be respected by all service management systems. The command\n"
+" should return an LSB status code. No form of quoting should be used.\n\n"
+ );
+ RTPrintf(
+" --stop-arguments <arguments>\n"
+" Arguments for the status command. This may only be used in combination\n"
+" with \"--status-command\". Quoting is the same as for \"--arguments\".\n\n"
+ );
+}
+
+/** @name Template format.
+ * @{
+ */
+enum ENMFORMAT
+{
+ /** No format selected. */
+ FORMAT_NONE = 0,
+ /** Shell script format. */
+ FORMAT_SHELL
+};
+/** @} */
+
+struct SERVICEPARAMETERS
+{
+ enum ENMFORMAT enmFormat;
+ const char *pcszCommand;
+ const char *pcszArguments;
+ const char *pcszDescription;
+ const char *pcszServiceName;
+ bool fOneShot;
+ const char *pcszStopCommand;
+ const char *pcszStopArguments;
+ const char *pcszStatusCommand;
+ const char *pcszStatusArguments;
+};
+
+static bool errorIfSet(const char *pcszName, bool isSet);
+static enum ENMFORMAT getFormat(const char *pcszName, const char *pcszValue);
+static bool checkAbsoluteFilePath(const char *pcszName, const char *pcszValue);
+static bool checkPrintable(const char *pcszName, const char *pcszValue);
+static bool checkGraphic(const char *pcszName, const char *pcszValue);
+static bool createServiceFile(struct SERVICEPARAMETERS *pParameters);
+
+int main(int cArgs, char **apszArgs)
+{
+ int rc = RTR3InitExe(cArgs, &apszArgs, 0);
+ if (RT_FAILURE(rc))
+ return RTMsgInitFailure(rc);
+
+ enum
+ {
+ OPTION_FORMAT = 1,
+ OPTION_COMMAND,
+ OPTION_ARGUMENTS,
+ OPTION_DESCRIPTION,
+ OPTION_SERVICE_NAME,
+ OPTION_ONE_SHOT,
+ OPTION_STOP_COMMAND,
+ OPTION_STOP_ARGUMENTS,
+ OPTION_STATUS_COMMAND,
+ OPTION_STATUS_ARGUMENTS
+ };
+
+ static const RTGETOPTDEF s_aOptions[] =
+ {
+ { "--format", OPTION_FORMAT,
+ RTGETOPT_REQ_STRING },
+ { "--command", OPTION_COMMAND,
+ RTGETOPT_REQ_STRING },
+ { "--arguments", OPTION_ARGUMENTS,
+ RTGETOPT_REQ_STRING },
+ { "--description", OPTION_DESCRIPTION,
+ RTGETOPT_REQ_STRING },
+ { "--service-name", OPTION_SERVICE_NAME,
+ RTGETOPT_REQ_STRING },
+ { "--one-shot", OPTION_ONE_SHOT,
+ RTGETOPT_REQ_NOTHING },
+ { "--stop-command", OPTION_STOP_COMMAND,
+ RTGETOPT_REQ_STRING },
+ { "--stop-arguments", OPTION_STOP_ARGUMENTS,
+ RTGETOPT_REQ_STRING },
+ { "--status-command", OPTION_STATUS_COMMAND,
+ RTGETOPT_REQ_STRING },
+ { "--status-arguments", OPTION_STATUS_ARGUMENTS,
+ RTGETOPT_REQ_STRING }
+ };
+
+ int ch;
+ struct SERVICEPARAMETERS Parameters = { FORMAT_NONE };
+ RTGETOPTUNION ValueUnion;
+ RTGETOPTSTATE GetState;
+ RTGetOptInit(&GetState, cArgs, apszArgs, s_aOptions,
+ RT_ELEMENTS(s_aOptions), 1, 0);
+ while ((ch = RTGetOpt(&GetState, &ValueUnion)))
+ {
+ switch (ch)
+ {
+ case 'h':
+ showUsage(apszArgs[0]);
+ return RTEXITCODE_SUCCESS;
+ break;
+
+ case 'V':
+ showLogo();
+ return RTEXITCODE_SUCCESS;
+ break;
+
+ case OPTION_FORMAT:
+ if (errorIfSet("--format",
+ Parameters.enmFormat != FORMAT_NONE))
+ return(RTEXITCODE_SYNTAX);
+ Parameters.enmFormat
+ = getFormat("--format", ValueUnion.psz);
+ if (Parameters.enmFormat == FORMAT_NONE)
+ return(RTEXITCODE_SYNTAX);
+ break;
+
+ case OPTION_COMMAND:
+ if (errorIfSet("--command", Parameters.pcszCommand))
+ return(RTEXITCODE_SYNTAX);
+ Parameters.pcszCommand = ValueUnion.psz;
+ if (!checkAbsoluteFilePath("--command",
+ Parameters.pcszCommand))
+ return(RTEXITCODE_SYNTAX);
+ break;
+
+ case OPTION_ARGUMENTS:
+ if (errorIfSet("--arguments",
+ Parameters.pcszArguments))
+ return(RTEXITCODE_SYNTAX);
+ /* Quoting will be checked while writing out the string. */
+ Parameters.pcszArguments = ValueUnion.psz;
+ break;
+
+ case OPTION_DESCRIPTION:
+ if (errorIfSet("--description",
+ Parameters.pcszDescription))
+ return(RTEXITCODE_SYNTAX);
+ Parameters.pcszDescription = ValueUnion.psz;
+ if (!checkPrintable("--description",
+ Parameters.pcszDescription))
+ return(RTEXITCODE_SYNTAX);
+ break;
+
+ case OPTION_SERVICE_NAME:
+ if (errorIfSet("--service-name",
+ Parameters.pcszServiceName))
+ return(RTEXITCODE_SYNTAX);
+ Parameters.pcszServiceName = ValueUnion.psz;
+ if (!checkGraphic("--service-name",
+ Parameters.pcszServiceName))
+ return(RTEXITCODE_SYNTAX);
+ break;
+
+ case OPTION_ONE_SHOT:
+ Parameters.fOneShot = true;
+ break;
+
+ case OPTION_STOP_COMMAND:
+ if (errorIfSet("--stop-command",
+ Parameters.pcszStopCommand))
+ return(RTEXITCODE_SYNTAX);
+ Parameters.pcszStopCommand = ValueUnion.psz;
+ if (!checkAbsoluteFilePath("--stop-command",
+ Parameters.pcszStopCommand))
+ return(RTEXITCODE_SYNTAX);
+ break;
+
+ case OPTION_STOP_ARGUMENTS:
+ if (errorIfSet("--stop-arguments",
+ Parameters.pcszStopArguments))
+ return(RTEXITCODE_SYNTAX);
+ /* Quoting will be checked while writing out the string. */
+ Parameters.pcszStopArguments = ValueUnion.psz;
+ break;
+
+ case OPTION_STATUS_COMMAND:
+ if (errorIfSet("--status-command",
+ Parameters.pcszStatusCommand))
+ return(RTEXITCODE_SYNTAX);
+ Parameters.pcszStatusCommand = ValueUnion.psz;
+ if (!checkAbsoluteFilePath("--status-command",
+ Parameters.pcszStatusCommand))
+ return(RTEXITCODE_SYNTAX);
+ break;
+
+ case OPTION_STATUS_ARGUMENTS:
+ if (errorIfSet("--status-arguments",
+ Parameters.pcszStatusArguments))
+ return(RTEXITCODE_SYNTAX);
+ /* Quoting will be checked while writing out the string. */
+ Parameters.pcszStatusArguments = ValueUnion.psz;
+ break;
+
+ default:
+ return RTGetOptPrintError(ch, &ValueUnion);
+ }
+ }
+ if (Parameters.enmFormat == FORMAT_NONE)
+ {
+ RTStrmPrintf(g_pStdErr, "--format must be specified.\n");
+ return(RTEXITCODE_SYNTAX);
+ }
+ if (Parameters.pcszArguments && !Parameters.pcszCommand)
+ {
+ RTStrmPrintf(g_pStdErr, "--arguments requires --command to be specified.\n");
+ return(RTEXITCODE_SYNTAX);
+ }
+ if (Parameters.pcszStopArguments && !Parameters.pcszStopCommand)
+ {
+ RTStrmPrintf(g_pStdErr, "--stop-arguments requires --stop-command to be specified.\n");
+ return(RTEXITCODE_SYNTAX);
+ }
+ if (Parameters.pcszStatusArguments && !Parameters.pcszStatusCommand)
+ {
+ RTStrmPrintf(g_pStdErr, "--status-arguments requires --status-command to be specified.\n");
+ return(RTEXITCODE_SYNTAX);
+ }
+ return createServiceFile(&Parameters)
+ ? RTEXITCODE_SUCCESS
+ : RTEXITCODE_FAILURE;
+}
+
+/** Print an error and return true if an option is already set. */
+bool errorIfSet(const char *pcszName, bool isSet)
+{
+ if (isSet)
+ RTStrmPrintf(g_pStdErr, "%s may only be specified once.\n", pcszName);
+ return isSet;
+}
+
+/** Match the string to a known format and return that (or "none" and print an
+ * error). */
+enum ENMFORMAT getFormat(const char *pcszName, const char *pcszValue)
+{
+ if (!strcmp(pcszValue, "shell"))
+ return FORMAT_SHELL;
+ RTStrmPrintf(g_pStdErr, "%s: unknown format %s.\n", pcszName, pcszValue);
+ return FORMAT_NONE;
+}
+
+/** Check that the string is an absolute path to a file or print an error. */
+bool checkAbsoluteFilePath(const char *pcszName, const char *pcszValue)
+{
+ if (RTPathFilename(pcszValue) && RTPathStartsWithRoot(pcszValue))
+ return true;
+ RTStrmPrintf(g_pStdErr, "%s: %s must be an absolute path of a file.\n", pcszName, pcszValue);
+ return false;
+}
+
+/** Check that the string does not contain any non-printable characters. */
+bool checkPrintable(const char *pcszName, const char *pcszValue)
+{
+ const char *pcch = pcszValue;
+ for (; *pcch; ++pcch)
+ {
+ if (!RT_C_IS_PRINT(*pcch))
+ {
+ RTStrmPrintf(g_pStdErr, "%s: invalid character after \"%.*s\".\n",
+ pcszName, pcch - pcszValue, pcszValue);
+ return false;
+ }
+ }
+ return true;
+}
+
+/** Check that the string does not contain any non-graphic characters. */
+static bool checkGraphic(const char *pcszName, const char *pcszValue)
+{
+ const char *pcch = pcszValue;
+ for (; *pcch; ++pcch)
+ {
+ if (!RT_C_IS_GRAPH(*pcch))
+ {
+ RTStrmPrintf(g_pStdErr, "%s: invalid character after \"%.*s\".\n",
+ pcszName, pcch - pcszValue, pcszValue);
+ return false;
+ }
+ }
+ return true;
+}
+
+static bool createServiceFileCore(char **ppachTemplate,
+ struct SERVICEPARAMETERS
+ *pParamters);
+
+/**
+ * Read standard input and write it to standard output, doing all substitutions
+ * as per the usage documentation.
+ * @note This is a wrapper around the actual function to simplify resource
+ * allocation without requiring a single point of exit.
+ */
+bool createServiceFile(struct SERVICEPARAMETERS *pParameters)
+{
+ char *pachTemplate = NULL;
+ bool rc = createServiceFileCore(&pachTemplate, pParameters);
+ RTMemFree(pachTemplate);
+ return rc;
+}
+
+static bool getSequence(const char *pach, size_t cch, size_t *pcchRead,
+ const char *pcszSequence, size_t cchSequence);
+static bool writeCommand(enum ENMFORMAT enmFormat, const char *pcszCommand);
+static bool writeQuoted(enum ENMFORMAT enmFormat, const char *pcszQuoted);
+static bool writePrintableString(enum ENMFORMAT enmFormat,
+ const char *pcszString);
+static void skipLine(const char *pach, size_t cch, size_t *pcchRead);
+
+/** The actual implemenation code for @a createServiceFile. */
+bool createServiceFileCore(char **ppachTemplate,
+ struct SERVICEPARAMETERS *pParameters)
+{
+ /* The size of the template data we have read. */
+ size_t cchTemplate = 0;
+ /* The size of the buffer we have allocated. */
+ size_t cbBuffer = 0;
+ /* How much of the template data we have written out. */
+ size_t cchWritten = 0;
+ int rc = VINF_SUCCESS;
+ /* First of all read in the file. */
+ while (rc != VINF_EOF)
+ {
+ size_t cchRead;
+
+ if (cchTemplate == cbBuffer)
+ {
+ cbBuffer += READ_SIZE;
+ *ppachTemplate = (char *)RTMemRealloc((void *)*ppachTemplate,
+ cbBuffer);
+ }
+ if (!*ppachTemplate)
+ {
+ RTStrmPrintf(g_pStdErr, "Out of memory.\n");
+ return false;
+ }
+ rc = RTStrmReadEx(g_pStdIn, *ppachTemplate + cchTemplate,
+ cbBuffer - cchTemplate, &cchRead);
+ if (RT_FAILURE(rc))
+ {
+ RTStrmPrintf(g_pStdErr, "Error reading input: %Rrc\n", rc);
+ return false;
+ }
+ if (!cchRead)
+ rc = VINF_EOF;
+ cchTemplate += cchRead;
+ }
+ while (true)
+ {
+ /* Find the next '%' character if any and write out up to there (or the
+ * end if there is no '%'). */
+ char *pchNext = (char *) memchr((void *)(*ppachTemplate + cchWritten),
+ '%', cchTemplate - cchWritten);
+ size_t cchToWrite = pchNext
+ ? pchNext - *ppachTemplate - cchWritten
+ : cchTemplate - cchWritten;
+ rc = RTStrmWrite(g_pStdOut, *ppachTemplate + cchWritten, cchToWrite);
+ if (RT_FAILURE(rc))
+ {
+ RTStrmPrintf(g_pStdErr, "Error writing output: %Rrc\n", rc);
+ return false;
+ }
+ cchWritten += cchToWrite;
+ if (!pchNext)
+ break;
+ /* And substitute any of our well-known strings. We favour code
+ * readability over efficiency here. */
+ if (getSequence(*ppachTemplate, cchTemplate, &cchWritten,
+ COMMAND, sizeof(COMMAND) - 1))
+ {
+ if (!pParameters->pcszCommand)
+ {
+ RTStrmPrintf(g_pStdErr, "--command not specified.\n");
+ return false;
+ }
+ if (!writeCommand(pParameters->enmFormat,
+ pParameters->pcszCommand))
+ return false;
+ }
+ else if (getSequence(*ppachTemplate, cchTemplate, &cchWritten,
+ ARGUMENTS, sizeof(ARGUMENTS) - 1))
+ {
+ if ( pParameters->pcszArguments
+ && !writeQuoted(pParameters->enmFormat,
+ pParameters->pcszArguments))
+ return false;
+ }
+ else if (getSequence(*ppachTemplate, cchTemplate, &cchWritten,
+ DESCRIPTION, sizeof(DESCRIPTION) - 1))
+ {
+ if (!pParameters->pcszDescription)
+ {
+ RTStrmPrintf(g_pStdErr, "--description not specified.\n");
+ return false;
+ }
+ if (!writePrintableString(pParameters->enmFormat,
+ pParameters->pcszDescription))
+ return false;
+ }
+ else if (getSequence(*ppachTemplate, cchTemplate, &cchWritten,
+ SERVICE_NAME, sizeof(SERVICE_NAME) - 1))
+ {
+ if ( !pParameters->pcszCommand
+ && !pParameters->pcszServiceName)
+ {
+ RTStrmPrintf(g_pStdErr, "Neither --command nor --service-name specified.\n");
+ return false;
+ }
+ if (pParameters->pcszServiceName)
+ {
+ if (!writePrintableString(pParameters->enmFormat,
+ pParameters->pcszServiceName))
+ return false;
+ }
+ else
+ {
+ const char *pcszFileName =
+ RTPathFilename(pParameters->pcszCommand);
+ const char *pcszExtension =
+ RTPathExt(pParameters->pcszCommand);
+ char *pszName = RTStrDupN(pcszFileName,
+ pcszExtension
+ ? pcszExtension - pcszFileName
+ : RTPATH_MAX);
+ bool fRc;
+ if (!pszName)
+ {
+ RTStrmPrintf(g_pStdErr, "Out of memory.\n");
+ return false;
+ }
+ fRc = writePrintableString(pParameters->enmFormat,
+ pszName);
+ RTStrFree(pszName);
+ if (!fRc)
+ return false;
+ }
+ }
+ else if (getSequence(*ppachTemplate, cchTemplate, &cchWritten,
+ HAVE_ONESHOT, sizeof(HAVE_ONESHOT) - 1))
+ {
+ if (!pParameters->fOneShot)
+ skipLine(*ppachTemplate, cchTemplate, &cchWritten);
+ }
+ else if (getSequence(*ppachTemplate, cchTemplate, &cchWritten,
+ HAVE_DAEMON, sizeof(HAVE_DAEMON) - 1))
+ {
+ if (pParameters->fOneShot)
+ skipLine(*ppachTemplate, cchTemplate, &cchWritten);
+ }
+ else if (getSequence(*ppachTemplate, cchTemplate, &cchWritten,
+ STOP_COMMAND, sizeof(STOP_COMMAND) - 1))
+ {
+ if ( pParameters->pcszStopCommand
+ && !writeCommand(pParameters->enmFormat,
+ pParameters->pcszStopCommand))
+ return false;
+ }
+ else if (getSequence(*ppachTemplate, cchTemplate, &cchWritten,
+ STOP_ARGUMENTS, sizeof(STOP_ARGUMENTS) - 1))
+ {
+ if ( pParameters->pcszStopArguments
+ && !writeQuoted(pParameters->enmFormat,
+ pParameters->pcszStopArguments))
+ return false;
+ }
+ else if (getSequence(*ppachTemplate, cchTemplate, &cchWritten,
+ HAVE_STOP_COMMAND, sizeof(HAVE_STOP_COMMAND) - 1))
+ {
+ if (!pParameters->pcszStopCommand)
+ skipLine(*ppachTemplate, cchTemplate, &cchWritten);
+ }
+ else if (getSequence(*ppachTemplate, cchTemplate, &cchWritten,
+ NO_STOP_COMMAND, sizeof(NO_STOP_COMMAND) - 1))
+ {
+ if (pParameters->pcszStopCommand)
+ skipLine(*ppachTemplate, cchTemplate, &cchWritten);
+ }
+ else if (getSequence(*ppachTemplate, cchTemplate, &cchWritten,
+ STATUS_COMMAND, sizeof(STATUS_COMMAND) - 1))
+ {
+ if ( pParameters->pcszStatusCommand
+ && !writeCommand(pParameters->enmFormat,
+ pParameters->pcszStatusCommand))
+ return false;
+ }
+ else if (getSequence(*ppachTemplate, cchTemplate, &cchWritten,
+ STATUS_ARGUMENTS, sizeof(STATUS_ARGUMENTS) - 1))
+ {
+ if ( pParameters->pcszStatusArguments
+ && !writeQuoted(pParameters->enmFormat,
+ pParameters->pcszStatusArguments))
+ return false;
+ }
+ else if (getSequence(*ppachTemplate, cchTemplate, &cchWritten,
+ HAVE_STATUS_COMMAND,
+ sizeof(HAVE_STATUS_COMMAND) - 1))
+ {
+ if (!pParameters->pcszStatusCommand)
+ skipLine(*ppachTemplate, cchTemplate, &cchWritten);
+ }
+ else if (getSequence(*ppachTemplate, cchTemplate, &cchWritten,
+ NO_STATUS_COMMAND, sizeof(NO_STATUS_COMMAND) - 1))
+ {
+ if (pParameters->pcszStatusCommand)
+ skipLine(*ppachTemplate, cchTemplate, &cchWritten);
+ }
+ else if (getSequence(*ppachTemplate, cchTemplate, &cchWritten,
+ "%%", 2))
+ {
+ rc = RTStrmPutCh(g_pStdOut, '%');
+ if (RT_FAILURE(rc))
+ {
+ RTStrmPrintf(g_pStdErr, "Error writing output: %Rrc\n", rc);
+ return false;
+ }
+ }
+ else
+ {
+ RTStrmPrintf(g_pStdErr, "Unknown substitution sequence in input at \"%.*s\"\n",
+ RT_MIN(16, cchTemplate - cchWritten),
+ *ppachTemplate + cchWritten);
+ return false;
+ }
+ }
+ return true;
+}
+
+bool getSequence(const char *pach, size_t cch, size_t *pcchRead,
+ const char *pcszSequence, size_t cchSequence)
+{
+ if ( cch - *pcchRead >= cchSequence
+ && !RTStrNCmp(pach + *pcchRead, pcszSequence, cchSequence))
+ {
+ *pcchRead += cchSequence;
+ return true;
+ }
+ return false;
+}
+
+/** Write a character to standard output and print an error and return false on
+ * failure. */
+bool outputCharacter(char ch)
+{
+ int rc = RTStrmWrite(g_pStdOut, &ch, 1);
+ if (RT_FAILURE(rc))
+ {
+ RTStrmPrintf(g_pStdErr, "Error writing output: %Rrc\n", rc);
+ return false;
+ }
+ return true;
+}
+
+/** Write a string to standard output and print an error and return false on
+ * failure. */
+bool outputString(const char *pcsz)
+{
+ int rc = RTStrmPutStr(g_pStdOut, pcsz);
+ if (RT_FAILURE(rc))
+ {
+ RTStrmPrintf(g_pStdErr, "Error writing output: %Rrc\n", rc);
+ return false;
+ }
+ return true;
+}
+
+/** Write a character to standard output, adding any escaping needed for the
+ * format being written. */
+static bool escapeAndOutputCharacter(enum ENMFORMAT enmFormat, char ch)
+{
+ if (enmFormat == FORMAT_SHELL)
+ {
+ if (ch == '\'')
+ return outputString("\'\\\'\'");
+ return outputCharacter(ch);
+ }
+ RTStrmPrintf(g_pStdErr, "Error: unknown template format.\n");
+ return false;
+}
+
+/** Write a character to standard output, adding any escaping needed for the
+ * format being written. */
+static bool outputArgumentSeparator(enum ENMFORMAT enmFormat)
+{
+ if (enmFormat == FORMAT_SHELL)
+ return outputString("\' \'");
+ RTStrmPrintf(g_pStdErr, "Error: unknown template format.\n");
+ return false;
+}
+
+bool writeCommand(enum ENMFORMAT enmFormat, const char *pcszCommand)
+{
+ if (enmFormat == FORMAT_SHELL)
+ if (!outputCharacter('\''))
+ return false;
+ for (; *pcszCommand; ++pcszCommand)
+ if (enmFormat == FORMAT_SHELL)
+ {
+ if (*pcszCommand == '\'')
+ {
+ if (!outputString("\'\\\'\'"))
+ return false;
+ }
+ else if (!outputCharacter(*pcszCommand))
+ return false;
+ }
+ if (enmFormat == FORMAT_SHELL)
+ if (!outputCharacter('\''))
+ return false;
+ return true;
+}
+
+const char aachEscapes[][2] =
+{
+ { 'a', '\a' }, { 'b', '\b' }, { 'f', '\f' }, { 'n', '\n' }, { 'r', '\r' },
+ { 't', '\t' }, { 'v', '\v' }, { 0, 0 }
+};
+
+bool writeQuoted(enum ENMFORMAT enmFormat, const char *pcszQuoted)
+{
+ /* Was the last character seen a back slash? */
+ bool fEscaped = false;
+ /* Was the last character seen an argument separator (an unescaped space)?
+ */
+ bool fNextArgument = false;
+
+ if (enmFormat == FORMAT_SHELL)
+ if (!outputCharacter('\''))
+ return false;
+ for (; *pcszQuoted; ++pcszQuoted)
+ {
+ if (fEscaped)
+ {
+ bool fRc = true;
+ const char (*pachEscapes)[2];
+ fEscaped = false;
+ /* One-letter escapes. */
+ for (pachEscapes = aachEscapes; (*pachEscapes)[0]; ++pachEscapes)
+ if (*pcszQuoted == (*pachEscapes)[0])
+ {
+ if (!escapeAndOutputCharacter(enmFormat, (*pachEscapes)[1]))
+ return false;
+ break;
+ }
+ if ((*pachEscapes)[0])
+ continue;
+ /* Octal. */
+ if (*pcszQuoted >= '0' && *pcszQuoted <= '7')
+ {
+ uint8_t cNum;
+ char *pchNext;
+ char achDigits[4];
+ int rc;
+ RTStrCopy(achDigits, sizeof(achDigits), pcszQuoted);
+ rc = RTStrToUInt8Ex(achDigits, &pchNext, 8, &cNum);
+ if (rc == VWRN_NUMBER_TOO_BIG)
+ {
+ RTStrmPrintf(g_pStdErr, "Invalid octal sequence at \"%.16s\"\n",
+ pcszQuoted - 1);
+ return false;
+ }
+ if (!escapeAndOutputCharacter(enmFormat, cNum))
+ return false;
+ pcszQuoted += pchNext - achDigits - 1;
+ continue;
+ }
+ /* Hexadecimal. */
+ if (*pcszQuoted == 'x')
+ {
+ uint8_t cNum;
+ char *pchNext;
+ char achDigits[3];
+ int rc;
+ RTStrCopy(achDigits, sizeof(achDigits), pcszQuoted + 1);
+ rc = RTStrToUInt8Ex(achDigits, &pchNext, 16, &cNum);
+ if ( rc == VWRN_NUMBER_TOO_BIG
+ || rc == VWRN_NEGATIVE_UNSIGNED
+ || RT_FAILURE(rc))
+ {
+ RTStrmPrintf(g_pStdErr, "Invalid hexadecimal sequence at \"%.16s\"\n",
+ pcszQuoted - 1);
+ return false;
+ }
+ if (!escapeAndOutputCharacter(enmFormat, cNum))
+ return false;
+ pcszQuoted += pchNext - achDigits;
+ continue;
+ }
+ /* Output anything else non-zero as is. */
+ if (*pcszQuoted)
+ {
+ if (!escapeAndOutputCharacter(enmFormat, *pcszQuoted))
+ return false;
+ continue;
+ }
+ RTStrmPrintf(g_pStdErr, "Trailing back slash in argument.\n");
+ return false;
+ }
+ /* Argument separator. */
+ if (*pcszQuoted == ' ')
+ {
+ if (!fNextArgument && !outputArgumentSeparator(enmFormat))
+ return false;
+ fNextArgument = true;
+ continue;
+ }
+ else
+ fNextArgument = false;
+ /* Start of escape sequence. */
+ if (*pcszQuoted == '\\')
+ {
+ fEscaped = true;
+ continue;
+ }
+ /* Anything else. */
+ if (!outputCharacter(*pcszQuoted))
+ return false;
+ }
+ if (enmFormat == FORMAT_SHELL)
+ if (!outputCharacter('\''))
+ return false;
+ return true;
+}
+
+bool writePrintableString(enum ENMFORMAT enmFormat, const char *pcszString)
+{
+ if (enmFormat == FORMAT_SHELL)
+ return outputString(pcszString);
+ RTStrmPrintf(g_pStdErr, "Error: unknown template format.\n");
+ return false;
+}
+
+void skipLine(const char *pach, size_t cch, size_t *pcchRead)
+{
+ while ( *pcchRead < cch
+ && (pach)[*pcchRead] != '\n'
+ && (pach)[*pcchRead] != '\r')
+ ++*pcchRead;
+ while ( *pcchRead < cch
+ && ( (pach)[*pcchRead] == '\n'
+ || (pach)[*pcchRead] == '\r'))
+ ++*pcchRead;
+}
diff --git a/src/VBox/Installer/linux/install_service/init_template.sh b/src/VBox/Installer/linux/install_service/init_template.sh
new file mode 100755
index 00000000..ed9c9a48
--- /dev/null
+++ b/src/VBox/Installer/linux/install_service/init_template.sh
@@ -0,0 +1,317 @@
+#!/bin/sh
+#
+# VirtualBox generic init script.
+#
+# 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.
+#
+
+### BEGIN INIT INFO
+# Required-Start: $local_fs
+# Should-Start: $syslog
+# Required-Stop: $local_fs
+# Should-Stop: $syslog
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: %DESCRIPTION%
+### END INIT INFO
+
+## @todo We should really replace the daemon starting, stopping and checking
+# code with a tool of our own written in C, which we could always use
+# instead of the LSB functions.
+
+cr="
+"
+tab=" "
+IFS=" ${cr}${tab}"
+'unset' -f unalias
+'unalias' -a
+unset -f command
+PATH=/bin:/sbin:/usr/bin:/usr/sbin:$PATH
+
+## A generic service script which can be used, after substituting some place-
+# holders with service-specific values, to run most services on LSB, System V
+# or BSD-compatible service management systems. As we control both the service
+# code and the init script we try to push as much as possible of the logic into
+# the service and out of the very system-dependent service configuration
+# scripts and files. See the help text of the "install_service.sh" helper
+# script for more details.
+#
+# Furthermore, to simplify deployment, we will install all init scripts using
+# this generic template manually during the post install phase or at run time
+# using LSB functions if they are available (as they should be on most common
+# modern distributions) or manually placing the file in the appropriate
+# directory and creating symbolic links on System V or writing to rc.local on
+# BSD-compatible systems. Systems requiring different treatment will be added
+# here when we add support for them, but we will try to keep everything as
+# generic as we can.
+#
+# In general, we try to behave as natively as we reasonably can on the most
+# important target systems we support and to work well enough on as many others
+# as possible, but in particular without trying to look perfectly native.
+#
+# See the inline documentation in the code for generate_service_file for
+# details of the generation process.
+
+## Time out in seconds when shutting down the service.
+SHUT_DOWN_TIME_OUT=5
+## If this is set to an empty value then the LSB init functions will not be
+# used. This is intended for testing the fallback commands.
+LSB_FUNCTIONS="/lib/lsb/init-functions"
+
+# Silently exit if the package was uninstalled but not purged.
+test -r %COMMAND% || exit 0
+
+## The function definition at the start of every non-trivial shell script!
+abort()
+{
+ log_failure_msg "$*"
+ exit 1
+}
+
+## Exit successfully.
+do_success()
+{
+ log_success_msg "%DESCRIPTION% successfully started."
+ exit 0
+}
+
+## Set the error message.
+set_error()
+{
+ test -z "${error}" && error="${1}"
+}
+
+# Gentoo/OpenRC perculiarity.
+if test "x${0}" = "x/sbin/rc" || test "x${0}" = "xrc"; then
+ shift
+fi
+
+# Process arguments.
+action=""
+error=""
+prefix="/var"
+while test x"${#}" != "x0"; do
+ case "${1}" in
+ --lsb-functions)
+ test x"${#}" = "x1" &&
+ set_error "${1}: missing argument."
+ LSB_FUNCTIONS="${2}"
+ shift 2;;
+ --prefix)
+ test x"${#}" = "x1" &&
+ set_error "${1}: missing argument."
+ prefix="${2}"
+ shift 2;;
+ --help)
+ cat << EOF
+Usage:
+
+ ${0} {start|stop|restart|status} [<options>]
+
+ start|stop|restart|status
+ Start/stop/restart/report status for the service.
+
+Options:
+
+ --lsb-functions <script>
+ Take the standard LSB init functions from <script> instead of from the
+ normal location, or use our own versions if <script> is an empty string.
+
+ --prefix <folder>
+ Use the folder <folder> for storing variable data instead of "/var". The
+ child folder "run" must exist.
+EOF
+ exit 0;;
+ start|stop|restart|force-reload|condrestart|try-restart|reload|status)
+ test -z "${action}" ||
+ set_error "More than one action requested."
+ action="${1}"
+ shift;;
+ *)
+ set_error "Unknown option \"${1}\". Try \"${0} --help\" for more information."
+ shift;;
+ esac
+done
+
+## Set Redhat and Fedora lock directory
+LOCK_FOLDER="${prefix}/lock/subsys/"
+LOCK_FILE="${LOCK_FOLDER}/%SERVICE_NAME%"
+
+# Use LSB functions if available. Success and failure messages default to just
+# "echo" if the LSB functions are not available, so call these functions with
+# messages which clearly read as success or failure messages.
+test -n "${LSB_FUNCTIONS}" && test -f "${LSB_FUNCTIONS}" &&
+ . "${LSB_FUNCTIONS}"
+
+type log_success_msg >/dev/null 2>&1 ||
+ log_success_msg()
+ {
+ cat << EOF
+${*}
+EOF
+ }
+
+type log_failure_msg >/dev/null 2>&1 ||
+ log_failure_msg()
+ {
+ cat << EOF
+${*}
+EOF
+ }
+
+## Get the LSB standard PID-file name for a binary.
+pidfilename()
+{
+ echo "${prefix}/run/${1##*/}.pid"
+}
+
+## Get the PID-file for a process like the LSB functions do ( "-p" or by name).
+pidfileofproc()
+{
+ if test x"${1}" = "x-p"; then
+ echo "${2}"
+ else
+ pidfilename "${1}"
+ fi
+}
+
+## Read the pids from an LSB PID-file, checking that they are positive numbers.
+pidsfromfile()
+{
+ pids=""
+ test -r "${1}" &&
+ read -r pids < "${1}" 2>/dev/null
+ for i in $pids; do
+ test 1 -le "${i}" || return 1
+ done
+ echo "${pids}"
+}
+
+## Check whether the binary $1 with the pids $2... is running.
+procrunning()
+{
+ binary="${1}"
+ shift
+ case "`ps -p "${@}" -f 2>/dev/null`" in *"${binary}"*)
+ return 0;;
+ esac
+ return 1
+}
+
+# We prefer our own implementations of pidofproc and killproc over falling back
+# to distribution ones with unknown quirks.
+# type pidofproc >/dev/null 2>&1 ||
+ pidofproc()
+ {
+ pidfile="`pidfileofproc "${@}"`"
+ test "x${1}" = "x-p" && shift 2
+ pids="`pidsfromfile "${pidfile}"`"
+ procrunning "${1}" ${pids} && echo "${pids}"
+ }
+
+# type killproc >/dev/null 2>&1 ||
+ killproc()
+ {
+ pidfile="`pidfileofproc "${@}"`"
+ test "x${1}" = "x-p" && shift 2
+ pids="`pidsfromfile "${pidfile}"`"
+ if test -n "${2}"; then
+ procrunning "${1}" ${pids} || return 1
+ kill "${2}" ${pids}
+ return 0
+ else
+ rm -f "${pidfile}"
+ procrunning "${1}" ${pids} || return 0
+ kill "${pids}"
+ # Short busy wait for the process to terminate.
+ stamp="`times`"
+ while test x"${stamp}" = x"`times`"; do
+ procrunning "${1}" ${pids} || return 0
+ done
+ # Slow sleeping wait if it is still running.
+ for high in "" 1 2 3 4 5 6 7 8 9; do
+ for time in ${high}0 ${high}1 ${high}2 ${high}3 ${high}4 ${high}5 ${high}6 ${high}7 ${high}8 ${high}9; do
+ sleep 1
+ procrunning "${1}" ${pids} || return 0
+ if test "${time}" = "${SHUT_DOWN_TIME_OUT}"; then
+ kill -9 "${pid}"
+ return 0
+ fi
+ done
+ done
+ return 0
+ fi
+ }
+
+start()
+{
+ test -d "${LOCK_FOLDER}" && touch "${LOCK_FILE}"
+ test -n "`pidofproc %COMMAND%`" && exit 0
+%HAVE_DAEMON% %COMMAND% %ARGUMENTS% >/dev/null 2>&1 &
+%HAVE_DAEMON% pid="$!"
+%HAVE_DAEMON% pidfile="`pidfilename %COMMAND%`"
+%HAVE_DAEMON% echo "${pid}" > "${pidfile}"
+%HAVE_ONESHOT% %COMMAND% %ARGUMENTS% >/dev/null 2>&1 || abort "%DESCRIPTION% failed to start!"
+ do_success
+}
+
+stop()
+{
+%HAVE_STOP_COMMAND% %STOP_COMMAND% %STOP_ARGUMENTS% || abort "%DESCRIPTION% failed to stop!"
+%HAVE_DAEMON% killproc %COMMAND% || abort "%DESCRIPTION% failed to stop!"
+ rm -f "${LOCK_FILE}"
+ log_success_msg "%DESCRIPTION% successfully stopped."
+ return 0
+}
+
+status()
+{
+%HAVE_STATUS_COMMAND% %STATUS_COMMAND% %STATUS_ARGUMENTS%
+%HAVE_STATUS_COMMAND% exit
+%NO_STATUS_COMMAND% pid="`pidofproc %COMMAND%`"
+%NO_STATUS_COMMAND% test -n "${pid}" &&
+%NO_STATUS_COMMAND% {
+%NO_STATUS_COMMAND% echo "%SERVICE_NAME% running, process ${pid}"
+%NO_STATUS_COMMAND% exit 0
+%NO_STATUS_COMMAND% }
+%NO_STATUS_COMMAND% test -f "`pidfilename %COMMAND%`" &&
+%NO_STATUS_COMMAND% {
+%NO_STATUS_COMMAND% echo "%SERVICE_NAME% not running but PID-file present."
+%NO_STATUS_COMMAND% exit 1
+%NO_STATUS_COMMAND% }
+%NO_STATUS_COMMAND% test -f "${LOCK_FILE}" &&
+%NO_STATUS_COMMAND% {
+%NO_STATUS_COMMAND% echo "%SERVICE_NAME% not running but lock file present."
+%NO_STATUS_COMMAND% exit 2
+%NO_STATUS_COMMAND% }
+%NO_STATUS_COMMAND% echo "%SERVICE_NAME% not running."
+%NO_STATUS_COMMAND% exit 3
+}
+
+test -z "${error}" || abort "${error}"
+
+case "${action}" in
+start)
+ start;;
+stop)
+ stop;;
+restart|force-reload)
+ start
+ stop;;
+condrestart|try-restart)
+ status || exit 0
+ stop
+ start;;
+reload)
+ ;;
+status)
+ status;;
+esac
diff --git a/src/VBox/Installer/linux/install_service/install_service.sh b/src/VBox/Installer/linux/install_service/install_service.sh
new file mode 100755
index 00000000..89311043
--- /dev/null
+++ b/src/VBox/Installer/linux/install_service/install_service.sh
@@ -0,0 +1,209 @@
+#!/bin/sh
+
+#
+# Script to install services within a VirtualBox installation.
+#
+# 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.
+#
+
+# 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
+
+# Get the folder we are running from, as we need other files there.
+script_folder="`dirname "$0"`"
+
+## Script usage documentation.
+usage() {
+ cat << EOF
+Usage:
+
+ `basename $0` --help|--enable|--disable|--force-enable|--force-disable
+ |--remove [--prefix <prefix>]
+ -- <pass-through parameters>
+
+Create a system service which runs a command. In order to make it possible to
+do this in a simple and portable manner, we place a number of requirements on
+the command to be run:
+ - That it can be started safely even if all its dependencies are not started
+ and will sleep if necessary until it can start work. Ideally it should
+ start accepting input as early as it can, but delay handling it if
+ necessary, and delay accessing its dependencies until it actually needs
+ them.
+ - That it does not background to simplify service process management.
+ - That it can be safely shut down using SIGTERM.
+ - That if all running copies of the main process binary are stopped first the
+ service can be re-started and will do any necessary clean-up automatically.
+ - That any output which must not be lost go either to the system log or to the
+ service's private log.
+
+We currently support System V init only. This will probably soon be extended
+to BSD init, OpenRC and systemd, but probably not Upstart which currently
+requires modifying init files to disable a service. We also try to enable our
+service (if requested) in all init systems we find, as we do not know which one
+is in active use. We assume that this will not have any adverse effects.
+
+ --help|--usage
+ Print this help text and exit.
+
+ --enable|--disable|--force-enable|--force-disable
+ These actions install the service. If a version of the service was not
+ installed previously, "--enable" and "--force-enable" make it start when
+ entering normal user run-levels and "--disable" and "--force-disable"
+ prevents it from starting when entering any run-level. If a version of
+ the service was already installed previously, "--enable" and "--disable"
+ simply update it without changing when it starts; "--force-enable" and
+ "--force-disable" behave the same as when no previous version was found.
+ Only one of these options or "--remove" may be specified.
+
+ --remove
+ This action uninstalls the service. It may not be used in combination
+ with "--enable", "--disable", "--force-enable" or "--force-disable".
+
+Option:
+
+ --prefix <prefix>
+ Treat all paths as relative to <prefix> rather than /etc.
+
+Pass-through parameters will be passed through to the "generate_service_file"
+tool.
+EOF
+}
+
+## The function definition at the start of every non-trivial shell script!
+abort() {
+ ## $1 Error text to output to standard error.
+ cat >&2 << EOF
+$1
+EOF
+ exit 1
+}
+
+ACTION=""
+PREFIX="/etc/"
+SERVICE_NAME=""
+
+# Process arguments.
+while test x"${1}" != "x--"; do
+ case "${1}" in
+ "--help"|"--usage")
+ usage
+ exit 0;;
+ "--enable"|"--disable"|"--force-enable"|"--force-disable"|"--remove")
+ test -z "${ACTION}" || abort "More than one action specified."
+ ACTION="true"
+ ENABLE=""
+ INSTALL="true"
+ UPDATE=""
+ { test "${1}" = "--enable" || test "${1}" = "--disable"; } &&
+ UPDATE="true"
+ { test "${1}" = "--enable" || test "${1}" = "--force-enable"; } &&
+ ENABLE="true"
+ test "${1}" = "--remove" &&
+ INSTALL=""
+ shift;;
+ "--prefix")
+ test -z "${2}" && abort "${1}: missing argument."
+ PREFIX="${2}"
+ shift 2;;
+ *)
+ abort "Unknown option ${1}.";;
+ esac
+done
+shift
+
+# Check required options and set default values for others.
+test -z "${ACTION}" &&
+ abort "Please supply an install action."
+
+# Get the service name.
+SERVICE_NAME=`echo "%SERVICE_NAME%" |
+ "${script_folder}/../helpers/generate_service_file" --format shell "${@}"`
+test -z "${SERVICE_NAME}" &&
+ abort "Please supply a command path."
+
+# Keep track of whether we found at least one initialisation system.
+found_init=""
+
+# Find the best System V/BSD init path if any is present.
+for path in "${PREFIX}/init.d/rc.d" "${PREFIX}/init.d/" "${PREFIX}/rc.d/init.d" "${PREFIX}/rc.d"; do
+ if test -d "${path}"; then
+ # Check permissions for the init path.
+ test -w "${path}" || abort "No permission to write to \"${path}\"."
+ # And for the System V symlink directories.
+ for i in rc0.d rc1.d rc6.d rc.d/rc0.d rc.d/rc1.d rc.d/rc6.d; do
+ if test -d "${PREFIX}/${i}"; then
+ test -w "${PREFIX}/${i}" ||
+ abort "No permission to write to \"${PREFIX}/${i}\"."
+ fi
+ done
+ # And for the OpenRC symlink directories.
+ if test -d "${PREFIX}/runlevel/"; then
+ test -w "${PREFIX}/runlevel/" ||
+ abort "No permission to write to \"${PREFIX}/runlevel\"".
+ fi
+ found_init="true"
+ update=""
+ test -f "${path}/${SERVICE_NAME}" && update="${UPDATE}"
+ if test -n "${INSTALL}"; then
+ "${script_folder}/../helpers/generate_service_file" --format shell "${@}" < "${script_folder}/init_template.sh" > "${path}/${SERVICE_NAME}"
+ chmod a+x "${path}/${SERVICE_NAME}"
+ else
+ rm "${path}/${SERVICE_NAME}"
+ fi
+ # Attempt to install using both system V symlinks and OpenRC, assuming
+ # that both will not be in operation simultaneously (but may be
+ # switchable). BSD init expects the user to enable services
+ # explicitly.
+ if test -z "${update}"; then
+ # Various known combinations of sysvinit rc directories.
+ for i in "${PREFIX}"/rc*.d/[KS]??"${SERVICE_NAME}" "${PREFIX}"/rc.d/rc*.d/[KS]??"${SERVICE_NAME}"; do
+ rm -f "${i}"
+ done
+ # And OpenRC.
+ test -d "${PREFIX}/runlevel/" &&
+ for i in "/${PREFIX}/runlevel"/*/"${SERVICE_NAME}"; do
+ rm -f "${i}"
+ done
+ # Various known combinations of sysvinit rc directories.
+ if test -n "${ENABLE}"; then
+ for i in rc0.d rc1.d rc6.d rc.d/rc0.d rc.d/rc1.d rc.d/rc6.d; do
+ if test -d "${PREFIX}/${i}"; then
+ # Paranoia test first.
+ test -d "${PREFIX}/${i}/K80${SERVICE_NAME}" ||
+ ln -sf "${path}/${SERVICE_NAME}" "${PREFIX}/${i}/K80${SERVICE_NAME}"
+ fi
+ done
+ for i in rc2.d rc3.d rc4.d rc5.d rc.d/rc2.d rc.d/rc3.d rc.d/rc4.d rc.d/rc5.d; do
+ if test -d "${PREFIX}/${i}"; then
+ # Paranoia test first.
+ test -d "${PREFIX}/${i}/S20${SERVICE_NAME}" ||
+ ln -sf "${path}/${SERVICE_NAME}" "${PREFIX}/${i}/S20${SERVICE_NAME}"
+ fi
+ done
+ # And OpenRC.
+ test -d "${PREFIX}/runlevel/default" &&
+ ln -sf "${path}/${SERVICE_NAME}" "/${PREFIX}/runlevel/default/"
+ fi
+ fi
+ break
+ fi
+done
+
+test -z "${found_init}" &&
+ abort "No supported initialisation system found."
+exit 0
diff --git a/src/VBox/Installer/linux/installer-common.sh b/src/VBox/Installer/linux/installer-common.sh
index 3e4e6653..5bb51b8d 100644
--- a/src/VBox/Installer/linux/installer-common.sh
+++ b/src/VBox/Installer/linux/installer-common.sh
@@ -25,6 +25,7 @@ udev_write_vboxdrv() {
VBOXDRV_MODE="$2"
echo "KERNEL==\"vboxdrv\", NAME=\"vboxdrv\", OWNER=\"root\", GROUP=\"$VBOXDRV_GRP\", MODE=\"$VBOXDRV_MODE\""
+ echo "KERNEL==\"vboxdrvu\", NAME=\"vboxdrvu\", OWNER=\"root\", GROUP=\"root\", MODE=\"0666\""
echo "KERNEL==\"vboxnetctl\", NAME=\"vboxnetctl\", OWNER=\"root\", GROUP=\"$VBOXDRV_GRP\", MODE=\"$VBOXDRV_MODE\""
}
@@ -88,7 +89,7 @@ install_udev() {
"$USB_GROUP" "$NO_INSTALL" "$udev_out"
fi
# Remove old udev description file
- rm -f /etc/udev/rules.d/60-vboxdrv.rules 2> /dev/null
+ rm -f /etc/udev/rules.d/10-vboxdrv.rules 2> /dev/null
}
# Add a unit test if/when needed following the same pattern as for
@@ -110,7 +111,7 @@ install_create_usb_node_for_sysfs() {
}
# install_device_node_setup contains some aliases for unit testing purposes. # Set them to their normal values here.
-udev_rule_file=/etc/udev/rules.d/10-vboxdrv.rules # Set this to /dev/null
+udev_rule_file=/etc/udev/rules.d/60-vboxdrv.rules # Set this to /dev/null
# for unit testing
sysfs_usb_devices="/sys/bus/usb/devices/*"
@@ -163,6 +164,8 @@ set_selinux_permissions() {
> /dev/null 2>&1
chcon -t java_exec_t "$INSTALLATION_DIR"/VBoxNetDHCP \
> /dev/null 2>&1
+ chcon -t java_exec_t "$INSTALLATION_DIR"/VBoxNetNAT \
+ > /dev/null 2>&1
chcon -t java_exec_t "$INSTALLATION_DIR"/VBoxExtPackHelperApp \
> /dev/null 2>&1
chcon -t java_exec_t "$INSTALLATION_DIR"/vboxwebsrv > /dev/null 2>&1
diff --git a/src/VBox/Installer/linux/routines.sh b/src/VBox/Installer/linux/routines.sh
index 5cf42bb2..8f720a97 100644
--- a/src/VBox/Installer/linux/routines.sh
+++ b/src/VBox/Installer/linux/routines.sh
@@ -2,7 +2,7 @@
# VirtualBox installer shell routines
#
-# Copyright (C) 2007-2011 Oracle Corporation
+# 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;
@@ -620,3 +620,4 @@ maybe_run_python_bindings_installer() {
return 0
}
+
diff --git a/src/VBox/Installer/linux/rpm/LocalConfig.kmk b/src/VBox/Installer/linux/rpm/LocalConfig.kmk
index 921b63fb..a9bebf87 100644
--- a/src/VBox/Installer/linux/rpm/LocalConfig.kmk
+++ b/src/VBox/Installer/linux/rpm/LocalConfig.kmk
@@ -4,7 +4,7 @@
#
#
-# Copyright (C) 2006-2010 Oracle Corporation
+# Copyright (C) 2006-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;
diff --git a/src/VBox/Installer/linux/rpm/VirtualBox.tmpl.spec b/src/VBox/Installer/linux/rpm/VirtualBox.tmpl.spec
index 0baac2a9..07bc38cc 100644
--- a/src/VBox/Installer/linux/rpm/VirtualBox.tmpl.spec
+++ b/src/VBox/Installer/linux/rpm/VirtualBox.tmpl.spec
@@ -79,11 +79,16 @@ mv *.gc $RPM_BUILD_ROOT/usr/lib/virtualbox
mv *.r0 $RPM_BUILD_ROOT/usr/lib/virtualbox
mv *.rel $RPM_BUILD_ROOT/usr/lib/virtualbox || true
mv VBoxNetDHCP $RPM_BUILD_ROOT/usr/lib/virtualbox
+mv VBoxNetNAT $RPM_BUILD_ROOT/usr/lib/virtualbox
mv VBoxNetAdpCtl $RPM_BUILD_ROOT/usr/lib/virtualbox
+if [ -f VBoxVolInfo ]; then
+ mv VBoxVolInfo $RPM_BUILD_ROOT/usr/lib/virtualbox
+fi
mv VBoxXPCOMIPCD $RPM_BUILD_ROOT/usr/lib/virtualbox
mv components $RPM_BUILD_ROOT/usr/lib/virtualbox/components
mv *.so $RPM_BUILD_ROOT/usr/lib/virtualbox
mv *.so.4 $RPM_BUILD_ROOT/usr/lib/virtualbox || true
+ln -s ../VBoxVMM.so $RPM_BUILD_ROOT/usr/lib/virtualbox/components/VBoxVMM.so
mv VBoxTestOGL $RPM_BUILD_ROOT/usr/lib/virtualbox
mv vboxshell.py $RPM_BUILD_ROOT/usr/lib/virtualbox
(export VBOX_INSTALL_PATH=/usr/lib/virtualbox && \
@@ -99,9 +104,9 @@ mv VBoxCreateUSBNode.sh $RPM_BUILD_ROOT/usr/share/virtualbox
cp icons/128x128/virtualbox.png $RPM_BUILD_ROOT/usr/share/pixmaps/virtualbox.png
cd icons
for i in *; do
- if [ -f $i/virtualbox.png ]; then
+ if [ -f $i/virtualbox.* ]; then
install -d $RPM_BUILD_ROOT/usr/share/icons/hicolor/$i/apps
- mv $i/virtualbox.png $RPM_BUILD_ROOT/usr/share/icons/hicolor/$i/apps
+ mv $i/virtualbox.* $RPM_BUILD_ROOT/usr/share/icons/hicolor/$i/apps
fi
install -d $RPM_BUILD_ROOT/usr/share/icons/hicolor/$i/mimetypes
mv $i/* $RPM_BUILD_ROOT/usr/share/icons/hicolor/$i/mimetypes || true
@@ -116,8 +121,11 @@ if %WEBSVC%; then
for i in vboxwebsrv webtest; do
mv $i $RPM_BUILD_ROOT/usr/lib/virtualbox; done
fi
-for i in VBoxSDL VirtualBox VBoxHeadless VBoxNetDHCP VBoxNetAdpCtl; do
+for i in VBoxSDL VirtualBox VBoxHeadless VBoxNetDHCP VBoxNetNAT VBoxNetAdpCtl; do
chmod 4511 $RPM_BUILD_ROOT/usr/lib/virtualbox/$i; done
+if [ -f $RPM_BUILD_ROOT/usr/lib/virtualbox/VBoxVolInfo ]; then
+ chmod 4511 $RPM_BUILD_ROOT/usr/lib/virtualbox/VBoxVolInfo
+fi
if [ -d ExtensionPacks/VNC ]; then
mv ExtensionPacks/VNC $RPM_BUILD_ROOT/usr/lib/virtualbox/ExtensionPacks
fi
@@ -272,7 +280,7 @@ if [ "$INSTALL_NO_GROUP" != "1" ]; then
echo
echo "Creating group 'vboxusers'. VM users must be member of that group!"
echo
- groupadd -f vboxusers 2> /dev/null
+ groupadd -r -f vboxusers 2> /dev/null
fi
# install udev rule (disable with INSTALL_NO_UDEV=1 in /etc/default/virtualbox)
@@ -391,7 +399,7 @@ if [ "$1" = 0 ]; then
/sbin/service vboxdrv stop > /dev/null
/sbin/chkconfig --del vboxdrv
%endif
- rm -f /etc/udev/rules.d/10-vboxdrv.rules
+ rm -f /etc/udev/rules.d/60-vboxdrv.rules
rm -f /etc/vbox/license_agreed
rm -f /etc/vbox/module_not_compiled
fi
@@ -445,13 +453,13 @@ rm -rf $RPM_BUILD_ROOT
%{?rpm_suse: /sbin/rcvboxballoonctrl-service}
%{?rpm_suse: /sbin/rcvboxautostart-service}
%{?rpm_suse: /sbin/rcvboxweb-service}
-/lib/modules
/etc/vbox
-/usr/bin
+/usr/bin/*
/usr/src/vbox*
/usr/lib/virtualbox
-/usr/share/applications
-/usr/share/icons
-/usr/share/mime/packages
-/usr/share/pixmaps
+/usr/share/applications/*
+/usr/share/icons/hicolor/*/apps/*
+/usr/share/icons/hicolor/*/mimetypes/*
+/usr/share/mime/packages/*
+/usr/share/pixmaps/*
/usr/share/virtualbox
diff --git a/src/VBox/Installer/linux/rpm/rules b/src/VBox/Installer/linux/rpm/rules
index 8e22093b..91606c44 100755
--- a/src/VBox/Installer/linux/rpm/rules
+++ b/src/VBox/Installer/linux/rpm/rules
@@ -52,7 +52,7 @@ ifeq ($(shell if grep -q '^%disttag' /usr/lib/rpm/macros.d/mandriva 2>/dev/null;
$(error Fix /usr/lib/rpm/macros.d/mandriva)
endif
-verpkg := VirtualBox-4.2
+verpkg := VirtualBox-4.3
current := $(shell pwd)
vboxroot := $(shell cd ../../../..; pwd)
pkgdir := $(if $(PKGDIR),$(PKGDIR),$(shell cd ../../../../..; pwd))
@@ -62,7 +62,7 @@ arch := $(shell if [ `uname -m` = "x86_64" ]; then echo "amd64"; else echo "
verfile := $(builddir)/version-generated.mk
ose := $(if $(OSE),1,$(if $(wildcard $(vboxroot)/src/VBox/RDP/server),,1))
-include $(vboxroot)/SVN_REVISION
-svnrev :=$(if $(svn_revision),$(svn_revision),0)
+svnrev :=$(if $(svn_revision),$(svn_revision),)
NOMODS ?= $(ose)
NOQT ?= $(HEADLESS)
@@ -84,10 +84,10 @@ ifneq ($(MAKECMDGOALS),clean)
$(error Cannot detect package distribution (rpmrel=$(rpmrel)))
endif
- ifeq ($(filter-out el4 el5 el6 ol4 ol5 ol6 centos4 centos5 centos6 fedora9 fedora11 fedora12 fedora13 fedora14 fedora15 fedora16 fedora17 turbolinux11,$(rpmrel)),)
+ ifeq ($(filter-out el5 el6 ol5 ol6 centos5 centos6 fedora15 fedora16 fedora17 fedora18,$(rpmrel)),)
rpmspec := rpm_redhat
endif
- ifeq ($(filter-out openSUSE110 openSUSE111 openSUSE112 openSUSE113 openSUSE114 sles10.1 sles11.0,$(rpmrel)),)
+ ifeq ($(filter-out openSUSE110 openSUSE111 openSUSE112 openSUSE113 openSUSE114 openSUSE123 sles10.1 sles11.0,$(rpmrel)),)
rpmspec := rpm_suse
endif
ifeq ($(filter-out mdv2009.1 mdv2010.0 mdv2011.0,$(rpmrel)),)
@@ -109,8 +109,8 @@ rpmver :=$(ver)$(if $(NOSUBVER),,$(if $(svn_revision),_$(svn_revision),)$(VERS
archdir := $(current)/rpm/VirtualBox-$(ver)
rpmname := $(verpkg)-$(rpmver)_$(rpmrel)
-# Fedora13/14 is bleeding edge, the other jails have outdated kernel headers
-instmod := $(if $(filter el4 el5 el6 ol4 ol5 ol6 centos4 centos5 centos6 sles10.1 sles11.0 fedora13 fedora14 fedora15 fedora16 fedora17,$(rpmrel)),,install_rpm)
+# never ship any modules
+instmod :=
ifneq ($(STAGEDISO),)
ifeq ($(wildcard $(STAGEDISO)/VBoxGuestAdditions.iso),)
@@ -132,18 +132,18 @@ else
endif
cfg_flags := $(if $(NOQT),--disable-qt,) \
- $(if $(filter el4 sles10.1,$(rpmrel)),--build-libxml2,) \
- $(if $(filter el4,$(rpmrel)),--build-libssl,) \
- $(if $(filter el4 el5 ol4 ol5 centos4 centos5 sles10.1,$(rpmrel)),--build-libcurl,) \
+ $(if $(filter sles10.1,$(rpmrel)),--build-libxml2,) \
+ $(if $(filter el5 el6 sles10.1 sles11.0 mdv2011.0,$(rpmrel)),--build-libvpx,) \
+ $(if $(filter el5 ol5 centos5 sles10.1 sles11.0,$(rpmrel)),--build-libcurl,) \
$(if $(filter el5 centos5 sles10.1,$(rpmrel)),--disable-sdl-ttf,) \
- $(if $(filter sles10.1 turbolinux11,$(rpmrel)),--disable-pulse,) \
- $(if $(filter el4 el5 ol4 ol5 centos4 centos5,$(rpmrel)),--enable-pulse,) \
- $(if $(filter el4 el5 ol4 ol5 centos4 centos5 mdv2010.0 sles10.1 sles11.0 turbolinux11,$(rpmrel)),--with-qt4-dir=/home/vbox/Qt-4.7.4-stdc++6-$(arch)) \
+ $(if $(filter sles10.1,$(rpmrel)),--disable-pulse,) \
+ $(if $(filter el5 ol5 centos5,$(rpmrel)),--enable-pulse,) \
+ $(if $(filter el5 ol5 centos5 sles10.1 sles11.0,$(rpmrel)),--with-qt4-dir=/home/vbox/Qt-4.7.4-stdc++6-$(arch)) \
$(if $(ose),--ose,) $(if $(LINUX),--with-linux=$(LINUX),) \
$(if $(HEADLESS),--build-headless,) \
$(if $(DEBUG),--build-debug,) \
$(if $(NOWINE),,--setup-wine) \
- $(if $(NOWEBSVC),,--enable-webservice) \
+ $(if $(NOWEBSVC),,$(if $(ose),--enable-webservice,)) \
$(if $(VNC),--enable-vnc,) \
--disable-extpack
@@ -153,17 +153,16 @@ bld_flags := AUTOCFG=$(current)/rpm/AutoConfig.kmk \
VBOX_WITHOUT_EXTPACK_PUEL_PACKING=1 \
VBOX_WITHOUT_EXTPACK_VNC_PACKING=1 \
VBOX_DO_STRIP= \
- VBOX_DO_STRIP_MODULES= \
VBOX_WITH_MULTIVERSION_PYTHON= \
$(doc_dir) \
$(if $(ose),,VBOX_WITH_DOCS_CHM=1) \
VBOX_PACKAGE_DIST=$(rpmdist) \
- VBOX_SVN_REV=$(svnrev) \
+ $(if $(svnrev),VBOX_SVN_REV=$(svnrev),) \
$(if $(NODOCS),VBOX_WITH_DOCS= ,) \
$(if $(VERBOSE),--print-directory KBUILD_VERBOSE=2,--no-print-directory) \
$(if $(STAGEDISO),VBOX_WITHOUT_ADDITIONS=1,) \
$(if $(BLEEDING_EDGE),VBOX_BLEEDING_EDGE=$(BLEEDING_EDGE),) \
- $(if $(filter el4 el5 ol4 ol5 centos4 centos5 fedora9 fedora10 sles10.1 turbolinux11,$(rpmrel)),,VBOX_WITH_SYSFS_BY_DEFAULT=1)
+ $(if $(filter el5 ol5 centos5 sles10.1,$(rpmrel)),,VBOX_WITH_SYSFS_BY_DEFAULT=1)
rpm/configure-stamp:
cd $(vboxroot) && ./configure --odir=$(current)/rpm $(cfg_flags)
@@ -179,8 +178,8 @@ rpm/build-stamp: rpm/configure-stamp
$(if $(STAGEDISO),cp $(STAGEDISO)/VBoxGuestAdditions.iso $(builddir)/bin/additions,)
. rpm/env.sh && kmk -C $(vboxroot) $(bld_flags) \
VBOX_NO_LINUX_RUN_INSTALLER=1 \
- VBOX_LNX_ADD_ARCHIVE.x86=$(builddir)/bin/additions/VBoxGuestAdditions-x86-r$(svnrev).tar.bz2 \
- VBOX_LNX_ADD_ARCHIVE.amd64=$(builddir)/bin/additions/VBoxGuestAdditions-amd64-r$(svnrev).tar.bz2 \
+ VBOX_LNX_ADD_ARCHIVE.x86=$(builddir)/bin/additions/VBoxGuestAdditions-x86.tar.bz2 \
+ VBOX_LNX_ADD_ARCHIVE.amd64=$(builddir)/bin/additions/VBoxGuestAdditions-amd64.tar.bz2 \
VBOX_PATH_ADDITIONS.linux.x86=$(builddir)/bin/additions \
VBOX_PATH_ADDITIONS.linux.amd64=$(builddir)/bin/additions \
packing
@@ -227,22 +226,10 @@ binary: rpm/build-stamp
-e "s|%VERSION%|$(VBOX_VERSION_STRING)|g" \
-e "s|%GROUP%|$(if $(VBOX_WITHOUT_HARDENING),vboxusers,root)|g" \
vboxdrv.sh.in > $(archdir)/vboxdrv.init
- sed \
- -e 's|%NOLSB%|yes|g' \
- -e 's|%DEBIAN%||g' \
- -e 's|%PACKAGE%|virtualbox|g' \
- vboxballoonctrl-service.sh.in > $(archdir)/vboxballoonctrl-service.init
- sed \
- -e 's|%NOLSB%|yes|g' \
- -e 's|%DEBIAN%||g' \
- -e 's|%PACKAGE%|virtualbox|g' \
- vboxautostart-service.sh.in > $(archdir)/vboxautostart-service.init
- sed \
- -e 's|%NOLSB%|yes|g' \
- -e 's|%DEBIAN%||g' \
- -e 's|%PACKAGE%|virtualbox|g' \
- vboxweb-service.sh.in > $(archdir)/vboxweb-service.init
- cp debian/VBox.sh $(archdir)
+ cp vboxballoonctrl-service.sh $(archdir)/vboxballoonctrl-service.init
+ cp vboxautostart-service.sh $(archdir)/vboxautostart-service.init
+ cp vboxweb-service.sh $(archdir)/vboxweb-service.init
+ cp VBox.sh $(archdir)
mv rpm/VirtualBox-$(ver) rpm/$(rpmname)
tar -cjf rpm/VirtualBox.tar.bz2 -C rpm $(rpmname)
rm -f /usr/src/packages/RPMS/*/VirtualBox*rpm
diff --git a/src/VBox/Installer/linux/run-inst.sh b/src/VBox/Installer/linux/run-inst.sh
index 44c11835..e1964892 100755
--- a/src/VBox/Installer/linux/run-inst.sh
+++ b/src/VBox/Installer/linux/run-inst.sh
@@ -1,10 +1,11 @@
#!/bin/sh
#
# Oracle VM VirtualBox
-# VirtualBox Makeself installation starter script for Linux
+# VirtualBox Makeself installation starter script
+# for Linux Guest Additions
#
-# Copyright (C) 2006-2009 Oracle Corporation
+# Copyright (C) 2006-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;
@@ -20,7 +21,6 @@
# the package into the filesystem (by default under /opt) and starts the real
# installation script.
#
-
PATH=$PATH:/bin:/sbin:/usr/sbin
# Note: These variable names must *not* clash with variables in $CONFIG_DIR/$CONFIG!
@@ -48,10 +48,15 @@ check_root
create_log "$LOGFILE"
+## @todo r=andy: Explain options like "force" and "no_setup" -- not self-explanatory
+# to the user.
usage()
{
info ""
- info "Usage: install [<installation directory>] | uninstall [force] [no_setup]"
+ info "Usage: $SELF install [<installation directory>]"
+ info " [--with-<module>] |"
+ info " uninstall"
+ info " [--force] [--no-setup]"
info ""
info "Example:"
info "$SELF install"
@@ -107,12 +112,17 @@ def_uninstall()
. ./deffiles
found=0
+ for i in "/opt/$PACKAGE-"*; do
+ test -e "$i" && found=1
+ done
for i in $DEFAULT_FILE_NAMES; do
- test "$found" = 0 -a -e "$i" && found=1
+ test "$found" = 0 && test -e "$i" && found=1
done
test "$found" = 0 &&
- for i in $DEFAULT_VERSIONED_FILE_NAMES-*; do
- test "$found" = 0 -a -e "$i" && found=1
+ for i in $DEFAULT_VERSIONED_FILE_NAMES; do
+ for j in $i-*; do
+ test "$found" = 0 && test -e "$j" && found=1
+ done
done
test "$found" = 0 && return 0
if ! test "$1" = "force" ; then
@@ -152,7 +162,8 @@ EOF
for i in $DEFAULT_VERSIONED_FILE_NAMES; do
rm -f "$i-"* 2> /dev/null
done
- rm -f "/usr/lib/$PACKAGE" "/usr/lib64/$PACKAGE" "/usr/share/$PACKAGE"
+ rm -f "/usr/lib/$PACKAGE" "/usr/lib64/$PACKAGE" "/usr/share/$PACKAGE" \
+ "/usr/lib/i386-linux-gnu/$PACKAGE" "/usr/lib/x86_64-linux-gnu/$PACKAGE"
# And any packages left under /opt
for i in "/opt/$PACKAGE-"*; do
@@ -170,15 +181,11 @@ cpu=`uname -m`;
case "$cpu" in
i[3456789]86|x86)
cpu="x86"
- lib_path="/usr/lib"
+ lib_candidates="/usr/lib/i386-linux-gnu /usr/lib /lib"
;;
x86_64|amd64)
cpu="amd64"
- if test -d "/usr/lib64"; then
- lib_path="/usr/lib64"
- else
- lib_path="/usr/lib"
- fi
+ lib_candidates="/usr/lib/x86_64-linux-gnu /usr/lib64 /usr/lib /lib64 /lib"
;;
*)
cpu="unknown"
@@ -188,47 +195,105 @@ if [ ! -r "$ARCH_PACKAGE" ]; then
info "Detected unsupported $cpu machine type."
exit 1
fi
+# Find the most appropriate libary folder by seeing which of the candidate paths
+# are actually in the shared linker path list and choosing the first. We look
+# for Debian-specific paths first, then LSB ones, then the new RedHat ones.
+libs=`ldconfig -v 2>/dev/null | grep -v ^$'\t'`
+for i in $lib_candidates; do
+ if echo $libs | grep -q $i; then
+ lib_path=$i
+ break
+ fi
+done
+if [ ! -x "$lib_path" ]; then
+ info "Unable to determine correct library path."
+ exit 1
+fi
# Sensible default actions
ACTION="install"
DO_SETUP="true"
NO_CLEANUP=""
FORCE_UPGRADE=""
-while true
+
+while [ $# -ge 2 ];
do
- if [ "$2" = "" ]; then
- break
- fi
+ ARG=$2
shift
- case "$1" in
- install)
- ACTION="install"
- ;;
-
- uninstall)
- ACTION="uninstall"
- ;;
- force)
- FORCE_UPGRADE="force"
- ;;
- no_setup)
- DO_SETUP=""
- ;;
- no_cleanup)
- # Do not do cleanup of old modules when removing them. For
- # testing purposes only.
- DO_SETUP=""
- NO_CLEANUP="no_cleanup"
- ;;
- *)
- if [ "`echo $1|cut -c1`" != "/" ]; then
- info "Please specify an absolute path"
- usage
- fi
- INSTALLATION_DIR="$1"
- ;;
- esac
+ if [ -z "$MY_END_OF_OPTIONS" ]; then
+ case "$ARG" in
+
+ install)
+ ACTION="install"
+ ;;
+
+ uninstall)
+ ACTION="uninstall"
+ ;;
+
+ ## @todo Add per-module options handling, e.g. --lightdm-greeter-dir
+ # or --lightdm-config
+
+ ## @todo Add listing all available modules (+ their options, e.g.
+ # with callback mod_mymod_show_options?)
+
+ --with-*)
+ MODULE_CUR=`expr "$ARG" : '--with-\(.*\)'`
+ # Check if corresponding module in installer/module-$1 exists.
+ # Note: Module names may not contain spaces or other funny things.
+ if [ ! -f "./installer/module-${MODULE_CUR}" ]; then
+ info "Error: Module \"${MODULE_CUR}\" does not exist."
+ usage
+ fi
+ # Give the module the chance of doing initialization work / checks.
+ . "./installer/module-${MODULE_CUR}"
+ mod_${MODULE_CUR}_init
+ if test $? -ne 0; then
+ echo 1>&2 "Module '${MODULE_CUR}' failed to initialize"
+ if ! test "$FORCE_UPGRADE" = "force"; then
+ return 1
+ fi
+ # Continue initialization.
+ fi
+ # Add module to the list of modules to handle later.
+ if test -z "${INSTALLATION_MODULES_LIST}"; then
+ INSTALLATION_MODULES_LIST="${MODULE_CUR}"
+ else
+ INSTALLATION_MODULES_LIST="${INSTALLATION_MODULES_LIST} ${MODULE_CUR}"
+ fi
+ shift
+ ;;
+
+ --force|force) # Keep "force" for backwards compatibility.
+ FORCE_UPGRADE="force"
+ ;;
+
+ --no-setup|no_setup) # Keep "no_setup" for backwards compatibility.
+ DO_SETUP=""
+ ;;
+
+ --no-cleanup|no_cleanup) # Keep "no_cleanup" for backwards compatibility.
+ # Do not do cleanup of old modules when removing them. For
+ # testing purposes only.
+ DO_SETUP=""
+ NO_CLEANUP="no_cleanup"
+ ;;
+
+ --)
+ MY_END_OF_OPTIONS="1"
+ ;;
+
+ *)
+ if [ "`echo $1|cut -c1`" != "/" ]; then
+ info "Please specify an absolute path"
+ usage
+ fi
+ INSTALLATION_DIR="$1"
+ shift
+ ;;
+ esac
+ fi
done
# uninstall any previous installation
@@ -247,6 +312,27 @@ rm -f "$CONFIG_DIR/$CONFIG_FILES"
rmdir "$CONFIG_DIR" 2>/dev/null
test "$ACTION" = "install" || exit 0
+# Choose a proper umask
+umask 022
+
+# Set installer modules directory
+INSTALLATION_MODULES_DIR="$INSTALLATION_DIR/installer/"
+
+# install and load installer modules
+if [ -d installer ]; then
+ info "Copying additional installer modules ..."
+ mkdir -p -m 755 "$INSTALLATION_MODULES_DIR"
+ for CUR_FILE in `ls installer/*`; do
+ install -p -m 755 "$CUR_FILE" "$INSTALLATION_MODULES_DIR"
+ if [ $? -ne 0 ]; then
+ info "Error: Failed to copy installer module \"$CUR_FILE\""
+ if ! test "$FORCE_UPGRADE" = "force"; then
+ exit 1
+ fi
+ fi
+ done
+fi
+
# install the new version
mkdir -p -m 755 "$CONFIG_DIR"
test ! -d "$INSTALLATION_DIR" && REMOVE_INSTALLATION_DIR=1
@@ -275,11 +361,33 @@ link_into_fs "lib" "$lib_path"
link_into_fs "share" "/usr/share"
link_into_fs "src" "/usr/src"
+if [ -d "$INSTALLATION_MODULES_DIR" ]; then
+ info "Installing additional modules ..."
+ for CUR_MODULE in `find "$INSTALLATION_MODULES_DIR" 2>/dev/null`
+ do
+ echo "$CUR_MODULE" >> "$CONFIG_DIR/$CONFIG_FILES"
+ done
+fi
+
+for CUR_MODULE in ${INSTALLATION_MODULES_LIST}
+do
+ mod_${CUR_MODULE}_install
+ if [ $? -ne 0 ]; then
+ info "Error: Failed to install module \"$CUR_MODULE\""
+ if ! test "$FORCE_UPGRADE" = "force"; then
+ exit 1
+ fi
+ fi
+done
+
# Remember our installation configuration before we call any init scripts
cat > "$CONFIG_DIR/$CONFIG" << EOF
# $PACKAGE installation record.
# Package installation directory
INSTALL_DIR='$INSTALLATION_DIR'
+# Additional installation modules
+INSTALL_MODULES_DIR='$INSTALLATION_MODULES_DIR'
+INSTALL_MODULES_LIST='$INSTALLATION_MODULES_LIST'
# Package uninstaller. If you repackage this software, please make sure
# that this prints a message and returns an error so that the default
# uninstaller does not attempt to delete the files installed by your
@@ -293,6 +401,16 @@ BUILD_TYPE='$BUILD_TYPE'
USERNAME='$USERNAME'
EOF
+# Give the modules the chance to write their stuff
+# to the installation config as well.
+if [ -n "${INSTALLATION_MODULES_LIST}" ]; then
+ info "Saving modules configuration ..."
+ for CUR_MODULE in ${INSTALLATION_MODULES_LIST}
+ do
+ echo "`mod_${CUR_MODULE}_config_save`" >> "$CONFIG_DIR/$CONFIG"
+ done
+fi
+
# Install, set up and start init scripts
for i in "$INSTALLATION_DIR/init/"*; do
if test -r "$i"; then
@@ -342,6 +460,44 @@ for i in "$INSTALLATION_DIR/init/"*; do
fi
done
+# Load all modules
+# Important: This needs to be done before loading the configuration
+# value below to not override values which are set to a default
+# value in the modules itself.
+for CUR_MODULE in `find "$INSTALLATION_MODULES_DIR" -name "module-*" 2>/dev/null`
+ do
+ . "\$CUR_MODULE"
+ done
+
+# Load configuration values
+test -r "$CONFIG_DIR/$CONFIG" && . "$CONFIG_DIR/$CONFIG"
+
+# Call uninstallation initialization of all modules
+for CUR_MODULE in "$INSTALLATION_MODULES_LIST"
+ do
+ if test -z "\$CUR_MODULE"; then
+ continue
+ fi
+ mod_\${CUR_MODULE}_pre_uninstall
+ if [ $? -ne 0 ]; then
+ echo 1>&2 "Module \"\$CUR_MODULE\" failed to initialize uninstallation"
+ # Continue initialization.
+ fi
+ done
+
+# Call uninstallation of all modules
+for CUR_MODULE in "$INSTALLATION_MODULES_LIST"
+ do
+ if test -z "\$CUR_MODULE"; then
+ continue
+ fi
+ mod_\${CUR_MODULE}_uninstall
+ if [ $? -ne 0 ]; then
+ echo 1>&2 "Module \"\$CUR_MODULE\" failed to uninstall"
+ # Continue uninstallation.
+ fi
+ done
+
# And remove all files and empty installation directories
# Remove any non-directory entries
cat "$CONFIG_DIR/$CONFIG_FILES" | xargs rm 2>/dev/null
@@ -355,6 +511,8 @@ cat "$CONFIG_DIR/$CONFIG_FILES" |
;;
esac
done
+
+# Remove configuration files
rm "$CONFIG_DIR/$CONFIG_FILES" 2>/dev/null
rm "$CONFIG_DIR/$CONFIG" 2>/dev/null
rmdir "$CONFIG_DIR" 2>/dev/null
@@ -364,3 +522,4 @@ chmod 0755 $INSTALLATION_DIR/$UNINSTALL
echo $INSTALLATION_DIR/$UNINSTALL >> "$CONFIG_DIR/$CONFIG_FILES"
test -n "$REMOVE_INSTALLATION_DIR" &&
echo "$INSTALLATION_DIR/" >> "$CONFIG_DIR/$CONFIG_FILES"
+
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/helpers/install_module_dependencies.sh b/src/VBox/Installer/linux/scripts/check_module_dependencies.sh
index 25884af3..b3baf039 100755
--- a/src/VBox/Installer/linux/helpers/install_module_dependencies.sh
+++ b/src/VBox/Installer/linux/scripts/check_module_dependencies.sh
@@ -4,7 +4,7 @@
# VirtualBox linux installation script
#
-# Copyright (C) 2007-2011 Oracle Corporation
+# 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;
@@ -369,8 +369,8 @@ get_system_information()
## 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_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()
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
diff --git a/src/VBox/Installer/linux/testcase/Makefile.kmk b/src/VBox/Installer/linux/testcase/Makefile.kmk
index 7b365f84..c1d8d8de 100644
--- a/src/VBox/Installer/linux/testcase/Makefile.kmk
+++ b/src/VBox/Installer/linux/testcase/Makefile.kmk
@@ -38,4 +38,16 @@ $$(tstInstallerLinux_0_OUTDIR)/tstInstallerLinux.sh: \
$<
$(QUIET)$(CHMOD) a+rx,u+w $@
+INSTALLS += tstHeadlessXOrg
+TESTING += tstHeadlessXOrg
+tstHeadlessXOrg_INST = $(INST_TESTCASE)
+tstHeadlessXOrg_MODE = a+rx,u+w
+tstHeadlessXOrg_SOURCES = tstHeadlessXOrg.sh
+
+INSTALLS += tstInstallInit
+TESTING += tstInstallInit
+tstInstallInit_INST = $(INST_TESTCASE)
+tstInstallInit_MODE = a+rx,u+w
+tstInstallInit_SOURCES = tstInstallInit.sh
+
include $(FILE_KBUILD_SUB_FOOTER)
diff --git a/src/VBox/Installer/linux/testcase/tstHeadlessXOrg.sh b/src/VBox/Installer/linux/testcase/tstHeadlessXOrg.sh
new file mode 100755
index 00000000..ba00e85e
--- /dev/null
+++ b/src/VBox/Installer/linux/testcase/tstHeadlessXOrg.sh
@@ -0,0 +1,305 @@
+#!/bin/sh
+# $Id: tstHeadlessXOrg.sh $
+## @file
+# VirtualBox X Server auto-start service unit test.
+#
+
+#
+# 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.
+#
+
+## The function definition at the start of every non-trivial shell script!
+abort()
+{
+ ## $@, ... Error text to output to standard error in printf format.
+ format="$1"
+ shift
+ printf "${TEST_NAME}: ${format}" "$@" >&2
+ exit 1
+}
+
+## Print a TESTING line. Takes printf arguments but without a '\n'.
+print_line()
+{
+ format="$1"
+ shift
+ printf "${TEST_NAME}: TESTING ${format}... " "$@"
+}
+
+## Expected a process to complete within a certain time and call a function if
+# it does which should check whether the test was successful and print status
+# information. The function takes the exit status as its single parameter.
+expect_exit()
+{
+ PID="$1" ## The PID we are waiting for.
+ TIME_OUT="$2" ## The time-out before we terminate the process.
+ TEST_FUNCTION="$3" ## The function to call on exit to check the test result.
+
+ # Give it time to complete.
+ { sleep "${TIME_OUT}"; kill "${PID}" 2>/dev/null; } &
+
+ wait "${PID}"
+ STATUS="$?"
+ case "${STATUS}" in
+ 143) # SIGTERM
+ printf "\nFAILED: time-out.\n"
+ ;;
+ *)
+ ${TEST_FUNCTION} "${STATUS}"
+esac
+}
+
+## Create a simple configuration file. Add items onto the end to override them
+# on an item-by-item basis.
+create_basic_configuration()
+{
+ TEST_FOLDER="${1}"
+ FILE_NAME="${TEST_FOLDER}conf" ## The name of the configuration file to create.
+ BASE_FOLDER="${TEST_FOLDER}"
+ XORG_FOLDER="${TEST_FOLDER}/xorg"
+ mkdir -p "${XORG_FOLDER}"
+ cat > "${FILE_NAME}" << EOF
+HEADLESS_X_ORG_CONFIGURATION_FOLDER="${BASE_FOLDER}/xorg"
+HEADLESS_X_ORG_LOG_FOLDER="${BASE_FOLDER}/log"
+HEADLESS_X_ORG_LOG_FILE="log"
+HEADLESS_X_ORG_RUN_FOLDER="${BASE_FOLDER}/run"
+HEADLESS_X_ORG_WAIT_FOR_PREREQUISITES="true"
+HEADLESS_X_ORG_SERVER_PRE_COMMAND=
+HEADLESS_X_ORG_SERVER_COMMAND="echo"
+EOF
+
+}
+
+# Get the directory where the script is located and the parent.
+OUR_FOLDER="$(dirname "$0")"
+OUR_FOLDER=$(cd "${OUR_FOLDER}" && pwd)
+VBOX_FOLDER=$(cd "${OUR_FOLDER}/.." && pwd)
+[ -d "${VBOX_FOLDER}" ] ||
+ abort "Failed to change to directory ${VBOX_FOLDER}.\n"
+cd "${VBOX_FOLDER}"
+
+# Get our name for output.
+TEST_NAME="$(basename "$0" .sh)"
+
+# And remember the full path.
+TEST_NAME_FULL="${OUR_FOLDER}/$(basename "$0")"
+
+# Create a temporary directory for configuration and logging.
+TEST_FOLDER_BASE="/tmp/${TEST_NAME} 99/" # Space in the name to test quoting.
+if [ -n "${TESTBOX_PATH_SCRATCH}" ]; then
+ TEST_FOLDER_BASE="${TESTBOX_PATH_SCRATCH}/${TEST_NAME} 99/"
+fi
+{
+ rm -rf "${TEST_FOLDER_BASE}" 2>/dev/null &&
+ mkdir -m 0700 "${TEST_FOLDER_BASE}" 2>/dev/null
+} || abort "Could not create test folder (${TEST_FOLDER_BASE}).\n"
+
+###############################################################################
+# Simple start-up test. #
+###############################################################################
+print_line "simple start-up test"
+create_basic_configuration "${TEST_FOLDER_BASE}simple_start-up_test/"
+touch "${XORG_FOLDER}/xorg.conf.2"
+touch "${XORG_FOLDER}/xorg.conf.4"
+
+test_simple_start_up()
+{
+ STATUS="$1"
+ case "${STATUS}" in
+ 0)
+ LOG_FOLDER="${TEST_FOLDER}/log"
+ LOG="${LOG_FOLDER}/log"
+ if grep -q "2 ${XORG_FOLDER}/xorg.conf.2 ${LOG_FOLDER}/Xorg.2.log" "${LOG}" &&
+ grep -q "4 ${XORG_FOLDER}/xorg.conf.4 ${LOG_FOLDER}/Xorg.4.log" "${LOG}"; then
+ printf "SUCCESS.\n"
+ else
+ printf "\nFAILED: incorrect log output.\n"
+ fi
+ ;;
+ *)
+ printf "\nFAILED: exit status ${STATUS}.\n"
+ esac
+}
+
+scripts/VBoxHeadlessXOrg.sh -c "${TEST_FOLDER}conf" &
+PID=$!
+expect_exit "${PID}" 5 test_simple_start_up
+
+###############################################################################
+# No configuration files. #
+###############################################################################
+create_basic_configuration "${TEST_FOLDER_BASE}no_configuration_files/"
+print_line "no configuration files"
+
+test_should_fail()
+{
+ STATUS="$1"
+ case "${STATUS}" in
+ 0)
+ printf "\nFAILED: successful exit when an error was expected.\n"
+ ;;
+ *)
+ printf "SUCCESS.\n" # At least it behaved the way we wanted.
+ esac
+}
+
+scripts/VBoxHeadlessXOrg.sh -c "${TEST_FOLDER}conf" &
+PID=$!
+expect_exit "${PID}" 5 test_should_fail
+
+###############################################################################
+# Bad configuration files. #
+###############################################################################
+print_line "bad configuration files"
+create_basic_configuration "${TEST_FOLDER_BASE}bad_configuration_files/"
+touch "${XORG_FOLDER}/xorg.conf.2"
+touch "${XORG_FOLDER}/xorg.conf.4"
+touch "${XORG_FOLDER}/xorg.conf.other"
+scripts/VBoxHeadlessXOrg.sh -c "${TEST_FOLDER}conf" &
+PID=$!
+expect_exit "${PID}" 5 test_should_fail
+
+###############################################################################
+# Long running server command. #
+###############################################################################
+
+# Set up a configuration file for a long-running command.
+create_basic_configuration "${TEST_FOLDER_BASE}long-running_command/"
+cat >> "${TEST_FOLDER}conf" << EOF
+HEADLESS_X_ORG_SERVER_COMMAND="${TEST_FOLDER}command.sh"
+EOF
+
+cat > "${TEST_FOLDER}command.sh" << EOF
+#!/bin/sh
+touch "${TEST_FOLDER}stopped"
+touch "${TEST_FOLDER}started"
+trap "touch \\"${TEST_FOLDER}stopped\\"; exit" TERM
+rm "${TEST_FOLDER}stopped"
+while true; do :; done
+EOF
+chmod a+x "${TEST_FOLDER}command.sh"
+
+print_line "long running server command"
+touch "${XORG_FOLDER}/xorg.conf.5"
+FAILURE=""
+scripts/VBoxHeadlessXOrg.sh -c "${TEST_FOLDER}conf" &
+PID="$!"
+while [ ! -f "${TEST_FOLDER}started" ]; do :; done
+while [ -f "${TEST_FOLDER}stopped" ]; do :; done
+[ -n "${PID}" ] && kill "${PID}" 2>/dev/null
+while [ ! -f "${TEST_FOLDER}stopped" ]; do :; done
+printf "SUCCESS.\n"
+
+###############################################################################
+# Pre-requisite test. #
+###############################################################################
+
+# Set up a configuration file with a pre-requisite.
+create_basic_configuration "${TEST_FOLDER_BASE}pre-requisite/"
+cat >> "${TEST_FOLDER}conf" << EOF
+HEADLESS_X_ORG_WAIT_FOR_PREREQUISITES="false"
+EOF
+
+print_line "configuration file with failed pre-requisite"
+touch "${XORG_FOLDER}/xorg.conf.2"
+touch "${XORG_FOLDER}/xorg.conf.4"
+if scripts/VBoxHeadlessXOrg.sh -c "${TEST_FOLDER}conf"; then
+ echo "\nFAILED to stop for failed pre-requisite.\n"
+else
+ echo "SUCCESS"
+fi
+
+###############################################################################
+# Pre-command test. #
+###############################################################################
+
+# Set up our pre-command test configuration file.
+create_basic_configuration "${TEST_FOLDER_BASE}pre-command/"
+
+cat >> "${TEST_FOLDER}conf" << EOF
+test_pre_command_server_pre_command()
+{
+ touch "${TEST_FOLDER}/run/pre"
+}
+test_pre_command_server_command()
+{
+ cp "${TEST_FOLDER}/run/pre" "${TEST_FOLDER}/run/pre2"
+}
+HEADLESS_X_ORG_SERVER_PRE_COMMAND="test_pre_command_server_pre_command"
+HEADLESS_X_ORG_SERVER_COMMAND="test_pre_command_server_command"
+EOF
+
+print_line "pre-command test"
+touch "${XORG_FOLDER}/xorg.conf.2"
+
+test_pre_command()
+{
+ STATUS="$1"
+ case "${STATUS}" in
+ 0)
+ LOG_FOLDER="${TEST_FOLDER}/log"
+ LOG="${LOG_FOLDER}/log"
+ if [ -e "${TEST_FOLDER}/run/pre" ] && [ -e "${TEST_FOLDER}/run/pre2" ]; then
+ printf "SUCCESS.\n"
+ else
+ printf "\nFAILED: pre-command not executed.\n"
+ fi
+ ;;
+ *)
+ printf "\nFAILED: exit status ${STATUS}.\n"
+ esac
+}
+
+rm -f "${TEST_FOLDER}/run/pre"
+scripts/VBoxHeadlessXOrg.sh -c "${TEST_FOLDER}conf" &
+PID=$!
+expect_exit "${PID}" 5 test_pre_command
+
+###############################################################################
+# Post-command test. #
+###############################################################################
+
+# Set up our post-command test configuration file.
+create_basic_configuration "${TEST_FOLDER_BASE}post-command/"
+cat >> "${TEST_FOLDER}conf" << EOF
+test_post_command_post_command()
+{
+ echo "\${1}" > "${TEST_FOLDER}/run/post"
+}
+HEADLESS_X_ORG_SERVER_POST_COMMAND="test_post_command_post_command"
+EOF
+
+print_line "post-command test"
+touch "${XORG_FOLDER}/xorg.conf.2"
+touch "${XORG_FOLDER}/xorg.conf.4"
+
+test_post_command()
+{
+ STATUS="$1"
+ case "${STATUS}" in
+ 0)
+ LOG_FOLDER="${TEST_FOLDER}/log"
+ LOG="${LOG_FOLDER}/log"
+ if grep -q "2 4" "${TEST_FOLDER}/run/post"; then
+ printf "SUCCESS.\n"
+ else
+ printf "\nFAILED: post-command not executed.\n"
+ fi
+ ;;
+ *)
+ printf "\nFAILED: exit status ${STATUS}.\n"
+ esac
+}
+
+rm -f "${TEST_FOLDER}/run/post"
+scripts/VBoxHeadlessXOrg.sh -c "${TEST_FOLDER}conf" &
+PID=$!
+expect_exit "${PID}" 5 test_post_command
diff --git a/src/VBox/Installer/linux/testcase/tstInstallInit.sh b/src/VBox/Installer/linux/testcase/tstInstallInit.sh
new file mode 100755
index 00000000..9c6c1bab
--- /dev/null
+++ b/src/VBox/Installer/linux/testcase/tstInstallInit.sh
@@ -0,0 +1,365 @@
+#!/bin/sh
+# $Id: tstInstallInit.sh $
+## @file
+# VirtualBox init file creator unit test.
+#
+
+#
+# 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.
+#
+
+# This will initially be a skeleton with a couple of tests - add more for quick
+# debugging when you suspect that something isn't working as specified.
+
+tab=" "
+tmpbase="/tmp/tstInstallInit 99" # Space in the name for a little stress...
+if [ -n "${TESTBOX_PATH_SCRATCH}" ]; then
+ tmpbase="${TESTBOX_PATH_SCRATCH}/tstInstallInit 99"
+fi
+
+## The function definition at the start of every non-trivial shell script!
+abort()
+{
+ ## $1 Error text to output to standard error in printf format.
+ cat >&2 << EOF
+${TEST_NAME}: $1
+EOF
+ exit 1
+}
+
+## Print a TESTING line.
+print_line()
+{
+ cat >&2 << EOF
+${TEST_NAME}: TESTING $1
+EOF
+}
+
+## Set the failure message if it is not yet set.
+fail_msg()
+{
+ test -z "${failed}" && failed="FAILED: ${1}"
+}
+
+# Get the directory where the script is located and the parent.
+OUR_FOLDER=`dirname "$0"`
+OUR_FOLDER=`cd "${OUR_FOLDER}" && pwd`
+VBOX_FOLDER=`cd "${OUR_FOLDER}/.." && pwd`
+[ -d "${VBOX_FOLDER}" ] ||
+ abort "Failed to change to directory ${VBOX_FOLDER}.\n"
+cd "${VBOX_FOLDER}"
+
+# Get our name for output.
+TEST_NAME="$(basename "$0" .sh)"
+
+# Create a trivial test service in temporary directory $1 with name $2.
+test_service()
+{
+ cat > "${1}/${2}" << EOF
+#!/bin/sh
+trap "touch \"${1}/stopped\"; exit" TERM
+echo "1: \${1} 2: \${2} 3: \${3}" > "${1}/started"
+while true; do true; done
+EOF
+chmod u+x "${1}/${2}"
+}
+
+# Create a trivial test command in temporary directory $1 with name $2.
+test_oneshot()
+{
+ cat > "${1}/${2}" << EOF
+#!/bin/sh
+if test "\${1}" = start; then
+ touch "${1}/started"
+else
+ rm "${1}/started"
+fi
+exit 0
+EOF
+chmod u+x "${1}/${2}"
+}
+
+# Test some dodgy input values against generate_service_file.
+# Make sure there is a substitution pattern at the end too.
+print_line "generation of shell script from template."
+input='TEST1%DESCRIPTION%%%%SERVICE_NAME%%STOP_COMMAND% TST2 TEST %ARGUMENTS%%COMMAND%'
+out=`echo "${input}" |
+ helpers/generate_service_file --command '/usr/bin
+aries/hello
+world' --arguments 'p\x0a0\n\ \t' --format shell --description ''`
+expected='TEST1%hello
+world TST2 TEST '\''p
+0
+ '"${tab}"\'\''/usr/bin
+aries/hello
+world'\'
+case "${out}" in ${expected})
+echo "SUCCESS (1)";;
+*)
+cat << EOF
+FAILED: expected
+${expected}
+but got
+${out}
+EOF
+esac
+input='TEST%HAVE_STOP_COMMAND%%SERVICE_NAME%%STOP_COMMAND% TST2
+ TEST %COMMAND%'
+out=`echo "${input}" |
+ helpers/generate_service_file --command '/usr/bin/hello' --format shell --description ''`
+expected='TEST TEST '\''/usr/bin/hello'\'''
+case "${out}" in ${expected})
+echo "SUCCESS (2)";;
+*)
+cat << EOF
+FAILED: expected
+${expected}
+but got
+${out}
+EOF
+esac
+input='TEST%HAVE_STOP_COMMAND%%SERVICE_NAME%%STOP_COMMAND% %STOP_ARGUMENTS% TST2
+ TEST %COMMAND%'
+out=`echo "${input}" |
+ helpers/generate_service_file --command '/usr/bin/hello' --format shell --description '' --stop-command /usr/bin/stop --stop-arguments hello`
+expected='TESThello'\''/usr/bin/stop'\'' '\''hello'\'' TST2
+ TEST '\''/usr/bin/hello'\'''
+case "${out}" in ${expected})
+echo "SUCCESS (3)";;
+*)
+cat << EOF
+FAILED: expected
+${expected}
+but got
+${out}
+EOF
+esac
+
+# Create a simulated init system layout.
+create_simulated_init_tree()
+{
+ tmpdir="${1}"
+ rm -rf "${tmpdir}"
+ mkdir -m 0700 "${tmpdir}" || abort "Failed to create a temporary folder."
+ mkdir -p "${tmpdir}/init.d/" "${tmpdir}/rc.d/init.d/"
+ for i in 0 1 2 3 4 5 6; do
+ mkdir "${tmpdir}/rc${i}.d/" "${tmpdir}/rc.d/rc${i}.d/"
+ done
+ mkdir -p "${tmpdir}/runlevel/default" "${tmpdir}/runlevel/boot"
+ mkdir "${tmpdir}/run"
+}
+
+# Test an init script installation.
+print_line "installing an init script."
+failed=""
+# Create a simulated init system layout.
+tmpdir="${tmpbase}0"
+create_simulated_init_tree "${tmpdir}"
+# Create the service binary.
+test_service "${tmpdir}" "service"
+# And install it.
+scripts/install_service --prefix "${tmpdir}" --enable -- --command "${tmpdir}/service" --arguments "test of my\ arguments" --description "My description" ||
+ fail_msg "\"scripts/install_service\" failed."
+# Check that the main service file was created as specified.
+if test -x "${tmpdir}/init.d/service"; then
+ grep "Short-Description: My description" "${tmpdir}/init.d/service" >/dev/null ||
+ fail_msg "Description not set in \"${tmpdir}/init.d/service\""
+else
+ fail_msg "\"${tmpdir}/init.d/service\" not correctly created."
+fi
+test -x "${tmpdir}/init.d/rc.d/service" &&
+ fail_msg "\"${tmpdir}/init.d/rc.d/service\" created but shouldn't have been."
+# Try to start the service using the symbolic links which should have been
+# created.
+if "${tmpdir}/rc3.d/S20service" --prefix "${tmpdir}" --lsb-functions "" start >/dev/null 2>&1; then
+ if grep "1: test 2: of 3: my arguments" "${tmpdir}/started" >/dev/null; then
+ test -f "${tmpdir}/stopped" &&
+ fail_msg "\"${tmpdir}/rc3.d/S20service\" stopped immediately."
+ else
+ fail_msg "\"${tmpdir}/rc3.d/S20service\" did not start correctly."
+ fi
+else
+ fail_msg "could not start \"${tmpdir}/rc3.d/S20service\"."
+fi
+# Check the status.
+"${tmpdir}/rc.d/rc5.d/S20service" --prefix "${tmpdir}" --lsb-functions "" status >/dev/null 2>&1 ||
+ fail_msg "\"${tmpdir}/rc.d/rc5.d/S20service\" reported the wrong status."
+# Try to stop the service using the symbolic links which should have been
+# created.
+if "${tmpdir}/rc.d/rc6.d/K80service" --prefix "${tmpdir}" --lsb-functions "" stop >/dev/null 2>&1; then
+ test -f "${tmpdir}/stopped" ||
+ echo "\"${tmpdir}/rc.d/rc6.d/K80service\" did not stop correctly."
+else
+ fail_msg "could not stop \"${tmpdir}/rc.d/rc6.d/K80service\"."
+fi
+# Check the status again - now it should be stopped.
+"${tmpdir}/runlevel/service" --prefix "${tmpdir}" --lsb-functions "" status >/dev/null 2>&1 &&
+ fail_msg "\"${tmpdir}/runlevel/service\" reported the wrong status."
+# Final summary.
+if test -n "${failed}"; then
+ echo "${failed}"
+else
+ echo SUCCESS
+fi
+
+# Test an one shot init script installation.
+print_line "installing a one shot init script."
+failed=""
+# Create a simulated init system layout.
+tmpdir="${tmpbase}0"
+create_simulated_init_tree "${tmpdir}"
+# Create the command binary.
+test_oneshot "${tmpdir}" "command"
+# And install the script.
+scripts/install_service --prefix "${tmpdir}" --enable -- --command "${tmpdir}/command" --arguments "start" --description "My description" --stop-command "${tmpdir}/command" --stop-arguments "stop" --one-shot ||
+ fail_msg "\"scripts/install_service\" failed."
+# Sanity test.
+test -f "${tmpdir}/started" &&
+ fail_msg "\"${tmpdir}/started\" already exists!"
+# Try to start the service using the symbolic links which should have been
+# created.
+if "${tmpdir}/rc3.d/S20command" --prefix "${tmpdir}" --lsb-functions "" start >/dev/null 2>&1; then
+ test -f "${tmpdir}/started" ||
+ fail_msg "\"${tmpdir}/rc3.d/S20command\" did not start correctly."
+else
+ fail_msg "could not start \"${tmpdir}/rc3.d/S20command\"."
+fi
+# Try to stop the service using the symbolic links which should have been
+# created.
+if "${tmpdir}/rc.d/rc6.d/K80command" --prefix "${tmpdir}" --lsb-functions "" stop >/dev/null 2>&1; then
+ test -f "${tmpdir}/started" &&
+ echo "\"${tmpdir}/rc.d/rc6.d/K80command\" did not stop correctly."
+else
+ fail_msg "could not stop \"${tmpdir}/rc.d/rc6.d/K80command\"."
+fi
+# Final summary.
+if test -n "${failed}"; then
+ echo "${failed}"
+else
+ echo SUCCESS
+fi
+
+# Test an init script removal.
+print_line "removing an init script."
+failed=""
+# Create a simulated init system layout.
+tmpdir="${tmpbase}0"
+create_simulated_init_tree "${tmpdir}"
+# Create the service binary.
+test_service "${tmpdir}" "service"
+# Install it.
+scripts/install_service --prefix "${tmpdir}" --enable -- --command "${tmpdir}/service" --arguments "test of my\ arguments" --description "My description" ||
+ fail_msg "\"scripts/install_service\" failed."
+# And remove it again.
+scripts/install_service --prefix "${tmpdir}" --remove -- --command "${tmpdir}/service" ||
+ fail_msg "\"scripts/install_service\" failed."
+# After uninstallation this should be the only file left in the init tree.
+rm "${tmpdir}/service"
+test "x`find "${tmpdir}" -type f -o -type l`" = "x" ||
+ fail_msg "not all files were removed."
+# Final summary.
+if test -n "${failed}"; then
+ echo "${failed}"
+else
+ echo SUCCESS
+fi
+
+# Test an enabled init script update with --disable.
+print_line "updating an enabled init script with --disable."
+failed=""
+# Create a simulated init system layout.
+tmpdir="${tmpbase}1"
+create_simulated_init_tree "${tmpdir}"
+# Create the service binary.
+test_service "${tmpdir}" "service"
+# Install it.
+scripts/install_service --prefix "${tmpdir}" --enable -- --command "${tmpdir}/service" --arguments "test of my\ arguments" --description "My description" ||
+ fail_msg "\"scripts/install_service\" failed."
+# Install it disabled without forcing.
+scripts/install_service --prefix "${tmpdir}" --disable -- --command "${tmpdir}/service" --arguments "test of my\ arguments" --description "My description" ||
+ fail_msg "\"scripts/install_service\" failed."
+test "x`find "${tmpdir}"/rc*.d "${tmpdir}/runlevel" -type l | wc -l`" = "x15" ||
+ fail_msg "links were removed on non-forced disable."
+# Final summary.
+if test -n "${failed}"; then
+ echo "${failed}"
+else
+ echo SUCCESS
+fi
+
+# Test updating a disabled init script with --enable.
+print_line "updating a disabled init script with --enable."
+failed=""
+# Create a simulated init system layout.
+tmpdir="${tmpbase}2"
+create_simulated_init_tree "${tmpdir}"
+# Create the service binary.
+test_service "${tmpdir}" "service"
+# Install it.
+scripts/install_service --prefix "${tmpdir}" --disable -- --command "${tmpdir}/service" --arguments "test of my\ arguments" --description "My description" ||
+ fail_msg "\"scripts/install_service\" failed."
+# Install it disabled without forcing.
+scripts/install_service --prefix "${tmpdir}" --enable -- --command "${tmpdir}/service" --arguments "test of my\ arguments" --description "My description" ||
+ fail_msg "\"scripts/install_service\" failed."
+test "x`find "${tmpdir}"/rc*.d "${tmpdir}/runlevel" -type l`" = "x" ||
+ fail_msg "files were installed on non-forced enable."
+# Final summary.
+if test -n "${failed}"; then
+ echo "${failed}"
+else
+ echo SUCCESS
+fi
+
+# Test an enabled init script update with --force-disable.
+print_line "updating an enabled init script with --force-disable."
+failed=""
+# Create a simulated init system layout.
+tmpdir="${tmpbase}3"
+create_simulated_init_tree "${tmpdir}"
+# Create the service binary.
+test_service "${tmpdir}" "service"
+# Install it.
+scripts/install_service --prefix "${tmpdir}" --enable -- --command "${tmpdir}/service" --arguments "test of my\ arguments" --description "My description" ||
+ fail_msg "\"scripts/install_service\" failed."
+# Install it disabled without forcing.
+scripts/install_service --prefix "${tmpdir}" --force-disable -- --command "${tmpdir}/service" --arguments "test of my\ arguments" --description "My description" ||
+ fail_msg "\"scripts/install_service\" failed."
+test "x`find "${tmpdir}"/rc*.d "${tmpdir}/runlevel" -type l`" = "x" ||
+ fail_msg "links were not removed on forced disable."
+# Final summary.
+if test -n "${failed}"; then
+ echo "${failed}"
+else
+ echo SUCCESS
+fi
+
+# Test updating a disabled init script with --force-enable.
+print_line "updating a disabled init script with --force-enable."
+failed=""
+# Create a simulated init system layout.
+tmpdir="${tmpbase}4"
+create_simulated_init_tree "${tmpdir}"
+# Create the service binary.
+test_service "${tmpdir}" "service"
+# Install it.
+scripts/install_service --prefix "${tmpdir}" --disable -- --command "${tmpdir}/service" --arguments "test of my\ arguments" --description "My description" ||
+ fail_msg "\"scripts/install_service\" failed."
+# Install it disabled without forcing.
+scripts/install_service --prefix "${tmpdir}" --force-enable -- --command "${tmpdir}/service" --arguments "test of my\ arguments" --description "My description" ||
+ fail_msg "\"scripts/install_service\" failed."
+test "x`find "${tmpdir}"/rc*.d "${tmpdir}/runlevel" -type l | wc -l`" = "x15" ||
+ fail_msg "files were not installed on forced enable."
+# Final summary.
+if test -n "${failed}"; then
+ echo "${failed}"
+else
+ echo SUCCESS
+fi
diff --git a/src/VBox/Installer/linux/testcase/tstInstallerLinux.sh b/src/VBox/Installer/linux/testcase/tstInstallerLinux.sh
index 1a5f0ce8..d2708ed3 100755
--- a/src/VBox/Installer/linux/testcase/tstInstallerLinux.sh
+++ b/src/VBox/Installer/linux/testcase/tstInstallerLinux.sh
@@ -83,7 +83,7 @@ extern_test_input_install_device_node_setup() {
do_install_create_usb_node_for_sysfs "$@";;
*)
echo Unknown command $command >&2; exit 1;;
- esac
+ esac
}
setup_test_input_install_device_node_setup() {
diff --git a/src/VBox/Installer/linux/uninstall.sh b/src/VBox/Installer/linux/uninstall.sh
index 947f3435..b479b19c 100755
--- a/src/VBox/Installer/linux/uninstall.sh
+++ b/src/VBox/Installer/linux/uninstall.sh
@@ -4,7 +4,7 @@
# VirtualBox linux uninstallation script
#
-# Copyright (C) 2009-2010 Oracle Corporation
+# Copyright (C) 2009-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;
@@ -57,6 +57,8 @@ stop_init_script vboxweb-service
check_running
# Terminate VBoxNetDHCP if running
terminate_proc VBoxNetDHCP
+# Terminate VBoxNetNAT if running
+terminate_proc VBoxNetNAT
delrunlevel vboxballoonctrl-service > /dev/null 2>&1
remove_init_script vboxballoonctrl-service
delrunlevel vboxautostart-service > /dev/null 2>&1
@@ -98,6 +100,7 @@ rm -f \
/usr/bin/VBoxBalloonCtrl \
/usr/bin/VBoxAutostart \
/usr/bin/VBoxNetDHCP \
+ /usr/bin/VBoxNetNAT \
/usr/bin/vboxwebsrv \
/usr/bin/VBoxAddIF \
/usr/bin/VBoxDeleteIf \
diff --git a/src/VBox/Installer/linux/vboxautostart-service.sh.in b/src/VBox/Installer/linux/vboxautostart-service.sh
index 9487b8f9..33462e18 100755
--- a/src/VBox/Installer/linux/vboxautostart-service.sh.in
+++ b/src/VBox/Installer/linux/vboxautostart-service.sh
@@ -26,23 +26,21 @@
### END INIT INFO
PATH=$PATH:/bin:/sbin:/usr/sbin
-DEBIAN=%DEBIAN%
-NOLSB=%NOLSB%
-[ -f /lib/lsb/init-functions ] || NOLSB=yes
+[ -f /etc/debian_release -a -f /lib/lsb/init-functions ] || NOLSB=yes
[ -f /etc/vbox/vbox.cfg ] && . /etc/vbox/vbox.cfg
if [ -n "$INSTALL_DIR" ]; then
binary="$INSTALL_DIR/VBoxAutostart"
else
- binary="/usr/lib/%PACKAGE%/VBoxAutostart"
+ binary="/usr/lib/virtualbox/VBoxAutostart"
fi
# silently exit if the package was uninstalled but not purged,
-# applies to Debian packages only
-[ -z "$DEBIAN" -o -x $binary ] || exit 0
+# applies to Debian packages only (but shouldn't hurt elsewhere)
+[ ! -f /etc/debian_release -o -x $binary ] || exit 0
-[ -r /etc/default/%PACKAGE% ] && . /etc/default/%PACKAGE%
+[ -r /etc/default/virtualbox ] && . /etc/default/virtualbox
system=unknown
if [ -f /etc/redhat-release ]; then
@@ -292,25 +290,17 @@ stop() {
[ -z "$VBOXAUTOSTART_DB" ] && exit 0
[ -z "$VBOXAUTOSTART_CONFIG" ] && exit 0
- exit 0
-
- #begin_msg "Stopping VirtualBox VMs configured for autostop";
- #vboxdrvrunning || {
- # fail_msg "VirtualBox kernel module not loaded!"
- # exit 0
- #}
- #PARAMS="--stop"
- #[ -n "$VBOXAUTOSTART_CONFIG" ] && PARAMS="$PARAMS -c $VBOXAUTOSTART_CONFIG"
+ PARAMS="--stop --config $VBOXAUTOSTART_CONFIG"
# prevent inheriting this setting to VBoxSVC
- #unset VBOX_RELEASE_LOG_DEST
+ unset VBOX_RELEASE_LOG_DEST
- #for user in `ls $VBOXAUTOSTART_DB/*.stop`
- #do
- # start_daemon `basename $user | sed -ne "s/\(.*\).stop/\1/p"` $binary $PARAMS > /dev/null 2>&1
- #done
+ for user in `ls $VBOXAUTOSTART_DB/*.stop`
+ do
+ start_daemon `basename $user | sed -ne "s/\(.*\).stop/\1/p"` $binary $PARAMS > /dev/null 2>&1
+ done
- #return $RETVAL
+ return $RETVAL
}
case "$1" in
diff --git a/src/VBox/Installer/linux/vboxballoonctrl-service.sh.in b/src/VBox/Installer/linux/vboxballoonctrl-service.sh
index 3f0b8ea8..e10b86af 100755
--- a/src/VBox/Installer/linux/vboxballoonctrl-service.sh.in
+++ b/src/VBox/Installer/linux/vboxballoonctrl-service.sh
@@ -1,8 +1,8 @@
#!/bin/sh
#
-# VirtualBox balloon control daemon init script.
+# VirtualBox watchdog daemon init script.
#
-# Copyright (C) 2006-2012 Oracle Corporation
+# Copyright (C) 2006-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;
@@ -14,7 +14,7 @@
#
# chkconfig: 35 35 65
-# description: VirtualBox balloon control daemon
+# description: VirtualBox watchdog daemon
#
### BEGIN INIT INFO
# Provides: vboxballoonctrl-service
@@ -22,27 +22,25 @@
# Required-Stop: vboxdrv
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
-# Description: VirtualBox balloon control daemon
+# Description: VirtualBox watchdog daemon
### END INIT INFO
PATH=$PATH:/bin:/sbin:/usr/sbin
-DEBIAN=%DEBIAN%
-NOLSB=%NOLSB%
-[ -f /lib/lsb/init-functions ] || NOLSB=yes
+[ -f /lib/lsb/init-functions -a -f /etc/debian_release ] || NOLSB=yes
[ -f /etc/vbox/vbox.cfg ] && . /etc/vbox/vbox.cfg
if [ -n "$INSTALL_DIR" ]; then
binary="$INSTALL_DIR/VBoxBalloonCtrl"
else
- binary="/usr/lib/%PACKAGE%/VBoxBalloonCtrl"
+ binary="/usr/lib/virtualbox/VBoxBalloonCtrl"
fi
# silently exit if the package was uninstalled but not purged,
-# applies to Debian packages only
-[ -z "$DEBIAN" -o -x $binary ] || exit 0
+# applies to Debian packages only (but shouldn't hurt elsewhere)
+[ ! -f /etc/debian_release -o -x $binary ] || exit 0
-[ -r /etc/default/%PACKAGE% ] && . /etc/default/%PACKAGE%
+[ -r /etc/default/virtualbox ] && . /etc/default/virtualbox
system=unknown
if [ -f /etc/redhat-release ]; then
@@ -279,31 +277,43 @@ vboxdrvrunning() {
check_single_user() {
if [ -n "$2" ]; then
- fail_msg "VBOXBALLOONCTRL_USER must not contain multiple users!"
+ fail_msg "VBOXWATCHDOG_USER must not contain multiple users!"
exit 1
fi
}
start() {
if ! test -f $PIDFILE; then
- [ -z "$VBOXBALLOONCTRL_USER" ] && exit 0
- begin_msg "Starting VirtualBox balloon control service";
- check_single_user $VBOXBALLOONCTRL_USER
+ [ -z "$VBOXWATCHDOG_USER" -a -z "$VBOXBALLOONCTRL_USER" ] && exit 0
+ [ -z "$VBOXWATCHDOG_USER" ] && VBOXWATCHDOG_USER="$VBOXBALLOONCTRL_USER"
+ begin_msg "Starting VirtualBox watchdog service";
+ check_single_user $VBOXWATCHDOG_USER
vboxdrvrunning || {
fail_msg "VirtualBox kernel module not loaded!"
exit 0
}
+ # Handle legacy parameters, do not add any further ones unless absolutely necessary.
+ [ -z "$VBOXWATCHDOG_BALLOON_INTERVAL" -a -n "$VBOXBALLOONCTRL_INTERVAL" ] && VBOXWATCHDOG_BALLOON_INTERVAL="$VBOXBALLOONCTRL_INTERVAL"
+ [ -z "$VBOXWATCHDOG_BALLOON_INCREMENT" -a -n "$VBOXBALLOONCTRL_INCREMENT" ] && VBOXWATCHDOG_BALLOON_INCREMENT="$VBOXBALLOONCTRL_INCREMENT"
+ [ -z "$VBOXWATCHDOG_BALLOON_DECREMENT" -a -n "$VBOXBALLOONCTRL_DECREMENT" ] && VBOXWATCHDOG_BALLOON_DECREMENT="$VBOXBALLOONCTRL_DECREMENT"
+ [ -z "$VBOXWATCHDOG_BALLOON_LOWERLIMIT" -a -n "$VBOXBALLOONCTRL_LOWERLIMIT" ] && VBOXWATCHDOG_BALLOON_LOWERLIMIT="$VBOXBALLOONCTRL_LOWERLIMIT"
+ [ -z "$VBOXWATCHDOG_BALLOON_SAFETYMARGIN" -a -n "$VBOXBALLOONCTRL_SAFETYMARGIN" ] && VBOXWATCHDOG_BALLOON_SAFETYMARGIN="$VBOXBALLOONCTRL_SAFETYMARGIN"
+ [ -z "$VBOXWATCHDOG_ROTATE" -a -n "$VBOXBALLOONCTRL_ROTATE" ] && VBOXWATCHDOG_ROTATE="$VBOXBALLOONCTRL_ROTATE"
+ [ -z "$VBOXWATCHDOG_LOGSIZE" -a -n "$VBOXBALLOONCTRL_LOGSIZE" ] && VBOXWATCHDOG_LOGSIZE="$VBOXBALLOONCTRL_LOGSIZE"
+ [ -z "$VBOXWATCHDOG_LOGINTERVAL" -a -n "$VBOXBALLOONCTRL_LOGINTERVAL" ] && VBOXWATCHDOG_LOGINTERVAL="$VBOXBALLOONCTRL_LOGINTERVAL"
+
PARAMS="--background"
- [ -n "$VBOXBALLOONCTRL_INTERVAL" ] && PARAMS="$PARAMS --balloon-interval $VBOXBALLOONCTRL_INTERVAL"
- [ -n "$VBOXBALLOONCTRL_INCREMENT" ] && PARAMS="$PARAMS --balloon-inc $VBOXBALLOONCTRL_INCREMENT"
- [ -n "$VBOXBALLOONCTRL_DECREMENT" ] && PARAMS="$PARAMS --balloon-dec $VBOXBALLOONCTRL_DECREMENT"
- [ -n "$VBOXBALLOONCTRL_LOWERLIMIT" ] && PARAMS="$PARAMS --balloon-lower-limit $VBOXBALLOONCTRL_LOWERLIMIT"
- [ -n "$VBOXBALLOONCTRL_ROTATE" ] && PARAMS="$PARAMS -R $VBOXBALLOONCTRL_ROTATE"
- [ -n "$VBOXBALLOONCTRL_LOGSIZE" ] && PARAMS="$PARAMS -S $VBOXBALLOONCTRL_LOGSIZE"
- [ -n "$VBOXBALLOONCTRL_LOGINTERVAL" ] && PARAMS="$PARAMS -I $VBOXBALLOONCTRL_LOGINTERVAL"
+ [ -n "$VBOXWATCHDOG_BALLOON_INTERVAL" ] && PARAMS="$PARAMS --balloon-interval \"$VBOXWATCHDOG_BALLOON_INTERVAL\""
+ [ -n "$VBOXWATCHDOG_BALLOON_INCREMENT" ] && PARAMS="$PARAMS --balloon-inc \"$VBOXWATCHDOG_BALLOON_INCREMENT\""
+ [ -n "$VBOXWATCHDOG_BALLOON_DECREMENT" ] && PARAMS="$PARAMS --balloon-dec \"$VBOXWATCHDOG_BALLOON_DECREMENT\""
+ [ -n "$VBOXWATCHDOG_BALLOON_LOWERLIMIT" ] && PARAMS="$PARAMS --balloon-lower-limit \"$VBOXWATCHDOG_BALLOON_LOWERLIMIT\""
+ [ -n "$VBOXWATCHDOG_BALLOON_SAFETYMARGIN" ] && PARAMS="$PARAMS --balloon-safety-margin \"$VBOXWATCHDOG_BALLOON_SAFETYMARGIN\""
+ [ -n "$VBOXWATCHDOG_ROTATE" ] && PARAMS="$PARAMS -R \"$VBOXWATCHDOG_ROTATE\""
+ [ -n "$VBOXWATCHDOG_LOGSIZE" ] && PARAMS="$PARAMS -S \"$VBOXWATCHDOG_LOGSIZE\""
+ [ -n "$VBOXWATCHDOG_LOGINTERVAL" ] && PARAMS="$PARAMS -I \"$VBOXWATCHDOG_LOGINTERVAL\""
# prevent inheriting this setting to VBoxSVC
unset VBOX_RELEASE_LOG_DEST
- start_daemon $VBOXBALLOONCTRL_USER $binary $PARAMS > /dev/null 2>&1
+ start_daemon $VBOXWATCHDOG_USER $binary $PARAMS > /dev/null 2>&1
# ugly: wait until the final process has forked
sleep .1
PID=`pidof $binary 2>/dev/null`
@@ -321,7 +331,7 @@ start() {
stop() {
if test -f $PIDFILE; then
- begin_msg "Stopping VirtualBox balloon control service";
+ begin_msg "Stopping VirtualBox watchdog service";
killproc $binary
RETVAL=$?
if ! pidof $binary > /dev/null 2>&1; then
@@ -339,7 +349,7 @@ restart() {
}
status() {
- echo -n "Checking for VBox balloon control service"
+ echo -n "Checking for VBox watchdog service"
if [ -f $PIDFILE ]; then
echo " ...running"
else
diff --git a/src/VBox/Installer/linux/vboxdrv.sh.in b/src/VBox/Installer/linux/vboxdrv.sh.in
index 6e33f233..82bbdbf1 100755
--- a/src/VBox/Installer/linux/vboxdrv.sh.in
+++ b/src/VBox/Installer/linux/vboxdrv.sh.in
@@ -3,7 +3,7 @@
# Linux kernel module init script
#
-# Copyright (C) 2006-2010 Oracle Corporation
+# Copyright (C) 2006-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;
@@ -29,8 +29,6 @@
PATH=/sbin:/bin:/usr/sbin:/usr/bin:$PATH
DEVICE=/dev/vboxdrv
LOG="/var/log/vbox-install.log"
-NOLSB=%NOLSB%
-DEBIAN=%DEBIAN%
VERSION=%VERSION%
MODPROBE=/sbin/modprobe
@@ -38,7 +36,7 @@ if $MODPROBE -c | grep -q '^allow_unsupported_modules *0'; then
MODPROBE="$MODPROBE --allow-unsupported-modules"
fi
-[ -f /lib/lsb/init-functions ] || NOLSB=yes
+[ -f /etc/debian_release -a -f /lib/lsb/init-functions ] || NOLSB=yes
[ -f /etc/vbox/vbox.cfg ] && . /etc/vbox/vbox.cfg
export BUILD_TYPE
export USERNAME
@@ -48,15 +46,15 @@ if [ -n "$INSTALL_DIR" ]; then
VBOXMANAGE="$INSTALL_DIR/VBoxManage"
MODULE_SRC="$INSTALL_DIR/src/vboxhost"
else
- VBOXMANAGE="/usr/lib/%PACKAGE%/VBoxManage"
- MODULE_SRC="/usr/share/%PACKAGE%/src/vboxhost"
+ VBOXMANAGE="/usr/lib/virtualbox/VBoxManage"
+ MODULE_SRC="/usr/share/virtualbox/src/vboxhost"
fi
BUILDINTMP="$MODULE_SRC/build_in_tmp"
DODKMS="$MODULE_SRC/do_dkms"
# silently exit if the package was uninstalled but not purged,
-# applies to Debian packages only
-[ -z "$DEBIAN" -o -x $VBOXMANAGE -a -x $BUILDINTMP ] || exit 0
+# applies to Debian packages only (but shouldn't hurt elsewhere)
+[ ! -f /etc/debian_release -o -x $VBOXMANAGE -a -x $BUILDINTMP ] || exit 0
if [ -n "$NOLSB" ]; then
if [ -f /etc/redhat-release ]; then
@@ -68,7 +66,7 @@ if [ -n "$NOLSB" ]; then
fi
fi
-[ -r /etc/default/%PACKAGE% ] && . /etc/default/%PACKAGE%
+[ -r /etc/default/virtualbox ] && . /etc/default/virtualbox
if [ -z "$NOLSB" ]; then
. /lib/lsb/init-functions
@@ -247,7 +245,7 @@ stop()
succ_msg
}
-# enter the following variables in /etc/default/%PACKAGE%:
+# enter the following variables in /etc/default/virtualbox:
# SHUTDOWN_USERS="foo bar"
# check for running VMs of user foo and user bar
# SHUTDOWN=poweroff
diff --git a/src/VBox/Installer/linux/vboxweb-service.sh.in b/src/VBox/Installer/linux/vboxweb-service.sh
index 173fd7a9..4d6d4dd7 100755
--- a/src/VBox/Installer/linux/vboxweb-service.sh.in
+++ b/src/VBox/Installer/linux/vboxweb-service.sh
@@ -26,25 +26,23 @@
### END INIT INFO
PATH=$PATH:/bin:/sbin:/usr/sbin
-DEBIAN=%DEBIAN%
-NOLSB=%NOLSB%
-[ -f /lib/lsb/init-functions ] || NOLSB=yes
+[ -f /etc/debian_release -a -f /lib/lsb/init-functions ] || NOLSB=yes
[ -f /etc/vbox/vbox.cfg ] && . /etc/vbox/vbox.cfg
if [ -n "$INSTALL_DIR" ]; then
binary="$INSTALL_DIR/vboxwebsrv"
vboxmanage="$INSTALL_DIR/VBoxManage"
else
- binary="/usr/lib/%PACKAGE%/vboxwebsrv"
- vboxmanage="/usr/lib/%PACKAGE%/VBoxManage"
+ binary="/usr/lib/virtualbox/vboxwebsrv"
+ vboxmanage="/usr/lib/virtualbox/VBoxManage"
fi
# silently exit if the package was uninstalled but not purged,
-# applies to Debian packages only
-[ -z "$DEBIAN" -o -x $binary ] || exit 0
+# applies to Debian packages only (but shouldn't hurt elsewhere)
+[ ! -f /etc/debian_release -o -x $binary ] || exit 0
-[ -r /etc/default/%PACKAGE% ] && . /etc/default/%PACKAGE%
+[ -r /etc/default/virtualbox ] && . /etc/default/virtualbox
system=unknown
if [ -f /etc/redhat-release ]; then