diff options
author | Aaron Ball <nullspoon@oper.io> | 2018-02-14 11:40:27 -0700 |
---|---|---|
committer | Aaron Ball <nullspoon@oper.io> | 2018-02-14 11:40:27 -0700 |
commit | 3dbd6e6085e534db14ddadc1f2355da566151b8e (patch) | |
tree | 51321673aead18a7ae3bad9fd2217b686b602dac | |
parent | 1b724fbbe120f18e1d2f7890144413876a48fa04 (diff) | |
parent | b90efbcebe3e3ffbdea77a9427dd7a0d07686e9c (diff) | |
download | pkgself-3dbd6e6085e534db14ddadc1f2355da566151b8e.tar.gz pkgself-3dbd6e6085e534db14ddadc1f2355da566151b8e.tar.xz |
Merge branch 'source-dl-dest'
-rwxr-xr-x | pkgself.sh | 24 |
1 files changed, 15 insertions, 9 deletions
@@ -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}" |