From 00a02c9dff76a1416c51c58b9514e520c3f633ec Mon Sep 17 00:00:00 2001 From: Michael Janczyk Date: Mon, 15 May 2006 15:43:11 +0000 Subject: few changes, testcommit git-svn-id: http://svn.openslx.org/svn/openslx/ld4@212 95ad53e4-c205-0410-b2fa-d234c58c8868 --- vmware/runvmware | 108 ++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 76 insertions(+), 32 deletions(-) (limited to 'vmware/runvmware') diff --git a/vmware/runvmware b/vmware/runvmware index 33a15976..bd59e10d 100755 --- a/vmware/runvmware +++ b/vmware/runvmware @@ -4,10 +4,13 @@ # X Stations (v4) # # Author(s): Dirk von Suchodoletz , 18-03-2006 -# Michael Janczyk , 21-04-2006 +# Michael Janczyk , 15-05-2006 # Copyright: (c) 2003, 2006 - RZ Universitaet Freiburg # -version=0.14a; last_changes=21-04-06 +last_changes=$(head $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=0.14.c ################################################################################ @@ -66,10 +69,12 @@ runvmwareconfheader () { ###### sound ################################################################# sound.present = \"TRUE\" + sound.virtualDev = \"es1371\" ###### usb ################################################################### usb.present = \"TRUE\" + usb.generic.autoconnect = \"TRUE\" ###### floppies ############################################################## @@ -102,9 +107,21 @@ runvmwareconfheader () { ###### misc ################################################################## tmpDirectory = \"${tmpdir}\" mainMem.useNamedFile = \"FALSE\" - tools.syncTime = \"FALSE\" + tools.syncTime = \"TRUE\" redoLogDir = \"${tmpdir}\" - + hints.hideAll = \"TRUE\" + logging = \"FALSE\" + isolation.tools.hgfs.disable = \"FALSE\" + isolation.tools.dnd.disable = \"TRUE\" + isolation.tools.copy.enable = \"TRUE\" + isolation.tools.paste.enabled = \"TRUE\" + gui.restricted = \"TRUE\" + pref.hotkey.shift = \"TRUE\" + pref.hotkey.control = \"TRUE\" + pref.hotkey.alt = \"TRUE\" + svga.maxWidth = \"${xres}\" + svga.maxHeight = \"${yres}\" + " \ >${confile} @@ -160,13 +177,20 @@ memgig= permem=66 # virtual devices cdr_1="FALSE" -cdr_1_name="/dev/cdrom1" +cdr_1_name="/dev/cdrom" cdr_2="FALSE" -cdr_2_name="/dev/cdrom2" +cdr_2_name="/dev/cdrom1" floppya="FALSE" floppyb="FALSE" # place for the virtual floppy "B:" floppybname="/tmp/${clientip}-fd0.img" +# resolution +hostres=$(xvidtune -show | grep -ve "^$") +xres=$(echo "${hostres}" | awk '{print $3}') +yres=$(echo "${hostres}" | awk '{print $7}') +guestres= +g_xres= +g_yres= # VMware variables @@ -257,6 +281,7 @@ Image options: --silent no stdout from runvmware --mem override autoallocation of memory, in percent m,M megabyte, g,G gigabyte, h,H reserve f. host + --res Maximum resolution of the guest os, e.g. 800x600 --delay delay the start of the script n seconds --image specify image directory --persistent use persistent mode @@ -317,7 +342,7 @@ checkalias () { x_dialog () { - desktops=( `ls ${vmsessions} | grep -x ".*desktop" 2>/dev/null` ) + desktops=( `ls ${vmsessions}/*.desktop 2>/dev/null` ) desktopsnr=$(echo "${#desktops[*]}") (( args=0 )) declare -i i=0 @@ -392,27 +417,27 @@ filecheck () { fi # readable? -# if [ `/bin/test -r "${diskfile}" >/dev/null 2>&1 \ -# || /usr/bin/test -r "${diskfile}" >/dev/null 2>&1` ]; then -# writelog "Vmware Image Problem:\c" 0 1 -# writelog "\tThe image you've specified has wrong rights." 0 1 -# writelog "Filecheck says:\t\t`echo ${filecheck} \ -# | awk '{print $1" "$3" "$4}'` ${rightsfile}" 0 1 -# writelog "Hint:\t\t\tChange rights with: chmod a+r ${rightsfile}\n" 0 0 -# exit 1 -# fi -# + if ! [ -r "${diskfile}" >/dev/null 2>&1 \ + -o -r "${diskfile}" >/dev/null 2>&1 ]; then + writelog "Vmware Image Problem:\c" 0 1 + writelog "\tThe image you've specified has wrong rights." 0 1 + writelog "Filecheck says:\t\t`echo ${filecheck} \ + | awk '{print $1" "$3" "$4}'` ${rightsfile}" 0 1 + writelog "Hint:\t\t\tChange rights with: chmod a+r ${rightsfile}\n" 0 0 + exit 1 + fi + # writable (for persistent-mode)? -# if [ `/bin/test -w "${diskfile}" >/dev/null 2>&1 \ -# || /usr/bin/test -w "${diskfile}" >/dev/null 2>&1` ] \ -# && [ "${np}" = "independent-persistent" ]; then -# writelog "Vmware Image Problem:\c" 0 1 -# writelog "\tThe image you've specified has wrong rights." 0 1 -# writelog "Filecheck says:\t\t`echo ${filecheck} \ -# | awk '{print $1" "$3" "$4}'` ${rightsfile}" 0 1 -# writelog "Hint:\t\t\tUse nonpersistent-mode or change rights to rw" 0 0 -# exit 1 -# fi + if ! [ -w "${diskfile}" >/dev/null 2>&1 \ + -o -w "${diskfile}" >/dev/null 2>&1 ] \ + && [ "${np}" = "independent-persistent" ]; then + writelog "Vmware Image Problem:\c" 0 1 + writelog "\tThe image you've specified has wrong rights." 0 1 + writelog "Filecheck says:\t\t`echo ${filecheck} \ + | awk '{print $1" "$3" "$4}'` ${rightsfile}" 0 1 + writelog "Hint:\t\t\tUse nonpersistent-mode or change rights to rw" 0 0 + exit 1 + fi } @@ -482,6 +507,10 @@ while [ ${nofclopt} -gt "${args}" ]; do (( args=${args}+1 )) memopt=${lineopts[${args}]} ;; + --res) + (( args=${args}+1 )) + guestres=${lineopts[${args}]} + ;; --run) (( args=${args}+1 )) vmrun=${lineopts[${args}]} @@ -602,18 +631,18 @@ fi # check memory range memtest=${memtest}-128 if [ "${mem}" -lt "128" ] || [ "${mem}" -gt "${memtest}" ]; then - writelog "\n\n\tYour memory is out of range: ${mem} MB.\n\ + writelog "\n\n\tYour memory is out of range: ${mem} MB. \tMin. 128 MB for host and guest!\n\tTry --mem option.\n" 0 1 exit 1 fi # look for cdrom,dvd and floppy and add them to the vm config file -if [ -L /dev/cdrom1 ] ; then +if [ -L /dev/cdrom ] ; then cdr_1="TRUE" fi -if [ -L /dev/cdrom2 ] ; then +if [ -L /dev/cdrom1 ] ; then cdr_2="TRUE" fi @@ -622,8 +651,23 @@ fi [ -d /sys/block/fd0 ] && floppya="TRUE" -writelog "finished\nResults:\n\tMAC=00:50:56:0D:${mac}\n\tMem=${mem} MB" 0 1 -writelog "\tCD-ROM_1=${cdr_1}\n\tCD-ROM_2=${cdr_2}\n" 0 1 +# guest resolution +if [ -n "${guestres}" ]; then + g_xres=$(echo "${guestres}" | awk -F "x" '{print $1}') + g_yres=$(echo "${guestres}" | awk -F "x" '{print $2}') + if [ "${g_xres}" -ge "640" -a "${g_xres}" -le "${xres}" \ + -a "${g_yres}" -ge "480" -a "${g_yres}" -le "${yres}" ]; then + xres=${g_xres} + yres=${g_yres} + else + writelog "\n\n\tSpecified resolution is not in range! + \tRange: 640x480 - ${xres}x${yres} + \tJumping back to resolution of Host.\n" + fi +fi + +writelog "finished\nResults:\n\tMAC=00:50:56:0D:${mac}\n\tMem=${mem} MB + \tResolution=${xres}x${yres}\n\tCD-ROM_1=${cdr_1}\n\tCD-ROM_2=${cdr_2}\n" 0 1 -- cgit v1.2.3-55-g7522