summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Ball <nullspoon@oper.io>2018-02-14 11:37:42 -0700
committerAaron Ball <nullspoon@oper.io>2018-02-14 11:37:42 -0700
commit3f8555d208840bb8a5f8368f11d806b83ab0cb39 (patch)
treedd1fd7bd1c3747d5b7b9e24034a79b461143a8e6
parent1b724fbbe120f18e1d2f7890144413876a48fa04 (diff)
downloadpkgself-3f8555d208840bb8a5f8368f11d806b83ab0cb39.tar.gz
pkgself-3f8555d208840bb8a5f8368f11d806b83ab0cb39.tar.xz
pkgself: Changed source download dest to .source dir
Previously we downloaded all sources into the current directory. For packages that had a large number of sources, this cluttered up the directory and made it easy to confuse included resources with external downloaded resources. Now we download to a local hidden directory which keeps external resources seperated from included resources.
-rwxr-xr-xpkgself.sh24
1 files changed, 15 insertions, 9 deletions
diff --git a/pkgself.sh b/pkgself.sh
index 6811dbf..eb4e1f5 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 "${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