diff options
Diffstat (limited to 'remote/modules/run-virt/data/opt/openslx/scripts/detect_legacy.inc')
-rw-r--r-- | remote/modules/run-virt/data/opt/openslx/scripts/detect_legacy.inc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/remote/modules/run-virt/data/opt/openslx/scripts/detect_legacy.inc b/remote/modules/run-virt/data/opt/openslx/scripts/detect_legacy.inc new file mode 100644 index 00000000..4c3a2f2b --- /dev/null +++ b/remote/modules/run-virt/data/opt/openslx/scripts/detect_legacy.inc @@ -0,0 +1,25 @@ +######################################################## +# Include: Detect, whether runvirt runs in legacy mode # +######################################################## + +# Legacy mode: As runvirt has been before. +# New mode: uuid in xml _and_ vmx given via http. + +# First, let's try to extract an imguuid from xmlfile: +IMGUUID=$(grep -io '<uuid param=.*"' "${xmlfile}" | sed -e "s/&.*;/; /g" | awk -F '"' '{ print $2 }') + +# Temporary directory for run-virt related stuff +TMPDIR=$(mktemp -d -p /tmp/virt) + +# Then get a template (vmx) file via http/wget: +wget --output-document="$TMPDIR/$IMGUUID" "${SLX_VMCHOOSER_BASE_URL}/lecture/${IMGUUID}" + +writelog "IMGUUID: -$IMGUUID- --- TMPDIR: ${TMPDIR}" + +if [ -n "$IMGUUID" ] && [ -n "$TMPDIR/$IMGUUID" ]; then + LEGACY= # no legacy; both strings set + writelog "Current (non-legacy) mode detected." +else + LEGACY=: # legacy: One or both strings not set + writelog "Legacy mode detected." +fi |