summaryrefslogtreecommitdiffstats
path: root/virtualization
diff options
context:
space:
mode:
authorVolker Uhrig2007-05-08 20:00:10 +0200
committerVolker Uhrig2007-05-08 20:00:10 +0200
commitff9a6ac01ea0595947e2425fd1493a5b5f978c9f (patch)
tree0d8e58be017cde56d1a8504611ca4aef04952233 /virtualization
parentThe rootfilesystem has to be exported "no_root_squash" otherwise certain (diff)
downloadcore-ff9a6ac01ea0595947e2425fd1493a5b5f978c9f.tar.gz
core-ff9a6ac01ea0595947e2425fd1493a5b5f978c9f.tar.xz
core-ff9a6ac01ea0595947e2425fd1493a5b5f978c9f.zip
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
Diffstat (limited to 'virtualization')
-rwxr-xr-xvirtualization/menulist-creator34
-rw-r--r--virtualization/templates/client-config.xml.default8
-rw-r--r--virtualization/templates/fd.imgbin0 -> 1474560 bytes
-rw-r--r--virtualization/templates/nvram.5.0bin0 -> 8664 bytes
-rw-r--r--virtualization/templates/runvmware-v277
5 files changed, 73 insertions, 46 deletions
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 "<active param=\"true\"" ${xml} | wc -l)
+ #TODO: perhaps we should force an active flag, too
+
# get list where the current image should be used
pools=$(grep -i "<pools param=\"" ${xml} | awk -F "\"" '{ print $2 }')
+
+ # we need the pool configuration
+ if ! [ "${pools}" ]; then
+ echo "PANIC, pools not correct defined in ${xml}"
+ exit 0
+ fi
+
-
# Virtualmachine (vmware or virtualbox)?
vm=$(grep -i "<virtualmachine param=\"" ${xml} | awk -F "\"" '{ print $2 }')
# Test if correct defined
if [ "${vm}" != "vbox" -a "${vm}" != "vmware" ]; then
- # TODO: Test
echo "PANIC, virtualmachine not correct defined in ${xml}"
exit 0
fi
@@ -111,7 +121,7 @@ for xml in *.xml;do
# os running in vmware?
os=$(grep -i "<os param=\"" ${xml} | awk -F "\"" '{ print $2 }')
- if [ "${os}" != "Linux" -a "${os}" != "Windows XP" ]; then
+ if [ "${os}" != "Linux" -a "${os}" != "winxppro" -a "${os}" != "Windows 2000" ]; then
# TODO: test
echo "PANIC, OS in virtual machine not correct defined in ${xml}"
exit 0
@@ -163,7 +173,7 @@ for xml in *.xml;do
fi
# check if ${vmdir}/xdmsessions/ for .desktop files is available
- if [ ! -d ${vmdir}/xdmsessions ]; then
+ if [ ! -d ${vmdir}/xdialog-files ]; then
mkdir ${vmdir}/xdialog-files
fi
@@ -191,7 +201,7 @@ for xml in *.xml;do
# ... create desktopentry
- if [ ${active} -eq 1 -a ${xdm} = "true"]; then
+ if [ ${active} -eq 1 -a ${xdm} = "true" ]; then
# create desktopentry
echo -e "\nCreating runfiles for ${image} and pool ${i}\n"
@@ -205,7 +215,7 @@ for xml in *.xml;do
echo "Encoding=UTF-8" >> ${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 @@
+<settings>
+ <eintrag>
+ <computername param="HOSTNAME">
+ </computername>
+ <username param="USER">
+ </username>
+ </eintrag>
+</settings>
diff --git a/virtualization/templates/fd.img b/virtualization/templates/fd.img
new file mode 100644
index 00000000..7c47c615
--- /dev/null
+++ b/virtualization/templates/fd.img
Binary files differ
diff --git a/virtualization/templates/nvram.5.0 b/virtualization/templates/nvram.5.0
new file mode 100644
index 00000000..85125f1e
--- /dev/null
+++ b/virtualization/templates/nvram.5.0
Binary files 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"