summaryrefslogtreecommitdiffstats
path: root/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/run-virt.include
blob: 08188b58955c48f541ca7ad583334611a8edfd8e (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# -----------------------------------------------------------------------------
# Copyright (c) 2009..2012 - RZ Uni Freiburg
# Copyright (c) 2009..2013 - OpenSLX GmbH
#
# This program is free software distributed under the GPL version 2.
# See http://openslx.org/COPYING
#
# If you have any feedback please consult http://openslx.org/feedback and
# send your suggestions, praise, or complaints to feedback@openslx.org
#
# General information about OpenSLX can be found at http://openslx.org/
# -----------------------------------------------------------------------------
# run-virt.include
#    - component for vmware/player of the vmchooser plugin vmchooser-run_virt
################################################################################

################################################################################
### configuration writer functions
### This needs bash, not dash or ash! (indented HEREDOC)
################################################################################

VMWAREINCLUDEDIR=/opt/openslx/vmchooser/vmware/includes
vmostype=$(rv_clean_string "$vmostype")

# declaration of default variables for vmware
source "${VMWAREINCLUDEDIR}/set_vmware_include_variables.inc" && set_vmware_include_variables
# General global openslx config
source /opt/openslx/config

# TODO: Where to put global helper functions that could be used in several units below?
vmw_cap_hw_version() {
	[ -z "$1" ] && writelog "cap_hw_version called without parameter!" && return 1
	[ "$1" -lt "$maxhardwareversion" ] && maxhardwareversion="$1"
}

if [ "$LEGACY" ]; then
	# hardware checks
	source "${VMWAREINCLUDEDIR}/set_hardware_legacy.inc" && set_hardware_legacy
	# write configuration files
	# write_config_files calls:
	#	set_vmhome_preferences_header
	#	set_vmware_startup_file
	source "${VMWAREINCLUDEDIR}/write_config_files_legacy.inc" && write_config_files_legacy
else
	# get information from downloaded vmx
	source "${VMWAREINCLUDEDIR}/parse_vmx.inc"

	# determine limitations wrt RAM and CPU count of VM
	source "${VMWAREINCLUDEDIR}/determine_hardware_limitations.inc"

	# create file and directory structure for vmware setup
	source "${VMWAREINCLUDEDIR}/create_static_directory_structure.inc"

	# create preferences file ${vmhome}/preferences
	source "${VMWAREINCLUDEDIR}/create_vmhome_preferences_file.inc" && create_vmhome_preferences_file

	# parse the given vmx file
	source "${VMWAREINCLUDEDIR}/write_final_vmx.inc"
fi

# logging and stdout
# needs writelog() from vmchooser-run_virt
source "${VMWAREINCLUDEDIR}/logging.inc" && logging

# For debugging
cp "$conffile" "/tmp/vmware-last-config"

# using the modified version of the wrapper script
VIRTCMD="/opt/openslx/bin/vmplayer"
VIRTCMDOPTS="${vmopt} ${conffile}"