From 0200669d6112c4f5aed3ccb2acea281ac3352858 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 12 Jul 2013 18:42:48 +0200 Subject: [vmplayer] Rework run-virt.include to better set memory limits, CPU count and guestOS --- .../data/etc/openslx/vmware/run-virt.include | 357 +++++++++++++-------- 1 file changed, 232 insertions(+), 125 deletions(-) (limited to 'remote') diff --git a/remote/modules/vmplayer/data/etc/openslx/vmware/run-virt.include b/remote/modules/vmplayer/data/etc/openslx/vmware/run-virt.include index 0267656d..6c062c09 100644 --- a/remote/modules/vmplayer/data/etc/openslx/vmware/run-virt.include +++ b/remote/modules/vmplayer/data/etc/openslx/vmware/run-virt.include @@ -18,77 +18,184 @@ # configuration writer functions ################################################################################ -runvmwareconfheader () +function clean_string () { -echo "# This configuration file was generated by $0" > "$conffile" - -# check for the ostype -case "${vmostype}" in - win31*) - mem="32" - cpu_cores="1" - sound="sb16" - shfolders="FALSE" - ;; - win95*) - mem="92" - cpu_cores="1" - shfolders="FALSE" - ;; - win98*|winme*) - mem="256" - cpu_cores="1" - shfolders="FALSE" - ;; - winxp*|windowsxp*) - shfolders="TRUE" - ;; - winvista*|windowsvista*) - shfolders="TRUE" - ;; - windows7*) - shfolders="TRUE" - enable3d="TRUE" - ;; - windows8*) - shfolders="TRUE" - ;; - linux*|*ubuntu*|*suse*|debian*|*sci*) - vmostype="linux" - shfolders="TRUE" - ;; - macos*) - cpu_cores="1" - vmostype="other" - shfolders="FALSE" - ;; - beos*) - cpu_cores="1" - vmostype="other" - shfolders="FALSE" - ;; - *) - vmostype="other" - shfolders="FALSE" - ;; -esac - -svga_autodetect="TRUE" - -numvcpus="${cpu_cores}" -[ "${cpu_cores}" -ge "4" 2>/dev/null ] && numvcpus="4" - -if [ "x$shfolders" != "xFALSE" ]; then - ENABLE_SHARE='sharedFolder.option = "alwaysEnabled"' -else - ENABLE_SHARE='' -fi - -[ "${mem}" -ge "8000" ] && mem=8000 + if [ "$#" -ge 1 ]; then + echo "$@" | tr '[:upper:]' '[:lower:]' | tr -d '\t _./' + else + cat - | tr '[:upper:]' '[:lower:]' | tr -d '\t _./' + fi +} -cap3d="WHAT IS THIS VAR USED FOR?" # helper var for loging output +vmostype=$(clean_string "$vmostype") -cat >> "$conffile" < "$conffile" + + MAXMEM="9999999" + + # check for the ostype + # 1) memory limits + case "$vmostype" in + win31*|windows31*) + MAXMEM="32" + vmostype="win31" + ;; + winnt*|windowsnt*) + MAXMEM="1000" + vmostype="winnt" + ;; + win95*|windows95*) + MAXMEM="96" + vmostype="win95" + ;; + win98*|windows98*) + MAXMEM="384" + vmostype="win98" + ;; + winme*|windowsme*) + MAXMEM="384" + vmostype="winme" + ;; + win2000|windows2000|win2000pro*) + MAXMEM="4000" + vmostype="win2000pro" + ;; + win2000srv*|windows2000srv*|win2000serv*|windows2000serv*) + MAXMEM="4000" + vmostype="win2000serv" + ;; + win2000adv*|windows2000adv*|win2000dat*|windows2000dat*) + MAXMEM="8000" + vmostype="win2000advserv" + ;; + winnet*64|win*2003*64|windowsnet*64) + MAXMEM="8000" + vmostype="winnetstandard-64" + ;; + winnet*|win*2003*|windowsnet*) + MAXMEM="4000" + vmostype="winnetstandard" + ;; + winxphome*|windowsxphome*) + MAXMEM="4000" + vmostype="winxphome" + ;; + winxp*64|windowsxp*64) + MAXMEM="8000" + vmostype="winxppro-64" + ;; + winxp*|windowsxp*) + MAXMEM="4000" + vmostype="winxppro" + ;; + winvista*64|windowsvista*64) + MAXMEM="16000" + vmostype="winvista-64" + ;; + winvista*|windowsvista*) + MAXMEM="8000" + vmostype="winvista" + ;; + win7*64|windows7*64) + MAXMEM="32000" + vmostype="windows7-64" + ;; + win7*|windows7*) + MAXMEM="8000" + vmostype="windows7" + ;; + win*64) + MAXMEM="16000" + ;; + win*) + MAXMEM="8000" + ;; + dos|msdos*|ms-dos*) + MAXMEM="128" + vmostype="dos" + ;; + *64) + MAXMEM="123456" + ;; + *) + MAXMEM="8000" + ;; + esac + + # 2) other hardware + capabilities + shfolders="FALSE" + case "$vmostype" in + win31) + cpu_cores="1" + sound="sb16" + ;; + winnt) + cpu_cores="2" + sound="sb16" + ;; + win95|win98|winme) + cpu_cores="1" + ;; + win2000pro) # Don't know if Win 2000 supports shared folders, disabled to be safe + cpu_cores="2" + ;; + win2000serv) + cpu_cores="4" + ;; + win2000advserv) + cpu_cores="8" + ;; + winxphome) + cpu_cores="1" + shfolders="TRUE" + ;; + winxp*|winvista*|windows7*) + shfolders="TRUE" + ;; + winnet*) + shfolders="TRUE" + ;; + linux*|ubuntu*|suse*|debian*) + shfolders="TRUE" + ;; + macos*64) + cpu_cores="2" + vmostype="freebsd-64" + ;; + macos*) + cpu_cores="1" + vmostype="freebsd" + ;; + beos*) + vmostype="other" + ;; + # Unknown guestOS setting in .xml - use conservative defaults + *64) + vmostype="other-64" + ;; + *) + vmostype="other" + ;; + esac + + svga_autodetect="TRUE" + + numvcpus="${cpu_cores}" + [ "${cpu_cores}" -ge "4" 2>/dev/null ] && numvcpus="4" + + if [ "x$shfolders" != "xFALSE" ]; then + ENABLE_SHARE='sharedFolder.option = "alwaysEnabled"' + else + ENABLE_SHARE='' + fi + + [ "${mem}" -ge "$MAXMEM" ] && mem="$MAXMEM" + + cap3d="WHAT IS THIS VAR USED FOR?" # helper var for loging output + + cat >> "$conffile" </dev/null 2>&1 + + # set the appropriate permissions for the vmware config file + chmod u+rwx ${conffile} >/dev/null 2>&1 } preferencesheader () @@ -260,10 +367,10 @@ pref.enableAllSharedFolders = "TRUE" # eula HEREEND - -# different eula parameters from Workstation 9+/ Player 5+ + + # different eula parameters from Workstation 9+/ Player 5+ case "$vmversion" in - 3.*|4.*|7.*|8.*) + 3.*|4.*|7.*|8.*) cat >> "$vmhome/preferences" <> "$vmhome/preferences" <