dracut/0041-url-lib-clean-up-output.patch

49 lines
1.6 KiB
Diff
Raw Normal View History

From 7e60091c6b1aefb52581066d9dc04fa0ecc0e5fc Mon Sep 17 00:00:00 2001
From: Will Woods <wwoods@redhat.com>
Date: Thu, 8 Mar 2012 18:03:39 -0500
Subject: [PATCH] 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
---
modules.d/45url-lib/url-lib.sh | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/modules.d/45url-lib/url-lib.sh b/modules.d/45url-lib/url-lib.sh
index 043a700..e305a68 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