]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
refactor(url-lib): write curl output directly to file
authorDavid Tardon <dtardon@redhat.com>
Mon, 8 Aug 2022 11:42:51 +0000 (13:42 +0200)
committerJóhann B. Guðmundsson <johannbg@gmail.com>
Fri, 12 Aug 2022 10:15:04 +0000 (10:15 +0000)
The redirection to stdout was originally added to workaround
https://bugzilla.redhat.com/show_bug.cgi?id=989133 (curl would create no
file if the source was empty), but I don't see that problem with current
curl.

A nice side-effect of this change is that curl shows download progress.

modules.d/45url-lib/url-lib.sh

index e88fbc14848108235d3337171da0a0491a7f41c7..b009fd097792a1d70aa4db21aac7038fb6542c70 100755 (executable)
@@ -67,7 +67,7 @@ curl_fetch_url() {
     echo "$url" > /proc/self/fd/0
     if [ -n "$outloc" ]; then
         # shellcheck disable=SC2086
-        curl $curl_args --output - -- "$url" > "$outloc" || return $?
+        curl $curl_args --output "$outloc" -- "$url" || return $?
     else
         local outdir
         outdir="$(mkuniqdir /tmp curl_fetch_url)"
@@ -101,7 +101,7 @@ ctorrent_fetch_url() {
     echo "$url" > /proc/self/fd/0
     if [ -n "$outloc" ]; then
         # shellcheck disable=SC2086
-        curl $curl_args --output - -- "$url" > "$torrent_outloc" || return $?
+        curl $curl_args --output "$torrent_outloc" -- "$url" || return $?
     else
         local outdir
         outdir="$(mkuniqdir /tmp torrent_fetch_url)"