summaryrefslogtreecommitdiffstats
path: root/core/modules/vmware12/data/opt/openslx/vmchooser/plugins/vmware/includes/parse_vmx.inc
blob: 6ca82acbd6bce82c80f04fa5e2510a0128176125 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
######################################################################
# Include: Parsing the non-legacy delivered vmxfile ${TMPCONFIG} #
######################################################################
## Functions
parse_vmx() {
	writelog "Parsing virtual machine description file..."
	local -i HW_VERSION=$(grep -i -m1 '^virtualHW.version *= *' "${TMPCONFIG}" | awk -F '=' '{print $2}' | sed -r 's/[^0-9]//g')
	if notempty HW_VERSION; then
       		declare -g VM_HW_VERSION="${HW_VERSION}"
		return 0
	fi
	return 1
}

## MAIN ##
if notempty TMPCONFIG; then
	call_post_source parse_vmx
else
	writelog "Path to VMX file is not set or empty! Aborting..."
	EXIT_TYPE="internal" EXIT_REASON="Konnte Pfad zur VMX-Datei nicht finden!" cleanexit 1
fi