From: Will Woods Date: Thu, 8 Mar 2012 23:03:39 +0000 (-0500) Subject: url-lib: clean up output X-Git-Tag: 018~58 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7e60091c6b1aefb52581066d9dc04fa0ecc0e5fc;p=thirdparty%2Fdracut.git url-lib: clean up output For curl_fetch_url (http/https/ftp): - use --progress-bar (the output is less messy) - print the URL we're fetching so the user know's what's happening For curl and nfs: - don't echo the filename if it was provided by the user --- diff --git a/modules.d/45url-lib/url-lib.sh b/modules.d/45url-lib/url-lib.sh index 043a700ff..e305a68a5 100755 --- a/modules.d/45url-lib/url-lib.sh +++ b/modules.d/45url-lib/url-lib.sh @@ -53,9 +53,10 @@ add_url_handler() { export CURL_HOME="/run/initramfs/url-lib" mkdir -p $CURL_HOME -curl_args="--location --retry 3 --fail --show-error" +curl_args="--location --retry 3 --fail --show-error --progress-bar" curl_fetch_url() { local url="$1" outloc="$2" + echo "$url" > /proc/self/fd/0 if [ -n "$outloc" ]; then curl $curl_args --output "$outloc" "$url" || return $? else @@ -64,7 +65,7 @@ curl_fetch_url() { outloc="$outdir/$(ls -A $outdir)" fi [ -f "$outloc" ] || return 253 - echo "$outloc" + if [ -z "$2" ]; then echo "$outloc" ; fi } add_url_handler curl_fetch_url http https ftp @@ -110,6 +111,6 @@ nfs_fetch_url() { cp -f "$mntdir/$filename" "$outloc" || return $? fi [ -f "$outloc" ] || return 253 - echo "$outloc" + if [ -z "$2" ]; then echo "$outloc" ; fi } command -v nfs_to_var >/dev/null && add_url_handler nfs_fetch_url nfs nfs4