Extract the download protocol from a source entry. Returns "local" for local source files. Signed-off-by: Allan McRae <allan@archlinux.org> --- scripts/makepkg.sh.in | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 4299816..0d87cba 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -222,6 +222,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 -- 1.7.11.1