diff options
Diffstat (limited to 'remote/modules/run-virt/data/opt/openslx/scripts/includes')
| -rw-r--r-- | remote/modules/run-virt/data/opt/openslx/scripts/includes/detect_legacy.inc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/remote/modules/run-virt/data/opt/openslx/scripts/includes/detect_legacy.inc b/remote/modules/run-virt/data/opt/openslx/scripts/includes/detect_legacy.inc index fb64d73e..f77e955b 100644 --- a/remote/modules/run-virt/data/opt/openslx/scripts/includes/detect_legacy.inc +++ b/remote/modules/run-virt/data/opt/openslx/scripts/includes/detect_legacy.inc @@ -8,7 +8,8 @@ writelog "Detecting current/legacy mode ..." # First, let's try to extract an imguuid from xmlfile: -IMGUUID=$(grep -io '<uuid param=.*"' "${xmlfile}" | sed -e "s/&.*;/; /g" | awk -F '"' '{ print $2 }') +declare -rg IMGUUID=$(grep -i -o '<uuid param=.*"' "${xmlfile}" | sed -e "s/&.*;/; /g" | awk -F '"' '{ print $2 }') +declare -rg TMPCONFIG="$TMPDIR/vmconfig.tmp" writelog "IMGUUID extracted: $IMGUUID" @@ -18,11 +19,11 @@ if [ -z "$IMGUUID" ]; then # Keine uuid: Abbruch, Legacy writelog "Could not extract a uuid param from ${xmlfile}. Triggering legacy mode." else # Now getting template file: - if ! wget -O "$TMPDIR/$IMGUUID" "${SLX_VMCHOOSER_BASE_URL}/lecture/${IMGUUID}" 2>/dev/null >&2; then + if ! wget -O "$TMPCONFIG" "${SLX_VMCHOOSER_BASE_URL}/lecture/${IMGUUID}" 2>/dev/null >&2; then writelog "wget ${SLX_VMCHOOSER_BASE_URL}/lecture/${IMGUUID}. Triggering legacy mode." else writelog "wget ${SLX_VMCHOOSER_BASE_URL}/lecture/${IMGUUID} successful." - if [ ! -s "$TMPDIR/$IMGUUID" ]; then + if [ ! -s "$TMPCONFIG" ]; then writelog "Server sent zero byte virtual machine description file. Triggering legacy mode." else writelog "Triggering current (non-legacy) mode." |
