summaryrefslogtreecommitdiff
path: root/pkgself.sh
diff options
context:
space:
mode:
Diffstat (limited to 'pkgself.sh')
-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