From 86feb9d871595f4c1efe4e521ba2cdae021aa59b Mon Sep 17 00:00:00 2001 From: Dirk von Suchodoletz Date: Wed, 18 Feb 2009 21:49:44 +0000 Subject: More on the new virtualization starter framework. git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2609 95ad53e4-c205-0410-b2fa-d234c58c8868 --- os-plugins/plugins/vmchooser/files/run-virt.sh | 65 +++++++------------------- 1 file changed, 16 insertions(+), 49 deletions(-) (limited to 'os-plugins/plugins/vmchooser/files/run-virt.sh') diff --git a/os-plugins/plugins/vmchooser/files/run-virt.sh b/os-plugins/plugins/vmchooser/files/run-virt.sh index 29f41477..7cb8b36b 100644 --- a/os-plugins/plugins/vmchooser/files/run-virt.sh +++ b/os-plugins/plugins/vmchooser/files/run-virt.sh @@ -26,13 +26,17 @@ # test if the xml path/file is valid (gotten via commandline first parameter) xml=$1 -[ -e "${xml}" ] && echo -e "\n\tNo XML file given!\n" && exit 1 +[ -e "${xml}" ] || { echo -e "\n\tNo XML file given!\n" && exit 1; } + +# path to the xml file(just take the path to the xml file) +imagepath=${xml%/*} # Read needed variables from XML file ############################################################################### # file name of the image imagename=$(grep -i "&1) - writelog "Filecheck:\n${filecheck}\n" - #TODO: don't understand the sence in it - noimage=$(echo ${filecheck} | grep -i "no such file or directory" | wc -l) - rightsfile=${diskfile} - - # check if link - # TODO: mistake with 2nd rightsfile if its in another directory? - if [ -L "${diskfile}" ]; then - # take link target - rightsfile=$(ls -lh ${diskfile} 2>&1 | awk -F "-> *" '{print $2}') - rightsfile=${vmdir}/${rightsfile} - filecheck=$(LANG=us ls -lh ${rightsfile} 2>&1) - fi - - # does file exist - if [ "${noimage}" -ge "1" ]; then - writelog "Vmware Image Problem:\c " - writelog "\tThe image you've specified doesn't exist." - writelog "Filecheck says:\c " - writelog "\t\t${diskfile}:\n\t\t\tNo such file or directory" - writelog "Hint:\c " - writelog "\t\t\tCompare spelling of the image with your options.\n" - exit 1 - fi - - # readable? - if ! [ -r "${diskfile}" >/dev/null 2>&1 \ - -o -r "${diskfile}" >/dev/null 2>&1 ]; then - writelog "Vmware Image Problem:\c " - writelog "\tThe image you've specified has wrong rights." - writelog "Filecheck says:\t\t$(echo ${filecheck} \ - | awk '{print $1" "$3" "$4}') ${rightsfile}" - writelog "Hint:\t\t\tChange rights with: chmod a+r ${rightsfile}\n" - exit 1 - fi - - # writable (for persistent-mode)? - if ! [ -w "${diskfile}" >/dev/null 2>&1 \ - -o -w "${diskfile}" >/dev/null 2>&1 ] \ - && [ "${np}" = "independent-persistent" ]; then - writelog "Vmware Image Problem:\c " - writelog "\tThe image you have specified has wrong rights." - writelog "Filecheck says:\t\t$(echo ${filecheck} \ - | awk '{print $1" "$3" "$4}') ${rightsfile}" - writelog "Hint:\t\t\tUse nonpersistent-mode or change rights to rw\n" - exit 1 - fi + #filecheck=$(LANG=us ls -lh ${diskfile} 2>&1) + #writelog "Filecheck:\n${filecheck}\n" + : } +# function to write to stdout and logfile +writelog () +{ + # write to stdout + echo -e "$1" + # log into file + echo -e "$1" >>run-virt.log +} # setup the rest of the environment and run the virtualization tool just confi- # gured -- cgit v1.2.3-55-g7522