summaryrefslogtreecommitdiffstats
path: root/remote
diff options
context:
space:
mode:
authorJonathan Bauer2016-01-08 14:28:46 +0100
committerJonathan Bauer2016-01-08 14:28:46 +0100
commit7106ee223592a0591e267daa7f71162e4ad658b0 (patch)
tree490d793b56807918cbd6197086b5251d08a18145 /remote
parent[exam] renamed safe-mode service to 'exam.service' and removed unneeded code (diff)
parent[run-virt] openslx.exe: Hide console, re-set logoff caption periodically (diff)
downloadtm-scripts-7106ee223592a0591e267daa7f71162e4ad658b0.tar.gz
tm-scripts-7106ee223592a0591e267daa7f71162e4ad658b0.tar.xz
tm-scripts-7106ee223592a0591e267daa7f71162e4ad658b0.zip
Merge branch 'master' of git.openslx.org:openslx-ng/tm-scripts
Diffstat (limited to 'remote')
-rwxr-xr-xremote/modules/beamergui/data/etc/X11/Xsession.d/98-modesetter-wrapper6
-rw-r--r--remote/modules/busybox/openslx-busybox-config2
-rwxr-xr-xremote/modules/dhcpc-busybox/data/opt/openslx/scripts/systemd-udhcpc++14
-rwxr-xr-xremote/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_stats3
-rwxr-xr-xremote/modules/printergui/data/opt/openslx/scripts/run-virt_print6
-rw-r--r--remote/modules/run-virt/data/opt/openslx/scripts/includes/detect_legacy.inc7
-rw-r--r--remote/modules/run-virt/data/opt/openslx/scripts/includes/set_runvirt_variables.inc7
-rw-r--r--remote/modules/run-virt/data/opt/openslx/scripts/includes/setup_image_access.inc6
-rw-r--r--remote/modules/run-virt/data/opt/openslx/scripts/includes/setup_printer_lpd.inc3
-rw-r--r--remote/modules/run-virt/data/opt/openslx/scripts/includes/vmchooser_runvirt_functions.inc18
-rwxr-xr-xremote/modules/run-virt/data/opt/openslx/scripts/vmchooser-run_virt2
-rwxr-xr-xremote/modules/run-virt/data/opt/openslx/vmchooser/data/openslx.exebin14848 -> 15360 bytes
-rw-r--r--remote/modules/run-virt/winres.c37
-rwxr-xr-xremote/modules/vbox/data/opt/openslx/vmchooser/virtualbox/run-virt.include12
-rwxr-xr-xremote/modules/vmchooser2/data/opt/openslx/bin/vmchooser13
-rw-r--r--remote/modules/vmware/data/etc/X11/Xreset.d/vmware11
-rw-r--r--remote/modules/vmware/data/opt/openslx/vmchooser/vmware/includes/create_vmhome_preferences_file.inc6
-rw-r--r--remote/modules/vmware/data/opt/openslx/vmchooser/vmware/includes/parse_vmx.inc19
-rw-r--r--remote/modules/vmware/data/opt/openslx/vmchooser/vmware/includes/set_vmware_include_variables.inc11
-rw-r--r--remote/modules/vmware/data/opt/openslx/vmchooser/vmware/run-virt.include1
-rw-r--r--remote/modules/xorg/module.conf.ubuntu3
-rwxr-xr-xremote/rootfs/rootfs-stage31/data/init38
22 files changed, 156 insertions, 69 deletions
diff --git a/remote/modules/beamergui/data/etc/X11/Xsession.d/98-modesetter-wrapper b/remote/modules/beamergui/data/etc/X11/Xsession.d/98-modesetter-wrapper
index 7602eabc..59c1c8ed 100755
--- a/remote/modules/beamergui/data/etc/X11/Xsession.d/98-modesetter-wrapper
+++ b/remote/modules/beamergui/data/etc/X11/Xsession.d/98-modesetter-wrapper
@@ -1,5 +1,5 @@
-#!/bin/ash
+# Beamergui detection and setup
# Explicitely call bash for the modesetter
-/bin/bash /opt/openslx/scripts/beamergui-mode_setter \
- >/tmp/$UID-modesetter.$$.log 2>&1
+/bin/bash /opt/openslx/scripts/beamergui-mode_setter >/dev/null 2>&1
+
diff --git a/remote/modules/busybox/openslx-busybox-config b/remote/modules/busybox/openslx-busybox-config
index 298afb11..ee5e99ee 100644
--- a/remote/modules/busybox/openslx-busybox-config
+++ b/remote/modules/busybox/openslx-busybox-config
@@ -917,7 +917,7 @@ CONFIG_FEATURE_TOPMEM=y
CONFIG_UPTIME=y
# CONFIG_FEATURE_UPTIME_UTMP_SUPPORT is not set
CONFIG_FREE=y
-# CONFIG_FUSER is not set
+CONFIG_FUSER=y
CONFIG_KILL=y
CONFIG_KILLALL=y
# CONFIG_KILLALL5 is not set
diff --git a/remote/modules/dhcpc-busybox/data/opt/openslx/scripts/systemd-udhcpc++ b/remote/modules/dhcpc-busybox/data/opt/openslx/scripts/systemd-udhcpc++
index 246b2567..76c4fe95 100755
--- a/remote/modules/dhcpc-busybox/data/opt/openslx/scripts/systemd-udhcpc++
+++ b/remote/modules/dhcpc-busybox/data/opt/openslx/scripts/systemd-udhcpc++
@@ -1,11 +1,19 @@
#!/bin/bash
NET_IF="$1"
-NET_IP="$(ip addr show dev "${NET_IF}" | grep "inet " | awk -F " " '{print $2}' | awk -F "/" '{print $1}')"
+NET_IP="$(ip addr show dev "${NET_IF}" | grep -m1 '^\s*inet ' | awk -F " " '{print $2}' | awk -F "/" '{print $1}')"
UDHCPC_OPTS=""
[ ! -z "$NET_IP" ] && UDHCPC_OPTS=" -r $NET_IP"
-echo "udhcp++: running on $NET_IF with additional params $UDHCPC_OPTS" >> "/tmp/udhcpclog"
+
mkdir -p /run/udhcpc || echo "Could not create '/run/udhcpc'."
-/opt/openslx/sbin/udhcpc $UDHCPC_OPTS -O domain -O nissrv -O nisdomain -O wpad -O search -t 8 -s /opt/openslx/scripts/udhcpc-openslx -i "$NET_IF" -p "/run/udhcpc/udhcpc.$NET_IF.pid" || \
+
+/opt/openslx/sbin/udhcpc $UDHCPC_OPTS -O domain -O nissrv -O nisdomain -O wpad -O search -t 8 -s /opt/openslx/scripts/udhcpc-openslx -i "$NET_IF" -p "/run/udhcpc/udhcpc.$NET_IF.pid"
+RET=$?
+
+if [ "$RET" != 0 ]; then
slxlog "udhcpc" "Could not run 'udhcpc${UDHCPC_OPTS}' on ${NET_IF}."
+fi
+
+exit "$RET"
+
diff --git a/remote/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_stats b/remote/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_stats
index 2b54e3e7..6c0b667b 100755
--- a/remote/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_stats
+++ b/remote/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_stats
@@ -138,11 +138,12 @@ dmidec() {
echo "$MODEL"
}
MODEL=$(dmidec -s system-product-name)
+MANUF=$(dmidec -s system-manufacturer)
# Try fallback to baseboard
if [ "$MODEL" = "Unknown" ]; then
MODEL=$(dmidec -s baseboard-product-name)
+ MANUF=$(dmidec -s baseboard-manufacturer)
fi
-MANUF=$(dmidec -s baseboard-manufacturer)
if [ "$MANUF" != "Unknown" ]; then
MODEL="$MODEL ($MANUF)"
diff --git a/remote/modules/printergui/data/opt/openslx/scripts/run-virt_print b/remote/modules/printergui/data/opt/openslx/scripts/run-virt_print
index dfbcdfde..ba352778 100755
--- a/remote/modules/printergui/data/opt/openslx/scripts/run-virt_print
+++ b/remote/modules/printergui/data/opt/openslx/scripts/run-virt_print
@@ -45,8 +45,10 @@ if which gs 2>/dev/null; then
RET=$?
if [ $RET -ne 0 ]; then
errlog "printergui-validate" "Error: Ghostscript choked on input file" "$ERRLOG"
+ rm -f -- "$ERRLOG"
exit 1
fi
+ rm -f -- "$ERRLOG"
else
errlog "printergui-nogs" "Warning: Cannot validate file prior to printing: gs binary not found"
fi
@@ -57,5 +59,9 @@ RET=$?
if [ $RET -ne 0 -a $RET -ne 143 ]; then # SIGTERM results in 143, is sent by printpwgui
errlog "printergui-exec" "Error: printergui execution failed with exit code $RET"
fi
+
+sleep 1
+rm -f -- "$FILE"
+
exit $RET
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 b71d43fc..11a21832 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
@@ -7,13 +7,6 @@
writelog "Detecting current/legacy mode ..."
-TMPDIR=$(mktemp -d -p /tmp/virt)
-ERR=$?
-if "$ERR"; then
- writelog "Could not mkdir tempdir, using /tmp."
- TMPDIR=/tmp
-fi
-
# First, let's try to extract an imguuid from xmlfile:
IMGUUID=$(grep -io '<uuid param=.*"' "${xmlfile}" | sed -e "s/&.*;/; /g" | awk -F '"' '{ print $2 }')
diff --git a/remote/modules/run-virt/data/opt/openslx/scripts/includes/set_runvirt_variables.inc b/remote/modules/run-virt/data/opt/openslx/scripts/includes/set_runvirt_variables.inc
index 9525a290..5215eb2d 100644
--- a/remote/modules/run-virt/data/opt/openslx/scripts/includes/set_runvirt_variables.inc
+++ b/remote/modules/run-virt/data/opt/openslx/scripts/includes/set_runvirt_variables.inc
@@ -5,6 +5,10 @@
VMCHOOSER_DIR="/opt/openslx/vmchooser"
VMCHOOSER_CONF_DIR="$VMCHOOSER_DIR/config"
LOGFILE="/var/log/openslx/run-virt.${USER}.$$.log"
+USER="$(whoami)"
+TMPDIR="/tmp/virt/${USER}/$$"
+
+readonly VMCHOOSER_DIR VMCHOOSER_CONF_DIR LOGFILE TMPDIR USER
# include general configuration from vmchooser
[ -f "$VMCHOOSER_CONF_DIR/vmchooser.conf" ] && . "$VMCHOOSER_CONF_DIR/vmchooser.conf"
@@ -12,3 +16,6 @@ LOGFILE="/var/log/openslx/run-virt.${USER}.$$.log"
[ -f "$VMCHOOSER_CONF_DIR/virtualization.conf" ] && . "$VMCHOOSER_CONF_DIR/virtualization.conf"
# Load general openslx config
[ -f "/opt/openslx/config" ] && . "/opt/openslx/config"
+# Create temp dir
+mkdir -p "$TMPDIR" # TODO error out if failed
+
diff --git a/remote/modules/run-virt/data/opt/openslx/scripts/includes/setup_image_access.inc b/remote/modules/run-virt/data/opt/openslx/scripts/includes/setup_image_access.inc
index 806423cc..e84486cf 100644
--- a/remote/modules/run-virt/data/opt/openslx/scripts/includes/setup_image_access.inc
+++ b/remote/modules/run-virt/data/opt/openslx/scripts/includes/setup_image_access.inc
@@ -14,13 +14,11 @@ elif [ -z "$SLX_DNBD3_SERVERS" ] || [ "x$SLX_VM_DNBD3" != "xyes" ]; then
writelog "Can't use dnbd3 as no servers are given in config, or SLX_VM_DNBD3 is not set to yes"
else
# Mount path for images mounted with dnbd3-fuse
- dnbd3_fuse_mount_point="/tmp/virt/${USER}.fuse"
+ dnbd3_fuse_mount_point="$TMPDIR/dnbd3fuse.mnt"
mkdir -p "${dnbd3_fuse_mount_point}"
- # try to unmount first
- fusermount -u "${dnbd3_fuse_mount_point}"
# start dnbd3-fuse in subshell
(
- tmplog="$(mktemp)"
+ tmplog="$TMPDIR/dnbd3fuse.log"
[ -z "$tmplog" ] && tmplog="/tmp/dnbd3-fuse.$$.$RANDOM.$USER"
dnbd3-fuse -f -o allow_other,max_readahead=262144 -h "$SLX_DNBD3_SERVERS" -i "${imgrelpath}" "${dnbd3_fuse_mount_point}" > "$tmplog" 2>&1
RET=$?
diff --git a/remote/modules/run-virt/data/opt/openslx/scripts/includes/setup_printer_lpd.inc b/remote/modules/run-virt/data/opt/openslx/scripts/includes/setup_printer_lpd.inc
index ab010722..ee0b2c70 100644
--- a/remote/modules/run-virt/data/opt/openslx/scripts/includes/setup_printer_lpd.inc
+++ b/remote/modules/run-virt/data/opt/openslx/scripts/includes/setup_printer_lpd.inc
@@ -3,7 +3,6 @@
#####################################
QUEUE="STANDARD" # This has to match the queue you configured in your VM
-USER="$(whoami)"
SPOOLDIR=
### Disabled: 100megs is not enough, some jobs are HUGE, try to use temp which should be on disk
@@ -15,7 +14,7 @@ SPOOLDIR=
# If failed, try to fall back to /tmp
if [ -z "${SPOOLDIR}" ] || [ ! -w "${SPOOLDIR}/${QUEUE}" ]; then
- SPOOLDIR="/tmp/printergui-${USER}-$$-${RANDOM}"
+ SPOOLDIR="${TMPDIR}/printergui-${RANDOM}"
rm -rf -- "${SPOOLDIR}"
if ! mkdir -p "${SPOOLDIR}/${QUEUE}"; then
slxlog "virt-spooldir" "Could not create spool directory ($SPOOLDIR) for $USER - printing will not work!"
diff --git a/remote/modules/run-virt/data/opt/openslx/scripts/includes/vmchooser_runvirt_functions.inc b/remote/modules/run-virt/data/opt/openslx/scripts/includes/vmchooser_runvirt_functions.inc
index f20b799f..b85bb32c 100644
--- a/remote/modules/run-virt/data/opt/openslx/scripts/includes/vmchooser_runvirt_functions.inc
+++ b/remote/modules/run-virt/data/opt/openslx/scripts/includes/vmchooser_runvirt_functions.inc
@@ -14,24 +14,22 @@ writelog() {
# Clean exit will be called at the end of vmchooser-run_virt
cleanexit() {
sleep 1
- # remove config dirs when exit
- if echo "${RMDIRS}" 2>/dev/null | grep -q "${xmlvirt}"; then
- writelog "${xmlvirt} exited. Cleaning up... \c"
-# rm -rf -- ${RMDIRS} >/dev/null 2>&1
- writelog "done"
- fi
# Ummount dnbd3-fuse
if [ -n "$dnbd3_fuse_mount_point" ] && [ -e "$dnbd3_fuse_mount_point/img" ]; then
- for timeout in 1 1 2; do
+ for timeout in 1 1 1 FAIL; do
fusermount -u "$dnbd3_fuse_mount_point" && break
writelog "dnbd3 still busy...."
+ [ "$timeout" = "FAIL" ] && break
sleep "$timeout"
done
fi
# Kill LPD
- [ -n "$PID_LPD" ] && kill "$PID_LPD"
- # Remove spool directory for printjobs from VM
- [ -n "${SPOOLDIR}" ] && rm -rf -- "${SPOOLDIR}"
+ [ -n "${PID_LPD}" ] && kill "${PID_LPD}"
+
+ # If we're not in debug mode, remove all temporary files
+ if [ -n "${TMPDIR}" -a -z "$SLX_DEBUG" ]; then
+ rm -rf -- "${TMPDIR}"
+ fi
[ $# -gt 0 ] && exit "$1"
exit 129 # No exit code was given :/
diff --git a/remote/modules/run-virt/data/opt/openslx/scripts/vmchooser-run_virt b/remote/modules/run-virt/data/opt/openslx/scripts/vmchooser-run_virt
index 7d83844e..8e1bbd0d 100755
--- a/remote/modules/run-virt/data/opt/openslx/scripts/vmchooser-run_virt
+++ b/remote/modules/run-virt/data/opt/openslx/scripts/vmchooser-run_virt
@@ -23,7 +23,7 @@ RUNVIRTINCLUDEDIR=/opt/openslx/scripts/includes
xmlfile="$1"
# Functions needed by vmchooser-run_virt (writelog(), cleanexit(), rv_clean_string())
-source ${RUNVIRTINCLUDEDIR}/vmchooser_runvirt_functions.inc && trap cleanexit SIGINT SIGTERM
+source ${RUNVIRTINCLUDEDIR}/vmchooser_runvirt_functions.inc && trap 'trap "" SIGINT SIGTERM; cleanexit' SIGINT SIGTERM
# Define default dirs / get configs
source ${RUNVIRTINCLUDEDIR}/set_runvirt_variables.inc
# Function to detect whether we can use the new way (vmx via http) or the old way (legacy):
diff --git a/remote/modules/run-virt/data/opt/openslx/vmchooser/data/openslx.exe b/remote/modules/run-virt/data/opt/openslx/vmchooser/data/openslx.exe
index eec60c3a..a1616798 100755
--- a/remote/modules/run-virt/data/opt/openslx/vmchooser/data/openslx.exe
+++ b/remote/modules/run-virt/data/opt/openslx/vmchooser/data/openslx.exe
Binary files differ
diff --git a/remote/modules/run-virt/winres.c b/remote/modules/run-virt/winres.c
index 1af91d33..a9037b61 100644
--- a/remote/modules/run-virt/winres.c
+++ b/remote/modules/run-virt/winres.c
@@ -18,7 +18,12 @@ static int setResolution();
static int muteSound();
static int setShutdownText();
-int main(int argc, char ** argv)
+static void CALLBACK resetShutdown(HWND hWnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
+{
+ setShutdownText();
+}
+
+int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
int ret;
/*
@@ -41,14 +46,34 @@ int main(int argc, char ** argv)
OSVERSIONINFO version;
version.dwOSVersionInfoSize = sizeof(version);
BOOL retVer = GetVersionEx(&version);
+ // Set resolution to what HOSTRES.TXT says
setResolution();
+ // Mute sound by default
if (retVer && version.dwMajorVersion >= 6)
muteSound();
- ret = setShutdownText();
- char buffer[100];
- snprintf(buffer, 100, "Returned %d", ret);
- if (ret != 0)
- MessageBoxA(0, buffer, "Set caption", 0);
+ // Shutdown button label
+ if (retVer && version.dwMajorVersion == 6 && version.dwMinorVersion == 1) {
+ // Only on Windows 7
+ char buffer[100];
+ ret = setShutdownText();
+ if (ret != 0) {
+ snprintf(buffer, 100, "Returned %d", ret);
+ MessageBoxA(0, buffer, "Set caption", 0);
+ }
+ // Repeatedly set caption
+ UINT_PTR tRet = SetTimer(NULL, 0, 5000, (TIMERPROC)&resetShutdown);
+ if (tRet == 0) {
+ snprintf(buffer, 100, "Could not create timer: %d", (int)tRet);
+ MessageBoxA(0, buffer, "SetTimer", 0);
+ return 0;
+ }
+ // Message pump
+ MSG Msg;
+ while(GetMessage(&Msg, NULL, 0, 0) > 0) {
+ TranslateMessage(&Msg);
+ DispatchMessage(&Msg);
+ }
+ }
return 0;
}
diff --git a/remote/modules/vbox/data/opt/openslx/vmchooser/virtualbox/run-virt.include b/remote/modules/vbox/data/opt/openslx/vmchooser/virtualbox/run-virt.include
index f35bc9d8..1b116f32 100755
--- a/remote/modules/vbox/data/opt/openslx/vmchooser/virtualbox/run-virt.include
+++ b/remote/modules/vbox/data/opt/openslx/vmchooser/virtualbox/run-virt.include
@@ -19,12 +19,13 @@
################################################################################
VMCHOOSERVBOX="/opt/openslx/vmchooser/${self}"
-TMPDIR=/tmp/virt/${self} # create TMPDIR for all users
-mkdir -m 1777 ${TMPDIR} 2>/dev/null
-confdir="/tmp/virt/${self}/${USER}/${VM_ID}" # dir for configs
+confdir="${TMPDIR}/vbox" # dir for configs
export VBOX_USER_HOME=${confdir} # instead of $HOME/.VirtualBox
# define dirs and files which can be removed after exit, be carefull!
-RMDIRS="${snapshotdir} ${confdir} /tmp/virt/.vbox-${USER}-ipc"
+# TODO: Machanism not in use anymore. A better approach would be anyways to
+# Define a fixed directory which can be deleted recursively on exit. $TMPDIR
+# would be a start.
+#RMDIRS="${snapshotdir} ${confdir} /tmp/virt/.vbox-${USER}-ipc"
# rm -rf ${RMDIRS} 2>/dev/null
machfolder="${confdir}/Machines"
# use vm_shortname for dir and config names since vm_name can be very long
@@ -205,7 +206,7 @@ if echo "${imgmode}" | grep -q rw; then
cleanexit 1
fi
touch "${vmpath}.lock" # add lock
- RMDIRS="${RMDIRS} ${vmpath}.lock" # remove lock after VM stopped
+ #RMDIRS="${RMDIRS} ${vmpath}.lock" # remove lock after VM stopped TODO See note at the top
imgtype="Normal"
imageuuid=${diskuuid} # replace image uuid in machine config
elif [ ${diskless} -eq 0 ]; then
@@ -432,5 +433,4 @@ VIRTCMDOPTS="--startvm ${machineuuid} --start-running --fullscreen"
# set headless mode (-v off to disable vrdp)
VIRTCMDHL=$(which VBoxHeadless 2>/dev/null)
VIRTCMDOPTSHL="-s ${machineuuid}"
-RMDIRS="${TMPDIR}"
diff --git a/remote/modules/vmchooser2/data/opt/openslx/bin/vmchooser b/remote/modules/vmchooser2/data/opt/openslx/bin/vmchooser
index 38d10fde..4f30f447 100755
--- a/remote/modules/vmchooser2/data/opt/openslx/bin/vmchooser
+++ b/remote/modules/vmchooser2/data/opt/openslx/bin/vmchooser
@@ -15,9 +15,18 @@ else
# TODO: Tell user
fi
+MEM=$(grep -m1 '^MemTotal:' /proc/meminfo | awk '{print $2}')
+if [ -n "$SLX_VMCHOOSER_TAB" ] && [ "$SLX_VMCHOOSER_TAB" -ge 0 -a "$SLX_VMCHOOSER_TAB" -le 2 ]; then
+ TAB="$SLX_VMCHOOSER_TAB"
+elif [ "$MEM" -lt 3000000 ]; then # Check RAM size; if it's not that much, default to the native linux sessions
+ TAB=0
+else
+ TAB=2
+fi
+
if [ -n "$SLX_VM_POOL_FILTER" ]; then
- vmchooser.real "$@" --url "$URL" --pool "$SLX_VM_POOL_FILTER" --fullscreen
+ exec vmchooser.real "$@" --url "$URL" --pool "$SLX_VM_POOL_FILTER" --fullscreen --tab "$TAB"
else
- vmchooser.real "$@" --url "$URL" --fullscreen
+ exec vmchooser.real "$@" --url "$URL" --fullscreen --tab "$TAB"
fi
diff --git a/remote/modules/vmware/data/etc/X11/Xreset.d/vmware b/remote/modules/vmware/data/etc/X11/Xreset.d/vmware
index ee436292..83bfb392 100644
--- a/remote/modules/vmware/data/etc/X11/Xreset.d/vmware
+++ b/remote/modules/vmware/data/etc/X11/Xreset.d/vmware
@@ -2,9 +2,16 @@
# VMWare cleanup
#
+# Unmount dirs that vmware sometimes leaves around
VMWARE_TMP_DIRS="$(cat /proc/mounts | grep "/tmp/vmware-" | awk -F " " '{print $1}')"
for DIR in $VMWARE_TMP_DIRS; do
- umount -l "$DIR" || echo "Could not unmount."
+ umount "$DIR" && rmdir "$DIR"
done
-exit 0
+# Delete redo/temp files that sometimes stay around e.g. on vmware crash
+for file in $(find /tmp/virt/vmware -type f -size +4M); do
+ fuser -s "$file" || rm -- "$file"
+done
+
+true
+
diff --git a/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/includes/create_vmhome_preferences_file.inc b/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/includes/create_vmhome_preferences_file.inc
index e33320ad..b618041c 100644
--- a/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/includes/create_vmhome_preferences_file.inc
+++ b/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/includes/create_vmhome_preferences_file.inc
@@ -35,7 +35,6 @@ create_vmhome_preferences_file() {
pref.hotkey.alt = "true"
pref.hotkey.shift = "true"
pref.hotkey.gui = "true"
- gui.restricted = "true"
# fullscreen/mouse/keyboard
pref.fullscreen.toolbarPixels = "0"
@@ -65,5 +64,8 @@ create_vmhome_preferences_file() {
pref.eula1.product = "VMware Workstation"
pref.eula1.build = "$vmware_build"
HEREEND
- writelog "Vmware preferences file created in vmhome."
+ if [ -n "$SLX_EXAM" ]; then
+ echo 'pref.hotkey.rightControl = "true"' >> "$vmhome/preferences"
+ fi
+ writelog "Vmware preferences file created in $vmhome."
}
diff --git a/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/includes/parse_vmx.inc b/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/includes/parse_vmx.inc
index 3d82d934..f8f43ad3 100644
--- a/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/includes/parse_vmx.inc
+++ b/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/includes/parse_vmx.inc
@@ -55,10 +55,16 @@ MemTrimRate = "-1"
HEREEND
# USB
-cat >> "$TMPDIR/$IMGUUID" <<-HEREEND
-usb.present = "TRUE"
-usb.generic.autoconnect = "TRUE"
-HEREEND
+if [ -n "$SLX_EXAM" ]; then
+ # Exam mode: No USB (TODO: Configurable)
+ sed -i '/^usb\./d' "$TMPDIR/$IMGUUID"
+ echo 'usb.present = "FALSE"' >> "$TMPDIR/$IMGUUID"
+else
+ cat >> "$TMPDIR/$IMGUUID" <<-HEREEND
+ usb.present = "TRUE"
+ usb.generic.autoconnect = "TRUE"
+ HEREEND
+fi
# shared folders
cat >> "$TMPDIR/$IMGUUID" <<-HEREEND
@@ -106,6 +112,11 @@ fi
sed -i '/^gui.applyHostDisplayScaling/d' "$TMPDIR/$IMGUUID"
echo 'gui.applyHostDisplayScalingToGuest = "FALSE"' >> "$TMPDIR/$IMGUUID"
+# Additinal exam mode settings
+if [ -n "$SLX_EXAM" ]; then
+ echo 'gui.restricted = "true"' >> "$TMPDIR/$IMGUUID"
+fi
+
# Killing duplicate lines (output much nicer than sort -u):
awk '!a[$0]++' "${TMPDIR}/${IMGUUID}" > "${TMPDIR}/${IMGUUID}.tmp" && mv "${TMPDIR}/${IMGUUID}.tmp" "${TMPDIR}/${IMGUUID}"
diff --git a/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/includes/set_vmware_include_variables.inc b/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/includes/set_vmware_include_variables.inc
index 5a5d1132..0c45ee59 100644
--- a/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/includes/set_vmware_include_variables.inc
+++ b/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/includes/set_vmware_include_variables.inc
@@ -5,17 +5,6 @@
set_vmware_include_variables() {
[ "$mem" -gt 3800 -a "$(uname -m)" != "x86_64" ] && mem=3800
- # VM-ID static (0D), remove if changed to 00
- VM_ID="0D"
-
- # should be dynamic
- if [ "x$(which bc)" != "x" ]; then
- VM_ID=$(echo "obase=16; $$" | bc)
- VM_ID=$(expr substr $VM_ID $(expr ${#VM_ID} - 1) 2)
- else
- VM_ID=$[ $$ % 100 ]
- fi
-
# temporary disk space for logs, etc...
redodir="/tmp/virt/vmware/${USER}.$$"
diff --git a/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/run-virt.include b/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/run-virt.include
index a823df72..f63092bd 100644
--- a/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/run-virt.include
+++ b/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/run-virt.include
@@ -68,5 +68,4 @@ cp "$conffile" "/tmp/vmware-last-config"
# using the modified version of the wrapper script
VIRTCMD="/opt/openslx/bin/vmplayer"
VIRTCMDOPTS="${vmopt} ${conffile}"
-RMDIRS="${redodir} ${conffile}"
diff --git a/remote/modules/xorg/module.conf.ubuntu b/remote/modules/xorg/module.conf.ubuntu
index 670fb18d..41a8739a 100644
--- a/remote/modules/xorg/module.conf.ubuntu
+++ b/remote/modules/xorg/module.conf.ubuntu
@@ -34,9 +34,6 @@ REQUIRED_CONTENT_PACKAGES="
@xserver-xorg-video-tdfx$UBUNTU_XORG_PKG_SUFFIX
"
- # Ann.: xserver-xorg-video-sis$UBUNTU_XORG_PKG_SUFFIX
- deleted, as >= 14.04.3 has no package in the moment.
-
REQUIRED_DIRECTORIES+="
/usr/lib
"
diff --git a/remote/rootfs/rootfs-stage31/data/init b/remote/rootfs/rootfs-stage31/data/init
index 7c66cd11..51010ffa 100755
--- a/remote/rootfs/rootfs-stage31/data/init
+++ b/remote/rootfs/rootfs-stage31/data/init
@@ -111,6 +111,44 @@ for mnt in proc sys run ; do
busybox umount -f -l "/$mnt" 2>/dev/null
done
+# HACK HACK: Klausurmodus
+# Putting this here as we're hopefully moving to the all new dracut solution soon
+# so there's no reason to make it pretty now
+if [ -n "$SLX_EXAM" ]; then
+ # Visual: Make kdm all orange
+ sed -i 's/#e3e4e9/#f9a72b/g' "${FUTURE_ROOT}/usr/share/desktop/themes/kdm/bwlehrpool/theme.xml"
+ # Visual: Move splash screen to upper left corner
+ if [ -e "/etc/splash.ppm.gz" ]; then
+ fbsplash -b -s "/etc/splash.ppm.gz" &
+ elif [ -e "/etc/splash.ppm" ]; then
+ fbsplash -b -s "/etc/splash.ppm" &
+ fi
+ # Visual: ssh banner
+ echo "+ - - - - KLAUSURMODUS AKTIV - - - - +" >> "${FUTURE_ROOT}/etc/issue.net"
+ echo "++++++++++++++++++++++++++++++++++++++" >> "${FUTURE_ROOT}/etc/issue.net"
+ # Disable some services, ldap/ad
+ rm -- "${FUTURE_ROOT}/etc/systemd/system/network.target.wants/sssd.service"
+ sed -i 's/ sss//' "${FUTURE_ROOT}/etc/nsswitch.conf"
+ # Disable ctrl-alt-delete
+ rm -- "${FUTURE_ROOT}/usr/lib/systemd/system/ctrl-alt-del.target"
+ # No idleaction
+ rm -- "${FUTURE_ROOT}/etc/cron.d/openslx-idleaction"
+ # Ignore everything but power button
+ cat > "${FUTURE_ROOT}/etc/systemd/logind.conf" <<EOF
+[Login]
+NAutoVTs=0
+ReserveVT=0
+KillUserProcesses=no
+HandlePowerKey=poweroff
+HandleSuspendKey=ignore
+HandleHibernateKey=ignore
+HandleLidSwitch=ignore
+IdleAction=ignore
+EOF
+ # Link exam.service in sysinit.target
+ ln -s "../exam.service" "${FUTURE_ROOT}/etc/systemd/system/sysinit.target.wants/exam.service"
+fi
+
echo "Switching root...."
echo "$bench_result" > "${FUTURE_ROOT}/opt/openslx/.benchmark"
# Prepare environment (HOME is needed as a hack for nss_ldap with ssl and no caching)