summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Ball <nullspoon@oper.io>2018-02-14 11:40:27 -0700
committerAaron Ball <nullspoon@oper.io>2018-02-14 11:40:27 -0700
commit3dbd6e6085e534db14ddadc1f2355da566151b8e (patch)
tree51321673aead18a7ae3bad9fd2217b686b602dac
parent1b724fbbe120f18e1d2f7890144413876a48fa04 (diff)
parentb90efbcebe3e3ffbdea77a9427dd7a0d07686e9c (diff)
downloadpkgself-3dbd6e6085e534db14ddadc1f2355da566151b8e.tar.gz
pkgself-3dbd6e6085e534db14ddadc1f2355da566151b8e.tar.xz
Merge branch 'source-dl-dest'
-rwxr-xr-xpkgself.sh24
1 files changed, 15 insertions, 9 deletions
diff --git a/pkgself.sh b/pkgself.sh
index 6811dbf..5a43464 100755
--- a/pkgself.sh
+++ b/pkgself.sh
@@ -24,34 +24,40 @@ export COMPRESSEXT='xz' # File extension for compressed data
download_src() {
local file
+ [ ! -d .source ] && mkdir .source
+
for src in ${source[@]}; do
# Set the file path buffer for better error messages
# This will store local files verbatim, but remote files will be parsed out
# of their URIs
+ # If we don't store this value, we would need to recompute src basename a
+ # great many times.
file="${src}"
- # Download http files
+ # Download external files
if [ "${src:0:4}" == "http" ] || [ "${src:0:3}" == "ftp" ]; then
file="$(basename ${src})"
- if [ ! -f "${file}" ]; then
+ if [ ! -f ".source/${file}" ]; then
printf "Downloading %s\n" "${file}"
- curl -k -L -q -# "${src}" -o "${file}"
+ curl -k -L -q -# "${src}" -o ".source/${file}"
fi
elif [ "${src:0:1}" == "/" ] && [ -f "${src}" ]; then
file="$(basename ${src})"
- if [ ! -f "${file}" ]; then
- printf "Copying local file '%s'\n" "$(basename ${src})"
- cp "${src}" "$(basename ${src})"
+ if [ ! -f ".source/${file}" ]; then
+ printf "Copying local file '%s'\n" "${file}"
+ cp "${src}" ".source/${file}"
fi
elif [ "${src:0:6}" == "ssh://" ]; then
file="$(basename ${src})"
- if [ ! -f "${file}" ]; then
+ if [ ! -f ".source/${file}" ]; then
printf "Downloading %s\n" "${file}"
- scp "${src:6}" "${file}"
+ scp -o LogLevel=Error "${src:6}" ".source/${file}"
fi
fi
- if [ -e "${file}" ]; then
+ if [ -e ".source/${file}" ]; then
+ cp -r ".source/${file}" "${PKGSRC}/${file}"
+ elif [ -e "${file}" ]; then
cp -r "${file}" "${PKGSRC}/${file}"
else
printf "Error: Source '%s' does not exist\n" "${file}"

Generated by cgit