mirror of
https://github.com/moparisthebest/pacman
synced 2025-03-01 09:51:50 -05:00
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
@ -224,6 +224,17 @@ get_url() {
|
||||
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() {
|
||||
# $1 = URL with valid protocol prefix
|
||||
local url=$1
|
||||
|
Loading…
x
Reference in New Issue
Block a user