summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2012-06-04 09:02:03 +1000
committerAllan McRae <allan@archlinux.org>2012-08-04 00:16:38 +1000
commita922d1805696b6614649a8d3588297d44f4e1192 (patch)
tree335da70258e4bdb8c1ff393bdf17c150d1b6f9b5 /scripts
parente8064144072e03ea1690c5aa97e863f14096a771 (diff)
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>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/makepkg.sh.in11
1 files changed, 11 insertions, 0 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 4cafa945..fe0c0684 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -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