diff options
author | Marc Kleine-Budde <mkl@pengutronix.de> | 2008-10-28 15:43:11 +0000 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2008-10-28 15:43:11 +0000 |
commit | f943575cc9c8fdef6f8bebf0480e8397d1d8b3de (patch) | |
tree | 3084de5c68aa07425d3c6f2778b7e2a33d9cd1ad /scripts/lib/ptxd_make_get.sh | |
parent | 87724f8660e669e013ec424fb3ee104d0108cde8 (diff) | |
download | ptxdist-f943575cc9c8fdef6f8bebf0480e8397d1d8b3de.tar.gz ptxdist-f943575cc9c8fdef6f8bebf0480e8397d1d8b3de.tar.xz |
* get.sh, ptxd_make_get.sh:
renamed
git-svn-id: https://svn.pengutronix.de/svn/ptxdist/trunks/ptxdist-trunk@8959 33e552b5-05e3-0310-8538-816dae2090ed
Diffstat (limited to 'scripts/lib/ptxd_make_get.sh')
-rw-r--r-- | scripts/lib/ptxd_make_get.sh | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/scripts/lib/ptxd_make_get.sh b/scripts/lib/ptxd_make_get.sh new file mode 100644 index 000000000..99ad5b8bf --- /dev/null +++ b/scripts/lib/ptxd_make_get.sh @@ -0,0 +1,67 @@ +#!/bin/bash + +# +# $@: possible download URLs, seperated by space +# +ptxd_make_get() { + local orig_argv=( "${@}" ) + + if [ -z "${1}" ]; then + echo + echo "${PROMPT}error: empty parameter to '${FUNCNAME}'" + echo + exit 1 + fi + + # split URLs by spaces + set -- ${*} + + while [ ${#} -ne 0 ]; do + local url="${1}" + shift + + case "${url}" in + http://*|ftp://*) + wget \ + -t 5 \ + --progress=bar:force \ + --passive-ftp \ + ${PTXDIST_QUIET:+--quiet} \ + -P "${PTXDIST_SRCDIR}" \ + "${url}" && return + ;; + file*) + local thing="${url/file:\/\///}" + + if [ -f "$thing" ]; then + echo "local archive, copying" + cp -av "${thing}" "${PTXDIST_SRCDIR}" && return + elif [ -d "${thing}" ]; then + echo "local directory instead of tar file, skipping get" + return + else + thing="${url/file:\/\//./}" + if [ -d "${thing}" ]; then + echo "local project directory instead of tar file, skipping get" + return + fi + fi + ;; + *) + echo + echo "Unknown URL Type!" + echo "URL: $url" + echo + exit 1 + ;; + esac + done + + echo + echo "Could not download packet" + echo "URL: ${orig_argv[@]}" + echo + exit 1 +} + +export -f ptxd_make_get |