summaryrefslogtreecommitdiff
path: root/lib/port.sh
diff options
context:
space:
mode:
Diffstat (limited to 'lib/port.sh')
-rw-r--r--lib/port.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/port.sh b/lib/port.sh
index 0797e57..dd7a484 100644
--- a/lib/port.sh
+++ b/lib/port.sh
@@ -44,3 +44,33 @@ function download_src {
curl -L -s -k -o "${destdir}/${localname}" "${uri}"
}
+
+#
+# Downloads the list of source files to the specified port directory. If the
+# file is local, it is skipped (with a friendly info message).
+#
+# @param _src Array reference of sources (from the Pkgfile)
+#
+function port_download_src {
+ local _ref_src="${1:-}"
+
+ # Download from Pkgfile src spec
+ for file in ${!_ref_src}; do
+ if [ -f "${file}" ]; then
+ # If the source file exists locally, just copy from here
+ linfo "File ${file} exists locally."
+ continue
+ else
+ # The "file" is probably a uri that couldn't be resolved locally, so we
+ # get the basename and see if that exists locally.
+ if [ -f $(basename ${file}) ]; then
+ linfo "Source '${file}' already downloaded"
+ else
+ linfo "Downloading ${file}"
+ download_src "${file}" "./"
+ fi
+ fi
+ done
+}
+
+

Generated by cgit