summaryrefslogtreecommitdiffstats
path: root/remote/modules
diff options
context:
space:
mode:
authorSimon Rettberg2016-03-29 16:21:06 +0200
committerSimon Rettberg2016-03-29 16:21:06 +0200
commit76ced2b15f87d1b3b2b68622394d0c83cd1e612d (patch)
treee6a1c6bf6b225886ef01b7774e38a898ba56eb99 /remote/modules
parent[vmware] Enable nested VT-x again by adding proper check for cpuflag (diff)
downloadtm-scripts-76ced2b15f87d1b3b2b68622394d0c83cd1e612d.tar.gz
tm-scripts-76ced2b15f87d1b3b2b68622394d0c83cd1e612d.tar.xz
tm-scripts-76ced2b15f87d1b3b2b68622394d0c83cd1e612d.zip
[vmchooser2] Pass --no-vtx to vmchooser if applicable
Diffstat (limited to 'remote/modules')
-rwxr-xr-xremote/modules/vmchooser2/data/opt/openslx/bin/vmchooser21
1 files changed, 17 insertions, 4 deletions
diff --git a/remote/modules/vmchooser2/data/opt/openslx/bin/vmchooser b/remote/modules/vmchooser2/data/opt/openslx/bin/vmchooser
index a99207ff..0cf04135 100755
--- a/remote/modules/vmchooser2/data/opt/openslx/bin/vmchooser
+++ b/remote/modules/vmchooser2/data/opt/openslx/bin/vmchooser
@@ -5,6 +5,7 @@
# /opt/openslx/config, as well as the pool filter (if any)
. /opt/openslx/config
+unset MEM URL ERRMSG EXTRA TAB HW_MBRAM HW_ID44
if [ -n "$SLX_VMCHOOSER_BASE_URL" ]; then
URL="$SLX_VMCHOOSER_BASE_URL"
@@ -12,25 +13,37 @@ elif [ -n "$SLX_PXE_SERVER_IP" ]; then
URL="http://$SLX_PXE_SERVER_IP/vmchooser/"
else
slxlog "virt-vmchooser" "vmchooser: Could not determine URL to fetch VM list from! (need SLX_VMCHOOSER_BASE_URL)"
- # TODO: Tell user
+ ERRMSG="Keine URL zum Abrufen der verfügbaren Veranstaltungen definiert. Versuchen Sie, den Computer neu zu starten und wenden Sie sich an den Support, wenn das Problem weiterhin besteht."
+ /opt/openslx/cups/printergui --error "$ERRMSG" || notify-send "Fehler" "$ERRMSG"
+fi
+
+. "/run/hwinfo"
+if [ -z "$HW_MBRAM" ]; then
+ MEM=$(grep -m1 '^MemTotal:' /proc/meminfo | awk '{print $2}')
+ HW_MBRAM=$(( MEM / 1024 ))
+fi
+# No/small ID44 = penalty to available ram
+if [ -n "$HW_ID44" ] && ! [ "$HW_ID44" -gt 9000 ]; then # Use negation so NaN -> TRUE
+ HW_MBRAM=$(( ( HW_MBRAM * 3 ) / 4 ))
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 ] 2>/dev/null; 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
+elif [ "$HW_MBRAM" -lt 3000 ]; then # Check RAM size; if it's not that much, default to the native linux sessions
TAB=0
else
TAB=2
fi
-EXTRA=
[ -n "$SLX_VMCHOOSER_TEMPLATES" ] && EXTRA="$EXTRA --template-mode $SLX_VMCHOOSER_TEMPLATES"
[ -n "$SLX_VMCHOOSER_FORLOCATION" ] && EXTRA="$EXTRA --location-mode $SLX_VMCHOOSER_FORLOCATION"
+[ "$HW_KVM" != "ENABLED" ] && EXTRA="$EXTRA --no-vtx"
+# No quotes around $EXTRA!
if [ -z "$SLX_LOCATIONS" ]; then
exec vmchooser.real "$@" --url "$URL" --fullscreen --tab "$TAB" $EXTRA
fi
+# No quotes around $EXTRA!
exec vmchooser.real "$@" --url "$URL" --fullscreen --tab "$TAB" --locations "$SLX_LOCATIONS" $EXTRA