From 11e4e00b3464c75f6540ed74fa7bcf4663ec047c Mon Sep 17 00:00:00 2001 From: Michael Janczyk Date: Wed, 21 Apr 2010 20:18:30 +0200 Subject: clean exit and port redirect bugfix and cosmetics --- .../plugins/virtualbox/files/run-virt.include | 32 +++++++++++++--------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'os-plugins/plugins/virtualbox/files/run-virt.include') diff --git a/os-plugins/plugins/virtualbox/files/run-virt.include b/os-plugins/plugins/virtualbox/files/run-virt.include index 119b1e16..2091f79e 100644 --- a/os-plugins/plugins/virtualbox/files/run-virt.include +++ b/os-plugins/plugins/virtualbox/files/run-virt.include @@ -70,7 +70,7 @@ if echo ${imgname} | grep -qiE "vdi|vmdk|vhd" && [ ${diskless} -eq 0 ]; then imgfmt=$(echo ${imgname##*.} | tr [a-z] [A-Z]) elif [ ${diskless} -eq 0 ]; then writelog "${imgname} is not a valid image format (vdi|vmdk|vhd), exiting!" - exit 1 + cleanexit 1 fi # TODO: maybe rewrite, to reduce checks, merge it with network option, @@ -92,7 +92,7 @@ case "${vmostype}" in if [ ${vtflag} -ne 1 ]; then writelog "You are trying to boot a 64 bit OS without a VT enabled CPU" writelog "This is not supported, exiting!" - exit 1 + cleanexit 1 fi # check if host is only 32 bit, then use only 1 cpu (only 1 supported) if echo "${host_arch}" | grep -qE "i.86"; then @@ -138,12 +138,12 @@ if echo "${imgmode}" | grep -q rw; then if [ -e "${vmpath}.lock" ]; then writelog "This rw image is already in use: ${vmpath}, exiting!" writelog "Remove lock if you are sure that this is not the case" - exit 1 + cleanexit 1 # image rw? elif ! [ -w ${vmpath} ]; then writelog "You defined mode rw, but image ${vmpath} is not rw! \c" writelog "Please correct, exiting!" - exit 1 + cleanexit 1 fi # add lock touch "${vmpath}.lock" @@ -199,7 +199,7 @@ else if [ "${mem}" -lt "256" ] || [ "${hostmem}" -lt "256" ]; then writelog "Memory out of range: ${mem} MB (guest) / ${hostmem} MB (host)!" writelog "Min. 256 MB for host and guest!" - exit 1 + cleanexit 1 fi fi @@ -244,7 +244,7 @@ case ${boot} in else writelog "${virtualbox_tftpdir}/pxelinux.0 not found!" writelog "Network boot won't work, exiting!" - exit 1 + cleanexit 1 fi for i in $(ls ${virtualbox_tftpdir}); do ln -sf ${virtualbox_tftpdir}/${i} ${confdir}/TFTP/${i} @@ -258,7 +258,7 @@ case ${boot} in esac # external GUI -vrdpport="590${VM_ID}" +vrdpport=${remotedesktopport} # TODO: nur bei vmchooser # TODO: most of the following does not make much sense yet ... @@ -295,7 +295,9 @@ writelog "Diskimage:" writelog "\tMachine UUID:\t\t$machineuuid" [ ${diskless} -eq 0 ] && writelog "\tDisk UUID:\t\t$diskuuid" writelog "Virtual Hardware:" -[ ${vtflag} -eq 1 ] && writelog "\tVT enabled CPU" +writelog "\tCPU cores:\t\t${cpu_cores}\c" +[ ${vtflag} -eq 0 ] && writelog "" +[ ${vtflag} -eq 1 ] && writelog " (VT enabled CPU)" writelog "\tGuest RAM:\t\t${mem} MB" # echo nur wenn hostmem gesetzt [ -n "${hostmem}" ] && writelog "\tHost RAM:\t\t${hostmem} MB" @@ -341,8 +343,9 @@ if [ ${diskless} -eq 1 ]; then fi # define redirects -if [ -n "${redirects}" ]; then +if [ ${redirects} -ge 1 ]; then (( i=1 )) + writelog "\tGuest redirects:\t\c" while [ ${i} -le ${redirects} ]; do extradataitem='" extradataguestport="GuestPort\" value=\"${redirect_gport[$i]}\"/>" sed -i "s,, ${extradataitem}${extradataguestport}\n\ - ${extradataitem}${extradatahostport}\n\ - ${extradataitem}${extradataprotocol}\n\ - ," "${machconfig}" - writelog "\tGuest ${redirect_name[$i]} port:\t\t${redirect_hport[$i]}" + ${extradataitem}${extradatahostport}\n\ + ${extradataitem}${extradataprotocol}\n\ + ," "${machconfig}" + writelog "${tabspace}${redirect_name[$i]} port: ${redirect_hport[$i]}" + tabspace='\t\t\t\t' + (( i=$i+1 )) + done fi ################################################################################ -- cgit v1.2.3-55-g7522