summaryrefslogtreecommitdiffstats
path: root/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/run-virt.include
blob: adda65e3b624122acf166cbc48f9269cff606656 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# -----------------------------------------------------------------------------
#
# Copyright (c) 2009..2018 bwLehrpool-Projektteam
#
# This program/file is free software distributed under the GPL version 2.
# See https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
#
# If you have any feedback please consult https://bwlehrpool.de and
# send your feedback to support@bwlehrpool.de.
#
# General information about bwLehrpool can be found at https://bwlehrpool.de
#
# -----------------------------------------------------------------------------
# run-virt.include
#    - component for virtualbox of the vmchooser plugin vmchooser-run_virt
################################################################################

declare -rg VBOX_PLUGIN_DIR="$(dirname "${BASH_SOURCE[0]}")"
declare -rg VBOX_INCLUDE_DIR="${VBOX_PLUGIN_DIR}/includes"
declare -rg VBOX_BASE_DIR="/usr/lib/virtualbox"

declare -rg PLUGIN_FEATURES="firewall printer usb slxfloppy sound netshares"

run_plugin() {
	# declaration of default variables and some sanity checks
	$(safesource --exit "${VBOX_INCLUDE_DIR}/init_core.inc")

	# determine hardware limits based on guest OD
	$(safesource "${VBOX_INCLUDE_DIR}/guest_hardware_limits.inc")

	# create main virtualbox configuration
	$(safesource "${VBOX_INCLUDE_DIR}/create_vbox_config.inc")

	# prepare volatile rw layer for the disk image using a snapshot
	$(safesource "${VBOX_INCLUDE_DIR}/prepare_snapshot.inc")

	# finalize machine configuration
	$(safesource "${VBOX_INCLUDE_DIR}/finalize_machine_config.inc")

	# log config summary
	$(safesource "${VBOX_INCLUDE_DIR}/log_config_summary.inc")

	# set the variables appropriately (several interfaces with different names)
	declare -rg VIRTCMD="${VBOX_BASE_DIR}/VirtualBoxVM"
	VIRTCMDOPTS+=( "--startvm" "${MACHINE_UUID}" "--start-running" "--fullscreen" )

	# set headless mode (-v off to disable vrdp) XXX currently not supported/used
	#declare -rg VIRTCMDHL="${VBOX_BASE_DIR}/VBoxHeadless"
	#declare -rg VIRTCMDOPTSHL="-s ${MACHINE_UUID}"

	# for debugging purposes
	cp "$VBOX_MACHINE_CONFIG" "/tmp/vbox-last-config.$USER"
}