summaryrefslogtreecommitdiffstats
path: root/initramfs
diff options
context:
space:
mode:
authorSebastian Schmelzer2009-05-28 19:58:22 +0200
committerSebastian Schmelzer2009-05-28 19:58:22 +0200
commita018c2ce2f92dcf9ff856c66bffc59a363869d0b (patch)
treef39b0308273a72d236f31c355d681694fd00c65d /initramfs
parentnewline after echo (diff)
downloadcore-a018c2ce2f92dcf9ff856c66bffc59a363869d0b.tar.gz
core-a018c2ce2f92dcf9ff856c66bffc59a363869d0b.tar.xz
core-a018c2ce2f92dcf9ff856c66bffc59a363869d0b.zip
http/ftp wrapper for functions..
git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2891 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'initramfs')
-rw-r--r--initramfs/stage3-stuff/etc/functions40
1 files changed, 38 insertions, 2 deletions
diff --git a/initramfs/stage3-stuff/etc/functions b/initramfs/stage3-stuff/etc/functions
index 33ce5760..5bd8af96 100644
--- a/initramfs/stage3-stuff/etc/functions
+++ b/initramfs/stage3-stuff/etc/functions
@@ -322,6 +322,42 @@ tftp_get () {
return 0;
}
+
+# wget wrapper
+# usage wget_get <path> <ftp/httpserver> [count]
+# count is optional - default is 3 - use -1 for indefinit
+wget_get () {
+ local file="$1"
+ local file_server="$2"
+ local download_successful=0
+ local countdown="$3"
+
+ if [ -z "$1" -o -z "$2" ]; then
+ [ $DEBUGLEVEL -ge 1 ] && \
+ echo "[wget_get] Usage: wget_get <path> <server> [count]"
+ return 1;
+ fi
+
+ [ "$countdown" = "" ] && countdown=3
+
+ until [ $download_successful -eq 1 ]
+ do
+ if [ "$countdown" = "0" ]; then
+ [ $DEBUGLEVEL -ge 1 ] && \
+ echo "[wget_get] download of \"$file\" from \"$file_server\" ... failed"
+ return 0;
+ fi
+ wget $file -O /tmp/$(basename $file)
+ [ -s /tmp/$(basename $file) ] && download_successful=1
+ countdown=$(expr $countdown - 1)
+ usleep 200000
+ done
+ [ $DEBUGLEVEL -ge 1 ] && \
+ echo "[wget_get] download of \"$file\" from \"$file_server\" ... successful"
+ return 0;
+}
+
+
fileget () {
# normally tftp would be used, alternatively use wget for ftp or http
# if local device file is specified - mount and unmount after copying
@@ -336,8 +372,8 @@ if [ "x$filepath" != "x" ] ; then
$filepath, fileserv:$fileserv" >>$LOGFILE
case "$fileprot" in
ftp|http)
- wget $fileprot://$fileserv/$cfgfile -O /tmp/$(basename $cfgfile) \
- 2>>$LOGFILE && { unpack /tmp/$(basename $cfgfile) && break; }
+ wget_get $cfgfile $fileprot://$fileserv \
+ && { unpack /tmp/$(basename $cfgfile) && break; } 2>>$LOGFILE
;;
file)
local ldev=$fileserv