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 <wwoods@redhat.com>
This commit is contained in:
Will Woods 2012-02-16 18:54:49 -05:00 committed by Harald Hoyer
parent cd9592385d
commit ed293f6d0c

View File

@ -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"