Commit 3386818e authored by Matt Smith's avatar Matt Smith Committed by Natanael Copa
Browse files

abuild: created 'saveas-*://' URI support

'saveas-*://' URI support has been created for use with the source= line of

It allows for a remote source file to be saved with an arbitrary filename.  This
is useful in situations where the last component of the URI is not the preferred

Here's how it works.  Say we have the following URI:

Both Busybox Wget and GNU Wget will save this with the filename:


To get around this, we could use cURL to save the file using the filename in the
HTTP response headers:

  $ curl -JO ""

Or we could use this 'saveas' hack.  Essentially, the original URI is converted
to read:


In the download process, the 'saveas-' portion is removed, and the file is
downloaded from the original URI, but is saved with the filename being the last
component of the URI.  In this case, it will be saved as 'software-1.0.tar.gz'.

It is designed so that it works with any protocol supported by abuild.
For example:


Check it out and let me know what you think.

parent d4973fad
......@@ -179,7 +179,14 @@ uri_fetch() {
# we need GNU wget for this
case "$uri" in
https://*) opts="--no-check-certificate";;
*https://*) opts="--no-check-certificate";;
# fix saveas-*://* URIs
case "$uri" in
# remove 'saveas-' from beginning and
# '/filename' from end of URI
saveas-*://*) uri="${uri:7:$(expr ${#uri} - 7 - ${#d} - 1)}";;
mkdir -p "$SRCDEST"
......@@ -194,7 +201,7 @@ uri_fetch() {
is_remote() {
case "$1" in
return 0;;
return 1
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment