summaryrefslogtreecommitdiffstats
path: root/remote/modules/run-virt/data/opt/openslx/scripts/includes/check_runvirt_xml_sanity_legacy.inc
blob: 0e720a062c69e744f43f4e23903965b41777d008 (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
#######################################################
# Include: check xml file for sanity (legacy, old way #
#######################################################

# test if the xml file is valid
if ! [ -r "${xmlfile}" ]; then
	writelog "${xmlfile} not a readable XML file!"
	slxlog "virt-nonreadable-xml" "XML file not readable: $xmlfile"
	error_user "Die XML-Datei der gewählten Sitzung ist nicht lesbar oder existiert nicht"
	exit 1
fi

# test if XML file
if ! grep -q '<?xml' "${xmlfile}"; then
	writelog "Submitted configuration file ${xmlfile} seems to have wrong XML format"
	slxlog "virt-invalid-xml" "Malformed XML file: $xmlfile" "$xmlfile"
	error_user "Die XML-Datei der gewählten Sitzung hat ein ungültiges Format"
	exit 1
fi

# check for running in graphical environment otherwise no much use here
if [ -z "$DISPLAY" ]; then
	writelog -e "\n\tStart only within a graphical desktop!\n"
	exit 1
fi