summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Bauer2013-07-09 18:13:54 +0200
committerJonathan Bauer2013-07-09 18:13:54 +0200
commit2a72c50f75796abc5194302d9101ba3e7d85255c (patch)
tree8043a498f3b59164b5a1deee9560cc1b17d98559
parentAdded glibc-locale as Suse equivalent to Ubuntu language-pack-de(-base) (diff)
downloadtm-scripts-2a72c50f75796abc5194302d9101ba3e7d85255c.tar.gz
tm-scripts-2a72c50f75796abc5194302d9101ba3e7d85255c.tar.xz
tm-scripts-2a72c50f75796abc5194302d9101ba3e7d85255c.zip
[vmware/vmchooser] add quotes everywhere to allow for spaces in filenames of vm images
-rwxr-xr-xremote/modules/vmchooser/data/opt/openslx/bin/run-virt.sh54
-rw-r--r--remote/modules/vmplayer/data/etc/openslx/vmware/run-virt.include4
2 files changed, 29 insertions, 29 deletions
diff --git a/remote/modules/vmchooser/data/opt/openslx/bin/run-virt.sh b/remote/modules/vmchooser/data/opt/openslx/bin/run-virt.sh
index bf642ed0..b0672e5b 100755
--- a/remote/modules/vmchooser/data/opt/openslx/bin/run-virt.sh
+++ b/remote/modules/vmchooser/data/opt/openslx/bin/run-virt.sh
@@ -133,9 +133,9 @@ fi
##
# absolute or relative path?
-if ls ${xmlfile} 2>/dev/null | grep '/' >/dev/null 2>&1; then
- xmlpath=$(dirname ${xmlfile})
- xmlfile=$(basename ${xmlfile})
+if ls "${xmlfile}" 2>/dev/null | grep '/' >/dev/null 2>&1; then
+ xmlpath=$(dirname "${xmlfile}")
+ xmlfile=$(basename "${xmlfile}")
else
xmlpath=${vmchooser_xmlpath}
fi
@@ -184,12 +184,12 @@ writelog "Starting configuration..."
writelog "\tLogfile:\t\t${LOGFILE}"
writelog "\t/tmp info:\t\t$(df -h | grep " /tmp$" | awk '{print $2}') \c"
writelog "$(grep "/tmp " /proc/mounts | awk '{print $1" "$2" "$3" "$4}')"
-writelog "\tVM XML dir:\t\t$(dirname ${xmlfile})"
+writelog "\tVM XML dir:\t\t$(dirname "${xmlfile}")"
writelog "\tXML file:\t\t${xmlfile}"
writelog "VM config:"
# Name of the virt image
-imgname=$(grep -io '<image_name param=.*"' ${xmlfile} \
+imgname=$(grep -io '<image_name param=.*"' "${xmlfile}" \
| sed -e "s/&.*;/; /g" | awk -F '"' '{ print $2 }')
## Added for persistent support.
if [[ "$userBranchFilePath" ]]; then
@@ -198,23 +198,23 @@ fi
##
# Imagename /w full path
-if echo ${imgname} 2>/dev/null | grep -q '^/' >/dev/null 2>&1; then
- imgpath=$(dirname ${imgname})
- imgname=$(basename ${imgname})
- vmpath=${imgpath}/${imgname}
+if echo "${imgname}" 2>/dev/null | grep -q '^/' >/dev/null 2>&1; then
+ imgpath="$(dirname "${imgname}")"
+ imgname="$(basename "${imgname}")"
+ vmpath="${imgpath}/${imgname}"
# If old vmchooser binary stuff
# We do not need folder name as it is already included by vmchooser
-elif echo ${xmlfile} 2>/dev/null | grep -q '^/tmp/' >/dev/null 2>&1; then
- vmpath=$imgname
- imgname=$(basename ${imgname})
+elif echo "${xmlfile}" 2>/dev/null | grep -q '^/tmp/' >/dev/null 2>&1; then
+ vmpath="$imgname"
+ imgname="$(basename "${imgname}")"
## Added for persistent support.
elif [[ "$userBranchFilePath" ]]; then
vmpath="$userBranchFilePath"
##
# Else use same path as xml
else
- imgpath=${xmlpath}
- vmpath=${imgpath}/${imgname}
+ imgpath="${xmlpath}"
+ vmpath="${imgpath}/${imgname}"
fi
# Check if virtual machine container file exists
@@ -224,19 +224,19 @@ if ! [ -e "${vmpath}" ]; then
fi
# Name of the virt machine, sed because of Windows formatting
-vm_name=$(grep -o 'short_description param=.*"' ${xmlfile} \
+vm_name=$(grep -o 'short_description param=.*"' "${xmlfile}" \
| sed -e "s/&.*;/; /g" | awk -F '"' '{print $2}')
# If ${vm_name} not defined use ${xmlfile}
-vm_name=${vm_name:-${xmlfile%.xml}}
+vm_name="${vm_name:-${xmlfile%.xml}}"
# Define vm_shortname since vm_name can be very long
-vm_shortname=$(basename ${xmlfile%.xml} | sed -e "s, ,-,g")
+vm_shortname="$(basename "${xmlfile%.xml}" | sed -e "s, ,-,g")"
# vm_name = displayname, define for old scripts
-displayname=${vm_name}
+displayname="${vm_name}"
# image is for the following virtual machine
-xmlvirt=$(grep -o 'virtualmachine param=.*"' ${xmlfile} \
+xmlvirt=$(grep -o 'virtualmachine param=.*"' "${xmlfile}" \
| sed -e "s/&.*;/; /g" | awk -F '"' '{print $2}')
# choose the proper virtualization/emulator plugin
@@ -283,22 +283,22 @@ elif [ -z "${xmlvirt}" ]; then
fi
# Definition of the client system
-vmostype=$(grep -io '<os param=.*"' ${xmlfile} | awk -F '"' '{ print $2 }' |\
+vmostype=$(grep -io '<os param=.*"' "${xmlfile}" | awk -F '"' '{ print $2 }' |\
tr "[A-Z]" "[a-z]")
# Definition of the networking the client system is connected to
-network_kind=$(grep -io '<network param=.*"' ${xmlfile} \
+network_kind=$(grep -io '<network param=.*"' "${xmlfile}" \
| awk -F '"' '{ print $2 }' | tr "[A-Z]" "[a-z]")
-network_card=$(grep -io '<netcard param=.*"' ${xmlfile} \
+network_card=$(grep -io '<netcard param=.*"' "${xmlfile}" \
| awk -F '"' '{ print $2 }'| tr "[A-Z]" "[a-z]")
# Set redirects to 0, see vmgrid if you want to define some
redirects=0
# Serial/parallel ports defined (e.g. "ttyS0" or "autodetect")
-serial=$(grep -io '<serialport param=.*"' ${xmlfile} \
+serial=$(grep -io '<serialport param=.*"' "${xmlfile}" \
| awk -F '"' '{ print $2 }')
-parallel=$(grep -io '<parport param=.*"' ${xmlfile} \
+parallel=$(grep -io '<parport param=.*"' "${xmlfile}" \
| awk -F '"' '{ print $2 }')
writelog "\tVirtualization:\t\t$xmlvirt"
@@ -410,9 +410,9 @@ cp "$xmlfile" "/etc/openslx/vmchooser/fd-loop/config.xml"
xrandr | grep -o -E 'current\s*[0-9]+\s*x\s*[0-9]+' | cut -c 8- | sed -r 's/(\s|\t|\n)//g' | head -n 1 > "/etc/openslx/vmchooser/fd-loop/hostres.txt"
# Get all virtual machine specific stuff from the respective include file
-if [ -e /etc/openslx/${xmlvirt}/run-virt.include ] ; then
- self=${xmlvirt}
- . /etc/openslx/${xmlvirt}/run-virt.include
+if [ -e /etc/openslx/"${xmlvirt}"/run-virt.include ] ; then
+ self="${xmlvirt}"
+ . /etc/openslx/"${xmlvirt}"/run-virt.include
# start a windowmanager for easier handling
# (expect problems /w windows opening in background /w vmware without wm)
for dm in twm xfwm4 metacity openbox blackbox kwin fvwm2 ; do
diff --git a/remote/modules/vmplayer/data/etc/openslx/vmware/run-virt.include b/remote/modules/vmplayer/data/etc/openslx/vmware/run-virt.include
index 45ff2d72..0267656d 100644
--- a/remote/modules/vmplayer/data/etc/openslx/vmware/run-virt.include
+++ b/remote/modules/vmplayer/data/etc/openslx/vmware/run-virt.include
@@ -309,7 +309,7 @@ confdir=/tmp/vmware/${USER}.$$
# configfile
conffile="${confdir}/run-vmware.conf"
# diskfile
-diskfile=${vmpath}
+diskfile="${vmpath}"
# users vmware config folder
vmhome="${HOME}/.vmware"
@@ -400,7 +400,7 @@ esac
# check if ide/scsi and hwver of image
# read only the first 30 lines to be sure
-imghead=$(head -n 30 ${diskfile})
+imghead=$(head -n 30 "${diskfile}")
hddrv=$(echo "${imghead}" | grep -m1 -ia "ddb.adapterType" | awk -F '"' '{print $2}')
hwver=$(echo "${imghead}" | grep -m1 -ia "ddb.virtualHWVersion" | awk -F '"' '{print $2}')
case "${hddrv}" in