]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
url-lib: fix fetch_url return value for dotfiles
authorWill Woods <wwoods@redhat.com>
Thu, 16 Feb 2012 23:54:49 +0000 (18:54 -0500)
committerHarald Hoyer <harald@redhat.com>
Tue, 21 Feb 2012 09:11:11 +0000 (10:11 +0100)
If you do "fetch_url $url/.somefile", fetch_url would return failure,
because "$outdir/*" wouldn't match the file.

Use ls -A (which busybox ls supports) to actually find possible dotfiles
in the created output dir.

Signed-off-by: Will Woods <wwoods@redhat.com>
modules.d/45url-lib/url-lib.sh

index ad9e4448cc5dd2d0ae0c86b8308286d861959431..383e7ac22eb2777c7c136f2bf0163637abe1dc9b 100755 (executable)
@@ -60,11 +60,8 @@ curl_fetch_url() {
         curl $curl_args --output "$outloc" "$url" || return $?
     else
         local outdir="$(mkuniqdir /tmp curl_fetch_url)"
-        local cwd="$(pwd)"
-        cd "$outdir"
-        curl $curl_args --remote-name "$url" || return $?
-        cd "$cwd"
-        outloc="$(echo $outdir/*)"
+        ( cd "$outdir"; curl $curl_args --remote-name "$url" || return $? )
+        outloc="$outdir/$(ls -A $outdir)"
     fi
     [ -f "$outloc" ] || return 253
     echo "$outloc"