From fc611666134f8b4a1073eca14bb2ecfe1b3aa954 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 8 Jan 2016 11:50:40 +0100 Subject: Preparations for exam mode --- .../scripts/includes/set_runvirt_variables.inc | 2 +- .../includes/create_vmhome_preferences_file.inc | 6 ++-- .../vmchooser/vmware/includes/parse_vmx.inc | 19 ++++++++--- remote/rootfs/rootfs-stage31/data/init | 38 ++++++++++++++++++++++ 4 files changed, 58 insertions(+), 7 deletions(-) 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 f0aae889..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,8 +5,8 @@ VMCHOOSER_DIR="/opt/openslx/vmchooser" VMCHOOSER_CONF_DIR="$VMCHOOSER_DIR/config" LOGFILE="/var/log/openslx/run-virt.${USER}.$$.log" -TMPDIR="/tmp/virt/$(whoami)" USER="$(whoami)" +TMPDIR="/tmp/virt/${USER}/$$" readonly VMCHOOSER_DIR VMCHOOSER_CONF_DIR LOGFILE TMPDIR USER 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/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" < "${FUTURE_ROOT}/opt/openslx/.benchmark" # Prepare environment (HOME is needed as a hack for nss_ldap with ssl and no caching) -- cgit v1.2.3-55-g7522