[PATCH] url-lib: fix fetch_url return value for dotfiles

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 modules.d/45url-lib/url-lib.sh |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/modules.d/45url-lib/url-lib.sh b/modules.d/45url-lib/url-lib.sh
index ddebdc9..7b669f4 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"
-- 
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux