Fix fetch_file() function
Make sure that the 'sa' variable is defined after the 'saveas' variable,
which it depends on.
Otherwise, invokations of fetch_file() which do not specify any 'saveas'
variable get an empty 'sa' variable. This wasn't a big problem back when
we were using wget to fetch the file but it is now that we've switched
to curl. curl writes its output to stdout by default so it is crucial to
pass it the '-o' option (through the 'sa' variable) to get the desired
behaviour.
Change-Id: I2d8c0bfbf175f0fb64b61195c5e3cb09ac573f27
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
diff --git a/utils.sh b/utils.sh
index 1643543..ffbbda9 100644
--- a/utils.sh
+++ b/utils.sh
@@ -123,8 +123,8 @@
local saveas
if is_url "$url"; then
- sa="${saveas+-o $saveas}"
saveas="${saveas-"$(basename "$url")"}"
+ sa="${saveas+-o $saveas}"
echo "Fetch: $url -> $saveas"
# Use curl to support file protocol
curl -sLS $sa "$url"