summaryrefslogtreecommitdiffstats
path: root/initramfs/stage3-stuff/etc/functions
diff options
context:
space:
mode:
authorSebastian Schmelzer2008-09-24 17:13:49 +0200
committerSebastian Schmelzer2008-09-24 17:13:49 +0200
commit14d85d16d8f94117824949dd65c0d73599f37149 (patch)
treee55dc5d35ca81a3d4626098748af8c80ef267a5d /initramfs/stage3-stuff/etc/functions
parent* Installation of Kernelmodules for ATI on SuSE (diff)
downloadcore-14d85d16d8f94117824949dd65c0d73599f37149.tar.gz
core-14d85d16d8f94117824949dd65c0d73599f37149.tar.xz
core-14d85d16d8f94117824949dd65c0d73599f37149.zip
* added tftp wrapper function
git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2242 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'initramfs/stage3-stuff/etc/functions')
-rw-r--r--initramfs/stage3-stuff/etc/functions32
1 files changed, 32 insertions, 0 deletions
diff --git a/initramfs/stage3-stuff/etc/functions b/initramfs/stage3-stuff/etc/functions
index 9bb144d2..481ccf54 100644
--- a/initramfs/stage3-stuff/etc/functions
+++ b/initramfs/stage3-stuff/etc/functions
@@ -294,6 +294,38 @@ else
return 1
fi
}
+
+# tftp wrapper
+# usage tftp_get <path> <tftpdserver> [count]
+# count is optional - default is 3 - use -1 for indefinit
+function tftp_get () {
+ local file="$1"
+ local file_server="$2"
+ local download_successfull=false
+ local countdown="$3"
+
+ [ -z "$1" -o -z "$2" ] && \
+ echo "Usage: tftp_get <path> <server> [count]" &&
+ exit 0;
+
+ [ "$countdown" = "" ] && countdown=3
+
+ echo "tftp_get trying to get \"$file\" from \"$file_server\"..."
+
+ until ! [ $download_successfull ]
+ do
+ [ "$countdown" = "0" ] && return 0;
+ tftp -g -r $file -l /tmp/$(basename $file) $file_server
+ [ -s /tmp/$(basename $file) ] && download_successfull=true
+ (( countdown-- ))
+ sleep 0.2
+ ! [ "$countdown" = "0" ] && [ $download_successfull ] && \
+ echo "retry.."
+ done
+
+ return 1;
+}
+
fileget () {
# normally tftp would be used, alternatively use wget for ftp or http
# if local device file is specified - mount and unmount after copying