summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Rößler2018-07-10 16:40:50 +0200
committerChristian Rößler2018-07-10 16:40:50 +0200
commitaa0561bc3b2a060d7ebb4d2bac721f8956390643 (patch)
treea2c95f10180f031151ce30dda92405d85653b8da
parent[run-virt] Linux scripts: shares mountes simultaneously (no wait (diff)
parent[run-virt] Handle visibility flag for lecture runscript (diff)
downloadmltk-aa0561bc3b2a060d7ebb4d2bac721f8956390643.tar.gz
mltk-aa0561bc3b2a060d7ebb4d2bac721f8956390643.tar.xz
mltk-aa0561bc3b2a060d7ebb4d2bac721f8956390643.zip
Merge branch 'master' of git.openslx.org:openslx-ng/mltk
-rw-r--r--core/modules/run-virt/data/opt/openslx/vmchooser/run-virt.d/setup_virtual_floppy.inc25
-rw-r--r--core/modules/run-virt/winres/src/winres.c17
2 files changed, 32 insertions, 10 deletions
diff --git a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt.d/setup_virtual_floppy.inc b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt.d/setup_virtual_floppy.inc
index 706cae62..f7fee6e9 100644
--- a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt.d/setup_virtual_floppy.inc
+++ b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt.d/setup_virtual_floppy.inc
@@ -99,15 +99,22 @@ setup_virtual_floppy() {
fi
## Runscript
- # Check downloaded runscript, handle extension marker
+ # Check downloaded runscript and handle options like
+ # extension, visibility flag, ...
+ # options are 'key=value' pairs separated with ';'
if load_dmsd_resource RUNSCRIPT; then
- local EXT=
if [ -s "$RUNSCRIPT" ]; then
- EXT=$(head -n 1 "$RUNSCRIPT" | grep -o -i '^EXT=.*$' | cut -d '=' -f 2-)
- [ -n "$EXT" ] && [ "x${EXT:0:1}" != "x." ] && EXT=".$EXT"
+ declare -A OPTIONS
+ for OPT in $(head -n 1 "$RUNSCRIPT" | tr ";" "\n")
+ do
+ KEY=$(cut -s -d '=' -f 1 <<< "${OPT^^}")
+ [ -n "$KEY" ] && OPTIONS["$KEY"]=$(cut -s -d '=' -f 2- <<< "$OPT")
+ done
+
+ [ ${OPTIONS[EXT]} ] && [ "x${OPTIONS[EXT]:0:1}" != "x." ] && OPTIONS[EXT]=".${OPTIONS[EXT]}"
fi
fi
-
+
# Write info file
local UNAME=
[ -s "${HOME}/.openslx/account" ] && UNAME=$(cat "${HOME}/.openslx/account")
@@ -119,8 +126,8 @@ setup_virtual_floppy() {
createMissingRemap=${SHARE_CREATE_MISSING_REMAP}
remapMode=${SHARE_REMAP_MODE_INI}
homeDrive=${SHARE_HOME_DRIVE}
- megaDrive=SEGA
- scriptExt=${EXT}
+ scriptExt=${OPTIONS[EXT]}
+ scriptVisibility=${OPTIONS[VISIBILITY]}
passCreds=${SHARE_CREDENTIAL_PASSTHROUGH}
bootIp=${SLX_PXE_CLIENT_IP}
@@ -150,9 +157,9 @@ setup_virtual_floppy() {
mcopy -s -i "${SLX_FLOPPY_IMG}" "$VMCHOOSER_DIR/data/linux" "::/"
# User supplied runscript
- if [ -n "$EXT" ]; then
+ if [ -n "${OPTIONS[EXT]}" ]; then
sed -i '1d' "${RUNSCRIPT}"
- mcopy -i "${SLX_FLOPPY_IMG}" "${RUNSCRIPT}" "::/runscript${EXT}"
+ mcopy -i "${SLX_FLOPPY_IMG}" "${RUNSCRIPT}" "::/runscript${OPTIONS[EXT]}"
fi
# Admin supplied runscript(s)
diff --git a/core/modules/run-virt/winres/src/winres.c b/core/modules/run-virt/winres/src/winres.c
index 71d470f0..3ea2d73b 100644
--- a/core/modules/run-virt/winres/src/winres.c
+++ b/core/modules/run-virt/winres/src/winres.c
@@ -239,7 +239,22 @@ static void CALLBACK launchRunscript(HWND hWnd, UINT uMsg, UINT_PTR idEvent, DWO
if (_debug) {
wlog(L"Params are '%s'", params);
}
- ShellExecuteW(NULL, L"open", _scriptFile, params, L"B:\\", SW_SHOWNORMAL);
+
+ int scriptVisibility = GetPrivateProfileIntA("openslx", "scriptVisibility", 0, SETTINGS_FILE);
+ int nShowCmd = SW_SHOWNORMAL; // show window as default
+ switch(scriptVisibility) {
+ case 0:
+ nShowCmd = SW_HIDE;
+ break;
+ case 1:
+ nShowCmd = SW_SHOWNORMAL;
+ break;
+ case 2:
+ nShowCmd = SW_SHOWMINNOACTIVE;
+ break;
+ }
+
+ ShellExecuteW(NULL, L"open", _scriptFile, params, L"B:\\", nShowCmd);
KillTimer(hWnd, idEvent);
return;
failure: