summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2016-08-04 16:02:20 +0200
committerSimon Rettberg2016-08-04 16:02:20 +0200
commitb4ab4c58c014eb8985a885c0d2752bf7997e24ba (patch)
tree9d9b6f7a64aedca5df86510186079f09bfec9540
parent[run-virt] Implement automatic firewalling (diff)
downloadtm-scripts-b4ab4c58c014eb8985a885c0d2752bf7997e24ba.tar.gz
tm-scripts-b4ab4c58c014eb8985a885c0d2752bf7997e24ba.tar.xz
tm-scripts-b4ab4c58c014eb8985a885c0d2752bf7997e24ba.zip
[run-virt] Add lecture runscript to virtual floppy
-rw-r--r--remote/modules/run-virt/data/opt/openslx/scripts/includes/setup_virtual_floppy.inc17
1 files changed, 16 insertions, 1 deletions
diff --git a/remote/modules/run-virt/data/opt/openslx/scripts/includes/setup_virtual_floppy.inc b/remote/modules/run-virt/data/opt/openslx/scripts/includes/setup_virtual_floppy.inc
index 5f12fe29..9856f66a 100644
--- a/remote/modules/run-virt/data/opt/openslx/scripts/includes/setup_virtual_floppy.inc
+++ b/remote/modules/run-virt/data/opt/openslx/scripts/includes/setup_virtual_floppy.inc
@@ -5,6 +5,10 @@
declare -rg FLOPPYIMG="${TMPDIR}/floppy.img"
declare -rg TMPHOME="${HOME}"
+declare -rg RUNSCRIPT="${TMPDIR}/runscript.tmp"
+
+wget -T 6 -O "${RUNSCRIPT}" -nv "${SLX_VMCHOOSER_BASE_URL}/lecture/${IMGUUID}/runscript" &
+WGET=$?
dd "if=/dev/zero" "of=${FLOPPYIMG}" count=1440 bs=1024
chmod 0600 "${FLOPPYIMG}"
@@ -66,8 +70,13 @@ media=${SHARE_MEDIA}
other=${SHARE_OTHER}
HIER
+wait "$WGET"
+EXT=
+if [ -s "$RUNSCRIPT" ]; then
+ EXT=$(head -n 1 "$RUNSCRIPT" | grep -o -i '^EXT=.*$' | cut -d '=' -f 2-)
+fi
-# Copy all them there files into floppy image
+# Copy all them there filez into floppy image
mcopy -i "${FLOPPYIMG}" "${TMPDIR}/openslx.ini" "${TMPDIR}/HOSTRES.TXT" "${SHARES}" "::/"
mcopy -i "${FLOPPYIMG}" "$VMCHOOSER_DIR/data/openslx.exe" "::/"
# Copy guest configuration (with added information) config.xml to be accessed
@@ -77,6 +86,12 @@ mcopy -i "${FLOPPYIMG}" "$xmlfile" "::/config.xml"
# Copying linux directory:
mcopy -s -i "${FLOPPYIMG}" "$VMCHOOSER_DIR/data/linux" "::/"
+# User supplied runscript
+if [ -n "$EXT" ]; then
+ sed -i '1d' "${RUNSCRIPT}"
+ mcopy -i "${FLOPPYIMG}" "${RUNSCRIPT}" "::/runscript.${EXT}"
+fi
+
rm -f -- "${SHARES}" "${TMPDIR}/openslx.ini" "${TMPDIR}/HOSTRES.TXT"
unset SHARES VAR NETHOME UNAME