makepkg: add function to return download protocol
Extract the download protocol from a source entry. Returns "local" for local source files. Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
e806414407
commit
a922d18056
1 changed files with 11 additions and 0 deletions
|
@ -224,6 +224,17 @@ get_url() {
|
||||||
printf "%s\n" "${1#*::}"
|
printf "%s\n" "${1#*::}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# extract the protocol from a source entry - return "local" for local sources
|
||||||
|
get_protocol() {
|
||||||
|
if [[ $1 = *://* ]]; then
|
||||||
|
# strip leading filename
|
||||||
|
local proto="${1##*::}"
|
||||||
|
printf "%s\n" "${proto%%://*}"
|
||||||
|
else
|
||||||
|
printf "%s\n" local
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
get_downloadclient() {
|
get_downloadclient() {
|
||||||
# $1 = URL with valid protocol prefix
|
# $1 = URL with valid protocol prefix
|
||||||
local url=$1
|
local url=$1
|
||||||
|
|
Loading…
Add table
Reference in a new issue