diff options
author | Michael Janczyk | 2008-10-16 23:59:47 +0200 |
---|---|---|
committer | Michael Janczyk | 2008-10-16 23:59:47 +0200 |
commit | 06553717db159945f7b8a42285fc07dcc9b5a99f (patch) | |
tree | b24c2f4dd7e92e3d86d7fe026b85ce7ce0e97000 /os-plugins | |
parent | xserver: linked default mesa libs back, when needed (stage3) (diff) | |
download | core-06553717db159945f7b8a42285fc07dcc9b5a99f.tar.gz core-06553717db159945f7b8a42285fc07dcc9b5a99f.tar.xz core-06553717db159945f7b8a42285fc07dcc9b5a99f.zip |
restructured runvmware:
removed bug with cdr_: works with declare
now the vmem file is written to /dev/shm when the host has 2.5+ gb of ram
git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2350 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'os-plugins')
-rw-r--r-- | os-plugins/plugins/vmware/files/runvmware-player-v1 | 137 | ||||
-rw-r--r-- | os-plugins/plugins/vmware/files/runvmware-player-v2 | 150 | ||||
-rw-r--r-- | os-plugins/plugins/vmware/files/runvmware-player-v25 | 150 |
3 files changed, 240 insertions, 197 deletions
diff --git a/os-plugins/plugins/vmware/files/runvmware-player-v1 b/os-plugins/plugins/vmware/files/runvmware-player-v1 index c8a523f2..3ee02d62 100644 --- a/os-plugins/plugins/vmware/files/runvmware-player-v1 +++ b/os-plugins/plugins/vmware/files/runvmware-player-v1 @@ -6,10 +6,10 @@ # orwards it into B drive of vmplayer # # Author(s): see project authors file -# letzte Änderung mj0, 15/10/2008 +# last changes mj0, 16/10/2008 # Copyright: (c) 2003 - 2008 - RZ Universitaet Freiburg # -# Version: 0.17 +# Version: 0.18 # ################################################################################ @@ -86,7 +86,7 @@ cdr_2="FALSE" # be done while creating the runscripts ... ide="TRUE" scsi="FALSE" -hddrv="lsilogic" +hddrv="ide" # Displayresolution needed for vmware.config hostres=$(xvidtune -show 2>/dev/null| grep -ve "^$") @@ -102,17 +102,19 @@ vmopt="-X" # temporary disk space for logs, etc... # use /tmp/vmware/${USER} if /tmp sits on NFS import -export tmpdir=/tmp/${USER} +redodir=/tmp/vmware/${USER} + +# dir for configs and vmem file +confdir=${redodir} # configfile -confile="${tmpdir}/runvmware.conf" +conffile="${confdir}/run-vmware.conf" # users vmware config folder vmhome="${HOME}/.vmware" -#vmhome="/tmp/${USER}/.vmware" - -# unknow variables needed vor vmwplayer configuration +# config and hardware version ex. 8/6 for VMware6.5 +# will be replaced automatically during run of vmware/player confver=8 hver=4 @@ -176,10 +178,7 @@ diskfile="${vmdir}/${imagename}" debug=0 #TODO: Bad done... we should do this another way later -last_changes=$(head -n 15 $0 | grep "@" | awk -F ", " '{print $2}' \ - | awk -F "-" '{print $3" "$2" "$1}' | sort -bfnr \ - | awk '{print $3"-"$2"-"$1}' | grep -m 1 [0-9]) -version=$(head -n 15 $0 | grep "# Version: " | awk '{print $3}') +version=$(head -n 20 $0 | grep "# Version: " | awk '{print $3}') ############# ## TODO: End of uncleaned area @@ -196,7 +195,7 @@ version=$(head -n 15 $0 | grep "# Version: " | awk '{print $3}') ## ################################################################################ -### write runvmware.conf ####################################################### +### write run-vmware.conf ####################################################### #TODO: only not yet checked function filecheck () { @@ -217,11 +216,11 @@ filecheck () # does file exist if [ "${noimage}" -ge "1" ]; then - writelog "Vmware Image Problem:\c" + writelog "Vmware Image Problem:\c " writelog "\tThe image you've specified doesn't exist." - writelog "Filecheck says:\c" + writelog "Filecheck says:\c " writelog "\t\t${diskfile}:\n\t\t\tNo such file or directory" - writelog "Hint:\c" + writelog "Hint:\c " writelog "\t\t\tCompare spelling of the image with your options.\n" exit 1 fi @@ -229,7 +228,7 @@ filecheck () # readable? if ! [ -r "${diskfile}" >/dev/null 2>&1 \ -o -r "${diskfile}" >/dev/null 2>&1 ]; then - writelog "Vmware Image Problem:\c" + writelog "Vmware Image Problem:\c " writelog "\tThe image you've specified has wrong rights." writelog "Filecheck says:\t\t$(echo ${filecheck} \ | awk '{print $1" "$3" "$4}') ${rightsfile}" @@ -241,8 +240,8 @@ filecheck () if ! [ -w "${diskfile}" >/dev/null 2>&1 \ -o -w "${diskfile}" >/dev/null 2>&1 ] \ && [ "${np}" = "independent-persistent" ]; then - writelog "Vmware Image Problem:\c" - writelog "\tThe image you've specified has wrong rights." + writelog "Vmware Image Problem:\c " + writelog "\tThe image you have specified has wrong rights." writelog "Filecheck says:\t\t$(echo ${filecheck} \ | awk '{print $1" "$3" "$4}') ${rightsfile}" writelog "Hint:\t\t\tUse nonpersistent-mode or change rights to rw\n" @@ -251,12 +250,12 @@ filecheck () } -### write runvmware.conf ####################################################### +### write run-vmware.conf ####################################################### runvmwareconfheader () { echo " ############################################################################## - ###### This configuration file was generated by 'runvmware', ###### + ###### This configuration file was generated by run-vmware.sh, ###### ###### dont use it for your own configurations - it will be overwritten ###### ###### ###### @@ -331,12 +330,11 @@ runvmwareconfheader () sharedFolder.maxNum = \"1\" ###### misc ################################################################## - tmpDirectory = \"${tmpdir}\" + tmpDirectory = \"${redodir}\" mainMem.useNamedFile = \"TRUE\" snapshot.disabled = \"TRUE\" tools.syncTime = \"TRUE\" - # use redoLogDir = \"/dev/shm\" if sitting on NFS import - redoLogDir = \"${tmpdir}\" + redoLogDir = \"${redodir}\" hints.hideAll = \"TRUE\" logging = \"FALSE\" isolation.tools.hgfs.disable = \"FALSE\" @@ -349,11 +347,12 @@ runvmwareconfheader () pref.hotkey.alt = \"TRUE\" svga.maxWidth = \"${xres}\" svga.maxHeight = \"${yres}\" + svga.autodetect = \"TRUE\" " \ - >${confile} + >${conffile} # set the appropriate permissions for the vmware config file - chmod u+rwx ${confile} >/dev/null 2>&1 + chmod u+rwx ${conffile} >/dev/null 2>&1 } @@ -362,15 +361,14 @@ preferencesheader () { echo " ############################################################################## - ###### This configuration file was generated by 'runvmware', ###### + ###### This configuration file was generated by run-vmware.sh, ###### ###### dont use it for your own configurations - it will be overwritten ###### ###### ###### ################################## Wichtig! ################################## ###### *.vmem wird immer angelegt und frisst soviel Speicher, wie fuer ###### ###### den Gast vorgesehen. Sollte nicht im tempfs liegen. NFS OK, da ###### ###### IO nur einmal beim Start erheblich. Wird gesteuert ueber ###### - ###### tmpDirectory = /nfs-viel-platz und darin wird dann vmware-\$user ###### - ###### angelegt. ###### + ###### confdir=/nfs-viel-platz ###### # DEBUG: some versions accept it only upper or lowercase... which one? # The following 4 could also be uppercase @@ -384,8 +382,8 @@ preferencesheader () pref.vmplayer.fullscreen.autohide = \"true\" pref.vmplayer.webUpdateOnStartup = \"false\" prefvmx.defaultVMPath = \"${vmhome}\" - prefvmx.mru.config = \"${confile}:\" - tmpDirectory = \"${tmpdir}\" + prefvmx.mru.config = \"${conffile}:\" + tmpDirectory = \"${redodir}\" webUpdate.checkPeriod = \"manual\" pref.eula.size = \"2\" pref.eula.0.appName = \"VMware Player\" @@ -405,7 +403,7 @@ writelog () echo -e "$1" # log in file - echo -e "$1" >>${tmpdir}/runvmware.${USER}.log + echo -e "$1" >>${redodir}/run-vmware.${USER}.log } @@ -419,24 +417,24 @@ writelog () ## ################################################################################ -# Delete the LOCK file. its unsecure, but ... -rm -f ${tmpdir}/*LOCK >/dev/null 2>&1 +# Delete the LOCK file. its insecure, but ... +rm -f ${confdir}/*LOCK >/dev/null 2>&1 # create vmware directories -mkdir -p ${tmpdir} >/dev/null 2>&1 +mkdir -p ${redodir} >/dev/null 2>&1 +mkdir -p ${confdir} >/dev/null 2>&1 mkdir -p ${vmhome} >/dev/null 2>&1 -# NO X-server, no runvmware ;) +# NO X-server, no run-vmware ;) [ -z "$DISPLAY" ] && echo -e "\n\tStart only within a desktop!\n" && exit 1 # logo for console cat <<EOL - .----.--.--.-----.--.--.--------.--.--.--.---.-.----.-----. - | _| | | | | | | | | | _ | _| -__| - |__| |_____|__|__|\___/|__|__|__|________|___._|__| |_____| - Script for preparing VMware environment...(v${version}) - + .----.--.--.-----.--.--.--------.--.--.--.---.-.----.-----. + | _| | | | | | | | | | _ | _| -__| + |__| |_____|__|__|\___/|__|__|__|________|___._|__| |_____| + Script for preparing VMware environment...(v${version}) EOL @@ -444,21 +442,14 @@ EOL ### CHECK MACHINE SETUP ######################################################## ## log script information -writelog "##################################################\n" writelog "# File created by $0 (v.${version})\n# on $(date)\n" -writelog "##################################################\n" writelog "Starting with $(echo ${np} | sed 's/i.*-//g')-mode ...\n" -## log disksetup -writelog "Directories:" -writelog "\tTmpdir:\t\t${tmpdir}" -writelog "\tVMhome:\t\t${vmhome}" -writelog "\tTmpdir info:\t$(mount | grep -i "/tmp ")" +## HW deteщtion start +writelog "Starting hardware / device detection...\c " ## configuring MAC address: first four bytes are fixed (00:50:56:0D) the ## last two bytes are taken from the local network adaptor -writelog "Starting hardware / device detection...\c" - ## Get last two MAC values for VMPlayer # NF = Number of Fields of found values in awk mac=$(/sbin/ifconfig eth0 | grep eth0 | sed -e "s/ //g" \ @@ -470,6 +461,15 @@ mac=$(/sbin/ifconfig eth0 | grep eth0 | sed -e "s/ //g" \ # get memory in MB totalmem=$(expr $(grep -i "memtotal" /proc/meminfo | awk '{print $2}') / 1024) +# TODO: Hack, ig more than 2,5G RAM use 40% of Ram and write vmem into +# Ram as well (40% vmware | 40% confdir(vmem...) | 20% host +if [ "${totalmem}" -ge "2500" ]; then + permem=40 + confdir=/dev/shm/vmware/$USER + conffile=${confdir}/run-vmware.conf + mkdir -p /dev/shm/vmware/$USER +fi + # calculate memory for vmplayer # TODO: unhappy how it is calculated mem=$(expr ${totalmem} / 100 \* ${permem} / 4 \* 4) @@ -489,7 +489,7 @@ fi (( cdri=1 )) for cdrs in /dev/cdrom*; do if [ -L $cdrs ]; then - cdr_${cdri}="TRUE" + declare cdr_${cdri}="TRUE" (( cdri=${cdri}+1 )) fi done @@ -497,14 +497,23 @@ done ## Write all results to logfile writelog "finished" -writelog "Results:" +## log disksetup +writelog "Directories:" +writelog "\tConfdir:\t${confdir}" +writelog "\tConffile:\t${conffile}" +writelog "\tRedodir:\t${redodir}" +writelog "\tVMhome:\t\t${vmhome}" +writelog "\t/tmp info: \ + $(grep "/tmp " /proc/mounts) $(df -h | grep " /tmp$" | awk '{print $2}')" +# HW setup +writelog "Hardware:" writelog "\tMAC:\t\t00:50:56:0D:${mac}" writelog "\tMem:\t\t${mem} MB" writelog "\tMax. res.:\t${xres}x${yres}" writelog "\tCD-ROM_1:\t${cdr_1}" writelog "\tCD-ROM_2:\t${cdr_2}" -writelog "finished" -writelog "Results:" +# Image +writelog "Diskimage:" writelog "\tDiskfile:\t${diskfile}" writelog "\tDisktype:\t${hddrv}" writelog "\tVMostype:\t${vmostype}" @@ -541,25 +550,27 @@ sync # TODO: optimize, currently kinda inefficient, too much copys, but we # don't know which one is installed... for i in /opt/openslx/plugin-repo/vmware/*; do - cp ${i}/nvram.5.0 ${tmpdir}/nvram + cp ${i}/nvram.5.0 ${confdir}/nvram 2>/dev/null done # adjust volume -writelog "Unmuting sound...\c" -amixer -q sset Master 28 unmute -amixer -q sset PCM 28 unmute +writelog "Unmuting sound...\c " +amixer -q sset Master 28 unmute 2>/dev/null +amixer -q sset PCM 28 unmute 2>/dev/null +amixer -q sset Headphone 28 unmute 2>/dev/null +amixer -q sset Front 0 mute 2>/dev/null writelog "finished\n" ### run vmplayer ############################################################### # ...with the automatically written config file -if [ $(which vmplayer 2>/dev/null) ]; then writelog "\nStarting VMplayer..." +if [ $(which vmplayer 2>/dev/null) ]; then writelog "Starting ..." # run VMplayer - writelog "... vmplayer ${vmopt} ${confile}...\n" - vmplayer ${vmopt} ${confile} 2>&1 >/dev/null + writelog "... vmplayer ${vmopt} ${conffile}\n" + vmplayer ${vmopt} ${conffile} >/dev/null 2>&1 else - writelog "\nNo VMware/VMPlayer found!\n" + writelog "No VMware/VMPlayer found!\n" exit 1 fi -writelog "\nBye.\n" +writelog "Bye.\n" exit 0 diff --git a/os-plugins/plugins/vmware/files/runvmware-player-v2 b/os-plugins/plugins/vmware/files/runvmware-player-v2 index 581181a3..2860517a 100644 --- a/os-plugins/plugins/vmware/files/runvmware-player-v2 +++ b/os-plugins/plugins/vmware/files/runvmware-player-v2 @@ -6,10 +6,10 @@ # orwards it into B drive of vmplayer # # Author(s): see project authors file -# letzte Änderung mj0, 15/10/2008 +# last changes mj0, 16/10/2008 # Copyright: (c) 2003 - 2008 - RZ Universitaet Freiburg # -# Version: 0.17 +# Version: 0.18 # ################################################################################ @@ -86,7 +86,7 @@ cdr_2="FALSE" # be done while creating the runscripts ... ide="TRUE" scsi="FALSE" -hddrv="lsilogic" +hddrv="ide" # Displayresolution needed for vmware.config hostres=$(xvidtune -show 2>/dev/null| grep -ve "^$") @@ -102,17 +102,19 @@ vmopt="-X" # temporary disk space for logs, etc... # use /tmp/vmware/${USER} if /tmp sits on NFS import -export tmpdir=/tmp/${USER} +redodir=/tmp/vmware/${USER} + +# dir for configs and vmem file +confdir=${redodir} # configfile -confile="${tmpdir}/runvmware.conf" +conffile="${confdir}/run-vmware.conf" # users vmware config folder vmhome="${HOME}/.vmware" -#vmhome="/tmp/${USER}/.vmware" - -# unknow variables needed vor vmwplayer configuration +# config and hardware version ex. 8/6 for VMware6.5 +# will be replaced automatically during run of vmware/player confver=8 hver=4 @@ -176,10 +178,7 @@ diskfile="${vmdir}/${imagename}" debug=0 #TODO: Bad done... we should do this another way later -last_changes=$(head -n 15 $0 | grep "@" | awk -F ", " '{print $2}' \ - | awk -F "-" '{print $3" "$2" "$1}' | sort -bfnr \ - | awk '{print $3"-"$2"-"$1}' | grep -m 1 [0-9]) -version=$(head -n 15 $0 | grep "# Version: " | awk '{print $3}') +version=$(head -n 20 $0 | grep "# Version: " | awk '{print $3}') ############# ## TODO: End of uncleaned area @@ -196,7 +195,7 @@ version=$(head -n 15 $0 | grep "# Version: " | awk '{print $3}') ## ################################################################################ -### write runvmware.conf ####################################################### +### write run-vmware.conf ####################################################### #TODO: only not yet checked function filecheck () { @@ -217,11 +216,11 @@ filecheck () # does file exist if [ "${noimage}" -ge "1" ]; then - writelog "Vmware Image Problem:\c" + writelog "Vmware Image Problem:\c " writelog "\tThe image you've specified doesn't exist." - writelog "Filecheck says:\c" + writelog "Filecheck says:\c " writelog "\t\t${diskfile}:\n\t\t\tNo such file or directory" - writelog "Hint:\c" + writelog "Hint:\c " writelog "\t\t\tCompare spelling of the image with your options.\n" exit 1 fi @@ -229,7 +228,7 @@ filecheck () # readable? if ! [ -r "${diskfile}" >/dev/null 2>&1 \ -o -r "${diskfile}" >/dev/null 2>&1 ]; then - writelog "Vmware Image Problem:\c" + writelog "Vmware Image Problem:\c " writelog "\tThe image you've specified has wrong rights." writelog "Filecheck says:\t\t$(echo ${filecheck} \ | awk '{print $1" "$3" "$4}') ${rightsfile}" @@ -241,8 +240,8 @@ filecheck () if ! [ -w "${diskfile}" >/dev/null 2>&1 \ -o -w "${diskfile}" >/dev/null 2>&1 ] \ && [ "${np}" = "independent-persistent" ]; then - writelog "Vmware Image Problem:\c" - writelog "\tThe image you've specified has wrong rights." + writelog "Vmware Image Problem:\c " + writelog "\tThe image you have specified has wrong rights." writelog "Filecheck says:\t\t$(echo ${filecheck} \ | awk '{print $1" "$3" "$4}') ${rightsfile}" writelog "Hint:\t\t\tUse nonpersistent-mode or change rights to rw\n" @@ -251,12 +250,12 @@ filecheck () } -### write runvmware.conf ####################################################### +### write run-vmware.conf ####################################################### runvmwareconfheader () { echo " ############################################################################## - ###### This configuration file was generated by 'runvmware', ###### + ###### This configuration file was generated by run-vmware.sh, ###### ###### dont use it for your own configurations - it will be overwritten ###### ###### ###### @@ -331,12 +330,11 @@ runvmwareconfheader () sharedFolder.maxNum = \"1\" ###### misc ################################################################## - tmpDirectory = \"${tmpdir}\" + tmpDirectory = \"${redodir}\" mainMem.useNamedFile = \"TRUE\" snapshot.disabled = \"TRUE\" tools.syncTime = \"TRUE\" - # use redoLogDir = \"/dev/shm\" if sitting on NFS import - redoLogDir = \"${tmpdir}\" + redoLogDir = \"${redodir}\" hints.hideAll = \"TRUE\" logging = \"FALSE\" isolation.tools.hgfs.disable = \"FALSE\" @@ -349,11 +347,12 @@ runvmwareconfheader () pref.hotkey.alt = \"TRUE\" svga.maxWidth = \"${xres}\" svga.maxHeight = \"${yres}\" + svga.autodetect = \"TRUE\" " \ - >${confile} + >${conffile} # set the appropriate permissions for the vmware config file - chmod u+rwx ${confile} >/dev/null 2>&1 + chmod u+rwx ${conffile} >/dev/null 2>&1 } @@ -362,15 +361,14 @@ preferencesheader () { echo " ############################################################################## - ###### This configuration file was generated by 'runvmware', ###### + ###### This configuration file was generated by run-vmware.sh, ###### ###### dont use it for your own configurations - it will be overwritten ###### ###### ###### ################################## Wichtig! ################################## ###### *.vmem wird immer angelegt und frisst soviel Speicher, wie fuer ###### ###### den Gast vorgesehen. Sollte nicht im tempfs liegen. NFS OK, da ###### ###### IO nur einmal beim Start erheblich. Wird gesteuert ueber ###### - ###### tmpDirectory = /nfs-viel-platz und darin wird dann vmware-\$user ###### - ###### angelegt. ###### + ###### confdir=/nfs-viel-platz ###### # DEBUG: some versions accept it only upper or lowercase... which one? # The following 4 could also be uppercase @@ -384,15 +382,20 @@ preferencesheader () pref.vmplayer.fullscreen.autohide = \"true\" pref.vmplayer.webUpdateOnStartup = \"false\" prefvmx.defaultVMPath = \"${vmhome}\" - prefvmx.mru.config = \"${confile}:\" - tmpDirectory = \"${tmpdir}\" + prefvmx.mru.config = \"${conffile}:\" + tmpDirectory = \"${redodir}\" webUpdate.checkPeriod = \"manual\" pref.eula.size = \"2\" pref.eula.0.appName = \"VMware Player\" pref.eula.0.buildNumber = \"${vmbuild}\" pref.eula.1.appName = \"VMware Workstation\" pref.eula.1.buildNumber = \"${vmbuild}\" - pref.enableAllSharedFolders = "TRUE" + pref.enableAllSharedFolders = \"TRUE\" + sharedFolder0.enabled = \"TRUE\" + pref.grabOnKeyPress = \"TRUE\" + pref.autoFitFullScreen = \"fitHostToGuest\" + pref.autoFitGuestToWindow = \"TRUE\" + pref.grabOnMouseClick = \"TRUE\" " \ >${vmhome}/preferences } @@ -406,7 +409,7 @@ writelog () echo -e "$1" # log in file - echo -e "$1" >>${tmpdir}/runvmware.${USER}.log + echo -e "$1" >>${redodir}/run-vmware.${USER}.log } @@ -420,24 +423,24 @@ writelog () ## ################################################################################ -# Delete the LOCK file. its unsecure, but ... -rm -f ${tmpdir}/*LOCK >/dev/null 2>&1 +# Delete the LOCK file. its insecure, but ... +rm -f ${confdir}/*LOCK >/dev/null 2>&1 # create vmware directories -mkdir -p ${tmpdir} >/dev/null 2>&1 +mkdir -p ${redodir} >/dev/null 2>&1 +mkdir -p ${confdir} >/dev/null 2>&1 mkdir -p ${vmhome} >/dev/null 2>&1 -# NO X-server, no runvmware ;) +# NO X-server, no run-vmware ;) [ -z "$DISPLAY" ] && echo -e "\n\tStart only within a desktop!\n" && exit 1 # logo for console cat <<EOL - .----.--.--.-----.--.--.--------.--.--.--.---.-.----.-----. - | _| | | | | | | | | | _ | _| -__| - |__| |_____|__|__|\___/|__|__|__|________|___._|__| |_____| - Script for preparing VMware environment...(v${version}) - + .----.--.--.-----.--.--.--------.--.--.--.---.-.----.-----. + | _| | | | | | | | | | _ | _| -__| + |__| |_____|__|__|\___/|__|__|__|________|___._|__| |_____| + Script for preparing VMware environment...(v${version}) EOL @@ -445,21 +448,14 @@ EOL ### CHECK MACHINE SETUP ######################################################## ## log script information -writelog "##################################################\n" writelog "# File created by $0 (v.${version})\n# on $(date)\n" -writelog "##################################################\n" writelog "Starting with $(echo ${np} | sed 's/i.*-//g')-mode ...\n" -## log disksetup -writelog "Directories:" -writelog "\tTmpdir:\t\t${tmpdir}" -writelog "\tVMhome:\t\t${vmhome}" -writelog "\tTmpdir info:\t$(mount | grep -i "/tmp ")" +## HW deteщtion start +writelog "Starting hardware / device detection...\c " ## configuring MAC address: first four bytes are fixed (00:50:56:0D) the ## last two bytes are taken from the local network adaptor -writelog "Starting hardware / device detection...\c" - ## Get last two MAC values for VMPlayer # NF = Number of Fields of found values in awk mac=$(/sbin/ifconfig eth0 | grep eth0 | sed -e "s/ //g" \ @@ -471,6 +467,15 @@ mac=$(/sbin/ifconfig eth0 | grep eth0 | sed -e "s/ //g" \ # get memory in MB totalmem=$(expr $(grep -i "memtotal" /proc/meminfo | awk '{print $2}') / 1024) +# TODO: Hack, ig more than 2,5G RAM use 40% of Ram and write vmem into +# Ram as well (40% vmware | 40% confdir(vmem...) | 20% host +if [ "${totalmem}" -ge "2500" ]; then + permem=40 + confdir=/dev/shm/vmware/$USER + conffile=${confdir}/run-vmware.conf + mkdir -p /dev/shm/vmware/$USER +fi + # calculate memory for vmplayer # TODO: unhappy how it is calculated mem=$(expr ${totalmem} / 100 \* ${permem} / 4 \* 4) @@ -490,7 +495,7 @@ fi (( cdri=1 )) for cdrs in /dev/cdrom*; do if [ -L $cdrs ]; then - cdr_${cdri}="TRUE" + declare cdr_${cdri}="TRUE" (( cdri=${cdri}+1 )) fi done @@ -498,14 +503,23 @@ done ## Write all results to logfile writelog "finished" -writelog "Results:" +## log disksetup +writelog "Directories:" +writelog "\tConfdir:\t${confdir}" +writelog "\tConffile:\t${conffile}" +writelog "\tRedodir:\t${redodir}" +writelog "\tVMhome:\t\t${vmhome}" +writelog "\t/tmp info: \ + $(grep "/tmp " /proc/mounts) $(df -h | grep " /tmp$" | awk '{print $2}')" +# HW setup +writelog "Hardware:" writelog "\tMAC:\t\t00:50:56:0D:${mac}" writelog "\tMem:\t\t${mem} MB" writelog "\tMax. res.:\t${xres}x${yres}" writelog "\tCD-ROM_1:\t${cdr_1}" writelog "\tCD-ROM_2:\t${cdr_2}" -writelog "finished" -writelog "Results:" +# Image +writelog "Diskimage:" writelog "\tDiskfile:\t${diskfile}" writelog "\tDisktype:\t${hddrv}" writelog "\tVMostype:\t${vmostype}" @@ -542,30 +556,32 @@ sync # TODO: optimize, currently kinda inefficient, too much copys, but we # don't know which one is installed... for i in /opt/openslx/plugin-repo/vmware/*; do - cp ${i}/nvram.5.0 ${tmpdir}/nvram + cp ${i}/nvram.5.0 ${confdir}/nvram 2>/dev/null done # adjust volume -writelog "Unmuting sound...\c" -amixer -q sset Master 28 unmute -amixer -q sset PCM 28 unmute +writelog "Unmuting sound...\c " +amixer -q sset Master 28 unmute 2>/dev/null +amixer -q sset PCM 28 unmute 2>/dev/null +amixer -q sset Headphone 28 unmute 2>/dev/null +amixer -q sset Front 0 mute 2>/dev/null writelog "finished\n" ### run vmplayer ############################################################### # ...with the automatically written config file -if [ $(which vmplayer 2>/dev/null) ]; then writelog "\nStarting VMplayer..." +if [ $(which vmplayer 2>/dev/null) ]; then writelog "Starting ..." # run VMplayer - writelog "... vmplayer ${vmopt} ${confile}...\n" + writelog "... vmplayer ${vmopt} ${conffile}\n" # start fvwm for player 2+ # problems with windows opening in background - which fvwm2 && \ - ( echo "EdgeScroll 0 0" >/tmp/fvwm-$USER - fvwm -f /tmp/fvwm-$USER & ) - vmplayer ${vmopt} ${confile} 2>&1 >/dev/null + which fvwm2 >/dev/null 2>&1 && \ + ( echo "EdgeScroll 0 0" > ${redodir}/fvwm + fvwm2 -f ${redodir}/fvwm >/dev/null 2>&1 & ) + vmplayer ${vmopt} ${conffile} >/dev/null 2>&1 else - writelog "\nNo VMware/VMPlayer found!\n" + writelog "No VMware/VMPlayer found!\n" exit 1 fi -writelog "\nBye.\n" +writelog "Bye.\n" exit 0 diff --git a/os-plugins/plugins/vmware/files/runvmware-player-v25 b/os-plugins/plugins/vmware/files/runvmware-player-v25 index 581181a3..2860517a 100644 --- a/os-plugins/plugins/vmware/files/runvmware-player-v25 +++ b/os-plugins/plugins/vmware/files/runvmware-player-v25 @@ -6,10 +6,10 @@ # orwards it into B drive of vmplayer # # Author(s): see project authors file -# letzte Änderung mj0, 15/10/2008 +# last changes mj0, 16/10/2008 # Copyright: (c) 2003 - 2008 - RZ Universitaet Freiburg # -# Version: 0.17 +# Version: 0.18 # ################################################################################ @@ -86,7 +86,7 @@ cdr_2="FALSE" # be done while creating the runscripts ... ide="TRUE" scsi="FALSE" -hddrv="lsilogic" +hddrv="ide" # Displayresolution needed for vmware.config hostres=$(xvidtune -show 2>/dev/null| grep -ve "^$") @@ -102,17 +102,19 @@ vmopt="-X" # temporary disk space for logs, etc... # use /tmp/vmware/${USER} if /tmp sits on NFS import -export tmpdir=/tmp/${USER} +redodir=/tmp/vmware/${USER} + +# dir for configs and vmem file +confdir=${redodir} # configfile -confile="${tmpdir}/runvmware.conf" +conffile="${confdir}/run-vmware.conf" # users vmware config folder vmhome="${HOME}/.vmware" -#vmhome="/tmp/${USER}/.vmware" - -# unknow variables needed vor vmwplayer configuration +# config and hardware version ex. 8/6 for VMware6.5 +# will be replaced automatically during run of vmware/player confver=8 hver=4 @@ -176,10 +178,7 @@ diskfile="${vmdir}/${imagename}" debug=0 #TODO: Bad done... we should do this another way later -last_changes=$(head -n 15 $0 | grep "@" | awk -F ", " '{print $2}' \ - | awk -F "-" '{print $3" "$2" "$1}' | sort -bfnr \ - | awk '{print $3"-"$2"-"$1}' | grep -m 1 [0-9]) -version=$(head -n 15 $0 | grep "# Version: " | awk '{print $3}') +version=$(head -n 20 $0 | grep "# Version: " | awk '{print $3}') ############# ## TODO: End of uncleaned area @@ -196,7 +195,7 @@ version=$(head -n 15 $0 | grep "# Version: " | awk '{print $3}') ## ################################################################################ -### write runvmware.conf ####################################################### +### write run-vmware.conf ####################################################### #TODO: only not yet checked function filecheck () { @@ -217,11 +216,11 @@ filecheck () # does file exist if [ "${noimage}" -ge "1" ]; then - writelog "Vmware Image Problem:\c" + writelog "Vmware Image Problem:\c " writelog "\tThe image you've specified doesn't exist." - writelog "Filecheck says:\c" + writelog "Filecheck says:\c " writelog "\t\t${diskfile}:\n\t\t\tNo such file or directory" - writelog "Hint:\c" + writelog "Hint:\c " writelog "\t\t\tCompare spelling of the image with your options.\n" exit 1 fi @@ -229,7 +228,7 @@ filecheck () # readable? if ! [ -r "${diskfile}" >/dev/null 2>&1 \ -o -r "${diskfile}" >/dev/null 2>&1 ]; then - writelog "Vmware Image Problem:\c" + writelog "Vmware Image Problem:\c " writelog "\tThe image you've specified has wrong rights." writelog "Filecheck says:\t\t$(echo ${filecheck} \ | awk '{print $1" "$3" "$4}') ${rightsfile}" @@ -241,8 +240,8 @@ filecheck () if ! [ -w "${diskfile}" >/dev/null 2>&1 \ -o -w "${diskfile}" >/dev/null 2>&1 ] \ && [ "${np}" = "independent-persistent" ]; then - writelog "Vmware Image Problem:\c" - writelog "\tThe image you've specified has wrong rights." + writelog "Vmware Image Problem:\c " + writelog "\tThe image you have specified has wrong rights." writelog "Filecheck says:\t\t$(echo ${filecheck} \ | awk '{print $1" "$3" "$4}') ${rightsfile}" writelog "Hint:\t\t\tUse nonpersistent-mode or change rights to rw\n" @@ -251,12 +250,12 @@ filecheck () } -### write runvmware.conf ####################################################### +### write run-vmware.conf ####################################################### runvmwareconfheader () { echo " ############################################################################## - ###### This configuration file was generated by 'runvmware', ###### + ###### This configuration file was generated by run-vmware.sh, ###### ###### dont use it for your own configurations - it will be overwritten ###### ###### ###### @@ -331,12 +330,11 @@ runvmwareconfheader () sharedFolder.maxNum = \"1\" ###### misc ################################################################## - tmpDirectory = \"${tmpdir}\" + tmpDirectory = \"${redodir}\" mainMem.useNamedFile = \"TRUE\" snapshot.disabled = \"TRUE\" tools.syncTime = \"TRUE\" - # use redoLogDir = \"/dev/shm\" if sitting on NFS import - redoLogDir = \"${tmpdir}\" + redoLogDir = \"${redodir}\" hints.hideAll = \"TRUE\" logging = \"FALSE\" isolation.tools.hgfs.disable = \"FALSE\" @@ -349,11 +347,12 @@ runvmwareconfheader () pref.hotkey.alt = \"TRUE\" svga.maxWidth = \"${xres}\" svga.maxHeight = \"${yres}\" + svga.autodetect = \"TRUE\" " \ - >${confile} + >${conffile} # set the appropriate permissions for the vmware config file - chmod u+rwx ${confile} >/dev/null 2>&1 + chmod u+rwx ${conffile} >/dev/null 2>&1 } @@ -362,15 +361,14 @@ preferencesheader () { echo " ############################################################################## - ###### This configuration file was generated by 'runvmware', ###### + ###### This configuration file was generated by run-vmware.sh, ###### ###### dont use it for your own configurations - it will be overwritten ###### ###### ###### ################################## Wichtig! ################################## ###### *.vmem wird immer angelegt und frisst soviel Speicher, wie fuer ###### ###### den Gast vorgesehen. Sollte nicht im tempfs liegen. NFS OK, da ###### ###### IO nur einmal beim Start erheblich. Wird gesteuert ueber ###### - ###### tmpDirectory = /nfs-viel-platz und darin wird dann vmware-\$user ###### - ###### angelegt. ###### + ###### confdir=/nfs-viel-platz ###### # DEBUG: some versions accept it only upper or lowercase... which one? # The following 4 could also be uppercase @@ -384,15 +382,20 @@ preferencesheader () pref.vmplayer.fullscreen.autohide = \"true\" pref.vmplayer.webUpdateOnStartup = \"false\" prefvmx.defaultVMPath = \"${vmhome}\" - prefvmx.mru.config = \"${confile}:\" - tmpDirectory = \"${tmpdir}\" + prefvmx.mru.config = \"${conffile}:\" + tmpDirectory = \"${redodir}\" webUpdate.checkPeriod = \"manual\" pref.eula.size = \"2\" pref.eula.0.appName = \"VMware Player\" pref.eula.0.buildNumber = \"${vmbuild}\" pref.eula.1.appName = \"VMware Workstation\" pref.eula.1.buildNumber = \"${vmbuild}\" - pref.enableAllSharedFolders = "TRUE" + pref.enableAllSharedFolders = \"TRUE\" + sharedFolder0.enabled = \"TRUE\" + pref.grabOnKeyPress = \"TRUE\" + pref.autoFitFullScreen = \"fitHostToGuest\" + pref.autoFitGuestToWindow = \"TRUE\" + pref.grabOnMouseClick = \"TRUE\" " \ >${vmhome}/preferences } @@ -406,7 +409,7 @@ writelog () echo -e "$1" # log in file - echo -e "$1" >>${tmpdir}/runvmware.${USER}.log + echo -e "$1" >>${redodir}/run-vmware.${USER}.log } @@ -420,24 +423,24 @@ writelog () ## ################################################################################ -# Delete the LOCK file. its unsecure, but ... -rm -f ${tmpdir}/*LOCK >/dev/null 2>&1 +# Delete the LOCK file. its insecure, but ... +rm -f ${confdir}/*LOCK >/dev/null 2>&1 # create vmware directories -mkdir -p ${tmpdir} >/dev/null 2>&1 +mkdir -p ${redodir} >/dev/null 2>&1 +mkdir -p ${confdir} >/dev/null 2>&1 mkdir -p ${vmhome} >/dev/null 2>&1 -# NO X-server, no runvmware ;) +# NO X-server, no run-vmware ;) [ -z "$DISPLAY" ] && echo -e "\n\tStart only within a desktop!\n" && exit 1 # logo for console cat <<EOL - .----.--.--.-----.--.--.--------.--.--.--.---.-.----.-----. - | _| | | | | | | | | | _ | _| -__| - |__| |_____|__|__|\___/|__|__|__|________|___._|__| |_____| - Script for preparing VMware environment...(v${version}) - + .----.--.--.-----.--.--.--------.--.--.--.---.-.----.-----. + | _| | | | | | | | | | _ | _| -__| + |__| |_____|__|__|\___/|__|__|__|________|___._|__| |_____| + Script for preparing VMware environment...(v${version}) EOL @@ -445,21 +448,14 @@ EOL ### CHECK MACHINE SETUP ######################################################## ## log script information -writelog "##################################################\n" writelog "# File created by $0 (v.${version})\n# on $(date)\n" -writelog "##################################################\n" writelog "Starting with $(echo ${np} | sed 's/i.*-//g')-mode ...\n" -## log disksetup -writelog "Directories:" -writelog "\tTmpdir:\t\t${tmpdir}" -writelog "\tVMhome:\t\t${vmhome}" -writelog "\tTmpdir info:\t$(mount | grep -i "/tmp ")" +## HW deteщtion start +writelog "Starting hardware / device detection...\c " ## configuring MAC address: first four bytes are fixed (00:50:56:0D) the ## last two bytes are taken from the local network adaptor -writelog "Starting hardware / device detection...\c" - ## Get last two MAC values for VMPlayer # NF = Number of Fields of found values in awk mac=$(/sbin/ifconfig eth0 | grep eth0 | sed -e "s/ //g" \ @@ -471,6 +467,15 @@ mac=$(/sbin/ifconfig eth0 | grep eth0 | sed -e "s/ //g" \ # get memory in MB totalmem=$(expr $(grep -i "memtotal" /proc/meminfo | awk '{print $2}') / 1024) +# TODO: Hack, ig more than 2,5G RAM use 40% of Ram and write vmem into +# Ram as well (40% vmware | 40% confdir(vmem...) | 20% host +if [ "${totalmem}" -ge "2500" ]; then + permem=40 + confdir=/dev/shm/vmware/$USER + conffile=${confdir}/run-vmware.conf + mkdir -p /dev/shm/vmware/$USER +fi + # calculate memory for vmplayer # TODO: unhappy how it is calculated mem=$(expr ${totalmem} / 100 \* ${permem} / 4 \* 4) @@ -490,7 +495,7 @@ fi (( cdri=1 )) for cdrs in /dev/cdrom*; do if [ -L $cdrs ]; then - cdr_${cdri}="TRUE" + declare cdr_${cdri}="TRUE" (( cdri=${cdri}+1 )) fi done @@ -498,14 +503,23 @@ done ## Write all results to logfile writelog "finished" -writelog "Results:" +## log disksetup +writelog "Directories:" +writelog "\tConfdir:\t${confdir}" +writelog "\tConffile:\t${conffile}" +writelog "\tRedodir:\t${redodir}" +writelog "\tVMhome:\t\t${vmhome}" +writelog "\t/tmp info: \ + $(grep "/tmp " /proc/mounts) $(df -h | grep " /tmp$" | awk '{print $2}')" +# HW setup +writelog "Hardware:" writelog "\tMAC:\t\t00:50:56:0D:${mac}" writelog "\tMem:\t\t${mem} MB" writelog "\tMax. res.:\t${xres}x${yres}" writelog "\tCD-ROM_1:\t${cdr_1}" writelog "\tCD-ROM_2:\t${cdr_2}" -writelog "finished" -writelog "Results:" +# Image +writelog "Diskimage:" writelog "\tDiskfile:\t${diskfile}" writelog "\tDisktype:\t${hddrv}" writelog "\tVMostype:\t${vmostype}" @@ -542,30 +556,32 @@ sync # TODO: optimize, currently kinda inefficient, too much copys, but we # don't know which one is installed... for i in /opt/openslx/plugin-repo/vmware/*; do - cp ${i}/nvram.5.0 ${tmpdir}/nvram + cp ${i}/nvram.5.0 ${confdir}/nvram 2>/dev/null done # adjust volume -writelog "Unmuting sound...\c" -amixer -q sset Master 28 unmute -amixer -q sset PCM 28 unmute +writelog "Unmuting sound...\c " +amixer -q sset Master 28 unmute 2>/dev/null +amixer -q sset PCM 28 unmute 2>/dev/null +amixer -q sset Headphone 28 unmute 2>/dev/null +amixer -q sset Front 0 mute 2>/dev/null writelog "finished\n" ### run vmplayer ############################################################### # ...with the automatically written config file -if [ $(which vmplayer 2>/dev/null) ]; then writelog "\nStarting VMplayer..." +if [ $(which vmplayer 2>/dev/null) ]; then writelog "Starting ..." # run VMplayer - writelog "... vmplayer ${vmopt} ${confile}...\n" + writelog "... vmplayer ${vmopt} ${conffile}\n" # start fvwm for player 2+ # problems with windows opening in background - which fvwm2 && \ - ( echo "EdgeScroll 0 0" >/tmp/fvwm-$USER - fvwm -f /tmp/fvwm-$USER & ) - vmplayer ${vmopt} ${confile} 2>&1 >/dev/null + which fvwm2 >/dev/null 2>&1 && \ + ( echo "EdgeScroll 0 0" > ${redodir}/fvwm + fvwm2 -f ${redodir}/fvwm >/dev/null 2>&1 & ) + vmplayer ${vmopt} ${conffile} >/dev/null 2>&1 else - writelog "\nNo VMware/VMPlayer found!\n" + writelog "No VMware/VMPlayer found!\n" exit 1 fi -writelog "\nBye.\n" +writelog "Bye.\n" exit 0 |