From ff9a6ac01ea0595947e2425fd1493a5b5f978c9f Mon Sep 17 00:00:00 2001 From: Volker Uhrig Date: Tue, 8 May 2007 18:00:10 +0000 Subject: Dozen of bug fixes, some new files we really need. Now its documented in the source why we need some stuff... ;-) Should run now without bigger problemlos. git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1032 95ad53e4-c205-0410-b2fa-d234c58c8868 --- virtualization/menulist-creator | 34 ++++++--- virtualization/templates/client-config.xml.default | 8 +++ virtualization/templates/fd.img | Bin 0 -> 1474560 bytes virtualization/templates/nvram.5.0 | Bin 0 -> 8664 bytes virtualization/templates/runvmware-v2 | 77 +++++++++++---------- 5 files changed, 73 insertions(+), 46 deletions(-) create mode 100644 virtualization/templates/client-config.xml.default create mode 100644 virtualization/templates/fd.img create mode 100644 virtualization/templates/nvram.5.0 (limited to 'virtualization') diff --git a/virtualization/menulist-creator b/virtualization/menulist-creator index e23f762a..087baa92 100755 --- a/virtualization/menulist-creator +++ b/virtualization/menulist-creator @@ -24,11 +24,14 @@ # Just needed if vmdir is somewhere else vmdir="." && cd ${vmdir} +# were is vmdir, after we mountet this folder? +vmexecdir="/var/lib/vmware" + # template for runvmware templatevmware="${vmdir}/templates/runvmware-v2" # delete all priority files -rm -rf ${vmdir}/runscripts/${i}/[0-9]_*.runvmware +rm -rf ${vmdir}/runscripts/${i}/[0-9]_*.vmware # Take all xml files and work with them for xml in *.xml;do @@ -69,16 +72,23 @@ for xml in *.xml;do # active when active=1 image, else disabled active=$(grep -i "> ${vmdir}/xdmsessions/${i}/${image}.desktop echo "Type=XSession" >> ${vmdir}/xdmsessions/${i}/${image}.desktop #TODO: Fix path - echo "Exec=/path/to/the/execfile/${image}" \ + echo "Exec=${vmexecdir}/runscripts/${i}/${image}" \ >> ${vmdir}/xdmsessions/${i}/${image}.desktop echo "Name=${short_description}" \ >> ${vmdir}/xdmsessions/${i}/${image}.desktop @@ -227,18 +237,19 @@ for xml in *.xml;do -e "s/vmostype=\"CHANGEIT\"/vmostype=\"${os}\"/" \ -e "s/network=\"CHANGEIT\"/network=\"${network}\"/" \ ${templatevmware} \ - > ${vmdir}/runscripts/${i}/${image}.runvmware + > ${vmdir}/runscripts/${i}/${image}.vmware + chmod 755 ${vmdir}/runscripts/${i}/${image}.vmware # If we have a priority defined we rename the file if [ ${priority} ]; then - mv ${vmdir}/runscripts/${i}/${image}.runvmware \ - ${vmdir}/runscripts/${i}/${priority}_${image}.runvmware + mv ${vmdir}/runscripts/${i}/${image}.vmware \ + ${vmdir}/runscripts/${i}/${priority}_${image}.vmware fi # Xdialog menu entrys - echo -e "\"${vmdir}/runscripts/${i}/${image}.vmware\" \\ + echo -e "\"${vmexecdir}/runscripts/${i}/${image}.vmware\" \\ \"${short_description}\" \\ \"${long_description}\" \\" \ > ${vmdir}/xdialog-files/${i}/${image}.xdialog @@ -259,6 +270,7 @@ for i in ${vmdir}/xdialog-files/*; do cat ${i}/*.xdialog >> ${i}/xdialog.sh #closing bracket as last line invoked with \ echo ")" >> ${i}/xdialog.sh + chmod 755 ${i}/xdialog.sh done diff --git a/virtualization/templates/client-config.xml.default b/virtualization/templates/client-config.xml.default new file mode 100644 index 00000000..f1612fc9 --- /dev/null +++ b/virtualization/templates/client-config.xml.default @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/virtualization/templates/fd.img b/virtualization/templates/fd.img new file mode 100644 index 00000000..7c47c615 Binary files /dev/null and b/virtualization/templates/fd.img differ diff --git a/virtualization/templates/nvram.5.0 b/virtualization/templates/nvram.5.0 new file mode 100644 index 00000000..85125f1e Binary files /dev/null and b/virtualization/templates/nvram.5.0 differ diff --git a/virtualization/templates/runvmware-v2 b/virtualization/templates/runvmware-v2 index e3e9e6b2..36260e7d 100644 --- a/virtualization/templates/runvmware-v2 +++ b/virtualization/templates/runvmware-v2 @@ -32,7 +32,14 @@ mem= totalmem= permem=66 -# virtual cd/dvd and drive devices +# virtual fd/cd/dvd and drive devices, floppy b: for configuration +if [ ! -d /sys/block/fd0 ]; then + floppya="FALSE" +else + floppya="TRUE" +fi +floppyb="TRUE" +floppybname="/etc/vmware/loopimg/fd.img" cdr_1="FALSE" cdr_2="FALSE" ide="TRUE" @@ -45,7 +52,6 @@ xres=$(echo "${hostres}" | awk '{print $3}') yres=$(echo "${hostres}" | awk '{print $7}') # VMplayer buildversion -tmp_vmbuild= vmbuild= # VMware start options @@ -94,7 +100,7 @@ filecheck= # vmware image file imagename="CHANGEIT" -diskfile="${vmdir}/$imagename" +diskfile="${vmdir}/${imagename}" #TODO: check for a faster way, perhaps we should put this into XML #grepping every file could take much (network) resources. And if its @@ -114,7 +120,7 @@ elif [ "${hddrv}" = "buslogic" ]; then fi # define name for VMware window -displayname="CHANGIT" +displayname="CHANGEIT" # Definition of the client system vmostype="CHANGEIT" @@ -227,9 +233,6 @@ runvmwareconfheader () ###### ide-disks ############################################################# ide0:0.mode = \"${np}\" - #volker.currentchage - #ide0:0.present = \"TRUE\" - #ide0:0.fileName = \"${tmpdir}/disk\" ide0:0.present = \"${ide}\" ide0:0.fileName = \"${diskfile}\" @@ -248,7 +251,7 @@ runvmwareconfheader () scsi0.virtualDev = \"lsilogic\" scsi0:0.mode = \"${np}\" scsi0:0.present = \"${scsi}\" - scsi0:0.fileName = \"${diskfile}\ + scsi0:0.fileName = \"${diskfile}\" ###### nics ################################################################## ethernet0.present = \"TRUE\" @@ -264,6 +267,16 @@ runvmwareconfheader () usb.present = \"TRUE\" usb.generic.autoconnect = \"TRUE\" + ###### floppies ############################################################## + floppy0.present = \"${floppya}\" + floppy0.fileName = \"auto detect\" + + # we need floppy b: this for our windows client configuration + floppy1.present = \"${floppyb}\" + floppy1.fileType = \"file\" + floppy1.fileName = \"${floppybname}\" + floppy1.startConnected = \"TRUE\" + ###### ports ################################################################# parallel0.present = \"FALSE\" @@ -346,12 +359,10 @@ preferencesheader () writelog () { # write to stdout - # TODO: echo -e - echo "$1" + echo -e "$1" # log in file - # TODO: echo -e - echo "$1" >>${tmpdir}/runvmware.${USER}.log + echo -e "$1" >>${tmpdir}/runvmware.${USER}.log } @@ -393,7 +404,7 @@ EOL writelog "##################################################\n" writelog "# File created by $0 (v.${version})\n# on $(date)\n" writelog "##################################################\n" -writelog "Starting...$(echo ${np} | sed -e \"s/i.*-//g\" \ +writelog "Starting...$(echo ${np} | sed 's/i.*-//g' \ | tr [a-z] [A-Z])-mode\n" ## log disksetup @@ -416,11 +427,9 @@ 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 -writelog "DEBUG: $totalmem, $permem\n" # calculate memory for vmplayer # TODO: unhappy how it is calculated -mem=$(expr ${totalmem} / 100 * ${permem} / 4*4) +mem=$(expr ${totalmem} / 100 \* ${permem} / 4 \* 4) # check memory range memtest=${totalmem}-128 @@ -452,21 +461,12 @@ writelog "finished\nResults:\n\tDiskfile:\t${diskfile}\n\tDisktype:\t${hddrv} filecheck # VMPlayer Version. -# Takes much time/resources, so we try to decrease it check first if -# vmware is installed and has a build number in config if not then check -# if we have an own configuration produces by servconfig -# in worst case use the slow old option -#TODO: build in the boot script -tmp_vmbuild=$(grep "product.buildnumber" /etc/vmware/config ) -if [ -n ${tmp_vmbuild} ]; then - vmbuild=$(echo ${tmp_vmbuild} | awk -F "\"" '{print $2}') -else - tmp_vmbuild=$(grep "product.buildnumber" /etc/vmware/buildnumber) - if [ -n ${tmp_vmbuild} ]; then - vmbuild=$(echo ${tmp_vmbuild} | awk -F "\"" '{print $2}') - else - vmbuild=$(vmplayer -v | awk -F "-" '{print $2}') - fi +# strings is the fastest and most secure way, vmplayer -v takes too much time +# and resources +vmbuild=$(strings /usr/lib/vmware/bin/vmplayer \ + | grep Releasebuild-|sed 's/.*Releasebuild-//') +if [ ! -n ${vmbuild} ]; then + vmbuild=$(vmplayer -v | sed 's/.*build-//') fi ### write configuration files ################################################## @@ -476,10 +476,17 @@ preferencesheader # create VMware startup file runvmwareconfheader -# Tricky, perhaps i need the winconfig for login/hostinformation -# include file which is given via command line -#TODO: include variable not present anymore. $include was a file -#[ -n "${include}" ] && . ${include} +# poolconfiguration config.xml +#TODO: change default to global variable ${POOL} in the future +sed -e "s/HOSTNAME/${hostname}/" \ + -e "s/USER/${USER}/" /var/lib/vmware/templates/client-config.xml.default \ + > /etc/vmware/fd-loop/config.xml + +# sync is needed to ensure that data is really written to virtual disk +sync + +# own nvram. We need it for floppy drive b, default nvram has just drive a +cp /var/lib/vmware/templates/nvram.5.0 ${tmpdir}/nvram # adjust volume writelog "Unmuting sound...\c" -- cgit v1.2.3-55-g7522