From bfac9d6e56ee14b6ad5e9ff524f1215e8edc134f Mon Sep 17 00:00:00 2001 From: Sebastian Schmelzer Date: Wed, 24 Sep 2008 17:19:16 +0000 Subject: * changed fileget() to use tftp wrapper function git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2244 95ad53e4-c205-0410-b2fa-d234c58c8868 --- initramfs/stage3-stuff/etc/functions | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'initramfs/stage3-stuff/etc/functions') diff --git a/initramfs/stage3-stuff/etc/functions b/initramfs/stage3-stuff/etc/functions index a0f1c6c5..e71a9815 100644 --- a/initramfs/stage3-stuff/etc/functions +++ b/initramfs/stage3-stuff/etc/functions @@ -301,29 +301,29 @@ fi tftp_get () { local file="$1" local file_server="$2" - local download_successfull=false + local download_successful=0 local countdown="$3" [ -z "$1" -o -z "$2" ] && \ - echo "Usage: tftp_get [count]" && - return 0; + echo "[tftp_get] Usage: tftp_get [count]" && + return 1; [ "$countdown" = "" ] && countdown=3 - echo "tftp_get trying to get \"$file\" from \"$file_server\"..." + echo "[tftp_get] trying to get \"$file\" from \"$file_server\"..." - until ! [ $download_successfull ] + until [ $download_successful -eq 1 ] do - [ "$countdown" = "0" ] && return 0; + [ "$countdown" = "0" ] && echo "[tftp_get] ..failed!" && return 0; tftp -g -r $file -l /tmp/$(basename $file) $file_server - [ -s /tmp/$(basename $file) ] && download_successfull=true + [ -s /tmp/$(basename $file) ] && download_successful=1 countdown=`expr $countdown - 1` usleep 200000 - ! [ "$countdown" = "0" ] && [ $download_successfull ] && \ - echo "retry.." + ! [ "$countdown" = "0" ] && [ $download_successful -eq 0 ] && \ + echo "[tftp_get] retry.." done - - return 1; + echo "[tftp_get] ..successful!" + return 0; } fileget () { @@ -352,7 +352,7 @@ $filepath, fileserv:$fileserv" >>$LOGFILE umount /dev/$ldev ;; *) - tftp -g -r $cfgfile -l /tmp/$(basename $cfgfile) $fileserv \ + tftp_get $cfgfile $fileserv \ && unpack /tmp/$(basename $cfgfile) 2>>$LOGFILE ;; esac @@ -375,7 +375,7 @@ $filepath, fileserv:$fileserv" >>$LOGFILE 2>>$LOGFILE && { unpack /tmp/$(basename $cfgfile) && break; } ;; tftp) - tftp -g -r $cfgfile -l /tmp/$(basename $cfgfile) $fileserv \ + tftp_get $cfgfile $fileserv \ 2>>$LOGFILE && { unpack /tmp/$(basename $cfgfile) && break; } ;; esac -- cgit v1.2.3-55-g7522