From: Will Woods Date: Thu, 16 Feb 2012 23:54:49 +0000 (-0500) Subject: url-lib: fix fetch_url return value for dotfiles X-Git-Tag: 017~28 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ed293f6d0c7199056a2c8001c44eb98846631b34;p=thirdparty%2Fdracut.git url-lib: fix fetch_url return value for dotfiles 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 --- diff --git a/modules.d/45url-lib/url-lib.sh b/modules.d/45url-lib/url-lib.sh index ad9e4448c..383e7ac22 100755 --- a/modules.d/45url-lib/url-lib.sh +++ b/modules.d/45url-lib/url-lib.sh @@ -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"