Move all to deprecated folder.
This commit is contained in:
53
deprecated/firmware/buildroot/support/download/bzr
Executable file
53
deprecated/firmware/buildroot/support/download/bzr
Executable file
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# We want to catch any unexpected failure, and exit immediately
|
||||
set -e
|
||||
|
||||
# Download helper for bzr, to be called from the download wrapper script
|
||||
#
|
||||
# Call it as:
|
||||
# .../bzr [-q] OUT_FILE REPO_URL REV BASENAME
|
||||
#
|
||||
# Environment:
|
||||
# BZR : the bzr command to call
|
||||
|
||||
|
||||
verbose=
|
||||
while getopts :q OPT; do
|
||||
case "${OPT}" in
|
||||
q) verbose=-q;;
|
||||
\?) printf "unknown option '%s'\n" "${OPTARG}" >&2; exit 1;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
output="${1}"
|
||||
repo="${2}"
|
||||
rev="${3}"
|
||||
basename="${4}"
|
||||
|
||||
# Caller needs to single-quote its arguments to prevent them from
|
||||
# being expanded a second time (in case there are spaces in them)
|
||||
_bzr() {
|
||||
eval ${BZR} "${@}"
|
||||
}
|
||||
|
||||
# --per-file-timestamps comes with bzr-2.2 (released August 2010),
|
||||
# so only pass it if bzr is recent enough. We compute versions as:
|
||||
# major*1000 + minor
|
||||
bzr_min_version=2002
|
||||
bzr_version=$(($(bzr --version |
|
||||
sed -r -n 's/^Bazaar \(bzr\) ([[:digit:]]+)\.([[:digit:]]+)\..*$/\1*1000+\2/p')
|
||||
))
|
||||
|
||||
# If the version is recent enough, we can generate reproducible
|
||||
# archives; otherwise, we just hope for the best (as it would
|
||||
# be downloaded from the BR mirror if what we generate here does
|
||||
# not match the hash we have for it).
|
||||
if [ ${bzr_version} -ge ${bzr_min_version} ]; then
|
||||
timestamp_opt="--per-file-timestamps"
|
||||
fi
|
||||
|
||||
_bzr export ${verbose} --root="'${basename}/'" --format=tgz \
|
||||
${timestamp_opt} - "'${repo}'" -r "'${rev}'" \
|
||||
>"${output}"
|
||||
110
deprecated/firmware/buildroot/support/download/check-hash
Executable file
110
deprecated/firmware/buildroot/support/download/check-hash
Executable file
@@ -0,0 +1,110 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
# Helper to check a file matches its known hash
|
||||
# Call it with:
|
||||
# $1: the path of the file containing all the expected hashes
|
||||
# $2: the full path to the temporary file that was downloaded, and
|
||||
# that is to be checked
|
||||
# $3: the final basename of the file, to which it will be ultimately
|
||||
# saved as, to be able to match it to the corresponding hashes
|
||||
# in the .hash file
|
||||
#
|
||||
# Exit codes:
|
||||
# 0: the hash file exists and the file to check matches all its hashes,
|
||||
# or the hash file does not exist
|
||||
# 1: unknown command-line option
|
||||
# 2: the hash file exists and the file to check does not match at least
|
||||
# one of its hashes
|
||||
# 3: the hash file exists and there was no hash to check the file against
|
||||
# 4: the hash file exists and at least one hash type is unknown
|
||||
|
||||
while getopts :q OPT; do
|
||||
case "${OPT}" in
|
||||
q) exec >/dev/null;;
|
||||
\?) exit 1;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
h_file="${1}"
|
||||
file="${2}"
|
||||
base="${3}"
|
||||
|
||||
# Bail early if no hash to check
|
||||
if [ -z "${h_file}" ]; then
|
||||
exit 0
|
||||
fi
|
||||
# Does the hash-file exist?
|
||||
if [ ! -f "${h_file}" ]; then
|
||||
printf "WARNING: no hash file for %s\n" "${base}" >&2
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Check one hash for a file
|
||||
# $1: known hash
|
||||
# $2: file (full path)
|
||||
check_one_hash() {
|
||||
_h="${1}"
|
||||
_known="${2}"
|
||||
_file="${3}"
|
||||
|
||||
# Note: md5 is supported, but undocumented on purpose.
|
||||
# Note: sha3 is not supported, since there is currently no implementation
|
||||
# (the NIST has yet to publish the parameters).
|
||||
# Note: 'none' means there is explicitly no hash for that file.
|
||||
case "${_h}" in
|
||||
none)
|
||||
return 0
|
||||
;;
|
||||
md5|sha1) ;;
|
||||
sha224|sha256|sha384|sha512) ;;
|
||||
*) # Unknown hash, exit with error
|
||||
printf "ERROR: unknown hash '%s' for '%s'\n" \
|
||||
"${_h}" "${base}" >&2
|
||||
exit 4
|
||||
;;
|
||||
esac
|
||||
|
||||
# Do the hashes match?
|
||||
_hash=$( ${_h}sum "${_file}" |cut -d ' ' -f 1 )
|
||||
if [ "${_hash}" = "${_known}" ]; then
|
||||
printf "%s: OK (%s: %s)\n" "${base}" "${_h}" "${_hash}"
|
||||
return 0
|
||||
fi
|
||||
|
||||
printf "ERROR: %s has wrong %s hash:\n" "${base}" "${_h}" >&2
|
||||
printf "ERROR: expected: %s\n" "${_known}" >&2
|
||||
printf "ERROR: got : %s\n" "${_hash}" >&2
|
||||
printf "ERROR: Incomplete download, or man-in-the-middle (MITM) attack\n" >&2
|
||||
|
||||
exit 2
|
||||
}
|
||||
|
||||
# Do we know one or more hashes for that file?
|
||||
nb_checks=0
|
||||
while read t h f; do
|
||||
case "${t}" in
|
||||
''|'#'*)
|
||||
# Skip comments and empty lines
|
||||
continue
|
||||
;;
|
||||
*)
|
||||
if [ "${f}" = "${base}" ]; then
|
||||
check_one_hash "${t}" "${h}" "${file}"
|
||||
: $((nb_checks++))
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done <"${h_file}"
|
||||
|
||||
if [ ${nb_checks} -eq 0 ]; then
|
||||
case " ${BR_NO_CHECK_HASH_FOR} " in
|
||||
*" ${base} "*)
|
||||
# File explicitly has no hash
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
printf "ERROR: No hash found for %s\n" "${base}" >&2
|
||||
exit 3
|
||||
fi
|
||||
37
deprecated/firmware/buildroot/support/download/cp
Executable file
37
deprecated/firmware/buildroot/support/download/cp
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# We want to catch any unexpected failure, and exit immediately
|
||||
set -e
|
||||
|
||||
# Download helper for cp, to be called from the download wrapper script
|
||||
#
|
||||
# Call it as:
|
||||
# .../cp [-q] OUT_FILE SRC_FILE
|
||||
#
|
||||
# Environment:
|
||||
# LOCALFILES: the cp command to call
|
||||
|
||||
# 'cp' usually does not print anything on its stdout, whereas the
|
||||
# other download backends, even if not verbose, at least print some
|
||||
# progress information.
|
||||
# Make 'cp' verbose by default, so it behaves a bit like the others.
|
||||
verbose=-v
|
||||
|
||||
while getopts :q OPT; do
|
||||
case "${OPT}" in
|
||||
q) verbose=;;
|
||||
\?) printf "unknown option '%s'\n" "${OPTARG}" >&2; exit 1;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
output="${1}"
|
||||
source="${2}"
|
||||
|
||||
# Caller needs to single-quote its arguments to prevent them from
|
||||
# being expanded a second time (in case there are spaces in them)
|
||||
_localfiles() {
|
||||
eval ${LOCALFILES} "${@}"
|
||||
}
|
||||
|
||||
_localfiles ${verbose} "'${source}'" "'${output}'"
|
||||
53
deprecated/firmware/buildroot/support/download/cvs
Executable file
53
deprecated/firmware/buildroot/support/download/cvs
Executable file
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# We want to catch any unexpected failure, and exit immediately
|
||||
set -e
|
||||
|
||||
# Download helper for cvs, to be called from the download wrapper script
|
||||
#
|
||||
# Call it as:
|
||||
# .../cvs [-q] OUT_FILE CVS_URL REV PKG_NAME BASENAME
|
||||
#
|
||||
# Environment:
|
||||
# CVS : the cvs command to call
|
||||
|
||||
verbose=
|
||||
while getopts :q OPT; do
|
||||
case "${OPT}" in
|
||||
q) verbose=-Q;;
|
||||
\?) printf "unknown option '%s'\n" "${OPTARG}" >&2; exit 1;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
output="${1}"
|
||||
repo="${2}"
|
||||
rev="${3}"
|
||||
rawname="${4}"
|
||||
basename="${5}"
|
||||
|
||||
# Caller needs to single-quote its arguments to prevent them from
|
||||
# being expanded a second time (in case there are spaces in them)
|
||||
_cvs() {
|
||||
eval ${CVS} "${@}"
|
||||
}
|
||||
|
||||
if [[ ${rev} =~ ^[0-9] ]]; then
|
||||
# Date, because a tag or a branch cannot begin with a number
|
||||
select="-D"
|
||||
else
|
||||
# Tag or branch
|
||||
select="-r"
|
||||
fi
|
||||
|
||||
# The absence of an initial : on ${repo} means access method undefined
|
||||
if [[ ! "${repo}" =~ ^: ]]; then
|
||||
# defaults to anonymous pserver
|
||||
repo=":pserver:anonymous@${repo}"
|
||||
fi
|
||||
|
||||
export TZ=UTC
|
||||
_cvs ${verbose} -z3 -d"'${repo}'" \
|
||||
co -d "'${basename}'" ${select} "'${rev}'" -P "'${rawname}'"
|
||||
|
||||
tar czf "${output}" "${basename}"
|
||||
196
deprecated/firmware/buildroot/support/download/dl-wrapper
Executable file
196
deprecated/firmware/buildroot/support/download/dl-wrapper
Executable file
@@ -0,0 +1,196 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This script is a wrapper to the other download backends.
|
||||
# Its role is to ensure atomicity when saving downloaded files
|
||||
# back to BR2_DL_DIR, and not clutter BR2_DL_DIR with partial,
|
||||
# failed downloads.
|
||||
#
|
||||
# Call it with -h to see some help.
|
||||
|
||||
# To avoid cluttering BR2_DL_DIR, we download to a trashable
|
||||
# location, namely in $(BUILD_DIR).
|
||||
# Then, we move the downloaded file to a temporary file in the
|
||||
# same directory as the final output file.
|
||||
# This allows us to finally atomically rename it to its final
|
||||
# name.
|
||||
# If anything goes wrong, we just remove all the temporaries
|
||||
# created so far.
|
||||
|
||||
# We want to catch any unexpected failure, and exit immediately.
|
||||
set -e
|
||||
|
||||
main() {
|
||||
local OPT OPTARG
|
||||
local backend output hfile quiet
|
||||
|
||||
# Parse our options; anything after '--' is for the backend
|
||||
while getopts :hb:o:H:q OPT; do
|
||||
case "${OPT}" in
|
||||
h) help; exit 0;;
|
||||
b) backend="${OPTARG}";;
|
||||
o) output="${OPTARG}";;
|
||||
H) hfile="${OPTARG}";;
|
||||
q) quiet="-q";;
|
||||
:) error "option '%s' expects a mandatory argument\n" "${OPTARG}";;
|
||||
\?) error "unknown option '%s'\n" "${OPTARG}";;
|
||||
esac
|
||||
done
|
||||
# Forget our options, and keep only those for the backend
|
||||
shift $((OPTIND-1))
|
||||
|
||||
if [ -z "${backend}" ]; then
|
||||
error "no backend specified, use -b\n"
|
||||
fi
|
||||
if [ -z "${output}" ]; then
|
||||
error "no output specified, use -o\n"
|
||||
fi
|
||||
|
||||
# If the output file already exists and:
|
||||
# - there's no .hash file: do not download it again and exit promptly
|
||||
# - matches all its hashes: do not download it again and exit promptly
|
||||
# - fails at least one of its hashes: force a re-download
|
||||
# - there's no hash (but a .hash file): consider it a hard error
|
||||
if [ -e "${output}" ]; then
|
||||
if support/download/check-hash ${quiet} "${hfile}" "${output}" "${output##*/}"; then
|
||||
exit 0
|
||||
elif [ ${?} -ne 2 ]; then
|
||||
# Do not remove the file, otherwise it might get re-downloaded
|
||||
# from a later location (i.e. primary -> upstream -> mirror).
|
||||
# Do not print a message, check-hash already did.
|
||||
exit 1
|
||||
fi
|
||||
rm -f "${output}"
|
||||
warn "Re-downloading '%s'...\n" "${output##*/}"
|
||||
fi
|
||||
|
||||
# tmpd is a temporary directory in which backends may store intermediate
|
||||
# by-products of the download.
|
||||
# tmpf is the file in which the backends should put the downloaded content.
|
||||
# tmpd is located in $(BUILD_DIR), so as not to clutter the (precious)
|
||||
# $(BR2_DL_DIR)
|
||||
# We let the backends create tmpf, so they are able to set whatever
|
||||
# permission bits they want (although we're only really interested in
|
||||
# the executable bit.)
|
||||
tmpd="$(mktemp -d "${BUILD_DIR}/.${output##*/}.XXXXXX")"
|
||||
tmpf="${tmpd}/output"
|
||||
|
||||
# Helpers expect to run in a directory that is *really* trashable, so
|
||||
# they are free to create whatever files and/or sub-dirs they might need.
|
||||
# Doing the 'cd' here rather than in all backends is easier.
|
||||
cd "${tmpd}"
|
||||
|
||||
# If the backend fails, we can just remove the temporary directory to
|
||||
# remove all the cruft it may have left behind. Then we just exit in
|
||||
# error too.
|
||||
if ! "${OLDPWD}/support/download/${backend}" ${quiet} "${tmpf}" "${@}"; then
|
||||
rm -rf "${tmpd}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# cd back to free the temp-dir, so we can remove it later
|
||||
cd "${OLDPWD}"
|
||||
|
||||
# Check if the downloaded file is sane, and matches the stored hashes
|
||||
# for that file
|
||||
if ! support/download/check-hash ${quiet} "${hfile}" "${tmpf}" "${output##*/}"; then
|
||||
rm -rf "${tmpd}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# tmp_output is in the same directory as the final output, so we can
|
||||
# later move it atomically.
|
||||
tmp_output="$(mktemp "${output}.XXXXXX")"
|
||||
|
||||
# 'mktemp' creates files with 'go=-rwx', so the files are not accessible
|
||||
# to users other than the one doing the download (and root, of course).
|
||||
# This can be problematic when a shared BR2_DL_DIR is used by different
|
||||
# users (e.g. on a build server), where all users may write to the shared
|
||||
# location, since other users would not be allowed to read the files
|
||||
# another user downloaded.
|
||||
# So, we restore the 'go' access rights to a more sensible value, while
|
||||
# still abiding by the current user's umask. We must do that before the
|
||||
# final 'mv', so just do it now.
|
||||
# Some backends (cp and scp) may create executable files, so we need to
|
||||
# carry the executable bit if needed.
|
||||
[ -x "${tmpf}" ] && new_mode=755 || new_mode=644
|
||||
new_mode=$(printf "%04o" $((0${new_mode} & ~0$(umask))))
|
||||
chmod ${new_mode} "${tmp_output}"
|
||||
|
||||
# We must *not* unlink tmp_output, otherwise there is a small window
|
||||
# during which another download process may create the same tmp_output
|
||||
# name (very, very unlikely; but not impossible.)
|
||||
# Using 'cp' is not reliable, since 'cp' may unlink the destination file
|
||||
# if it is unable to open it with O_WRONLY|O_TRUNC; see:
|
||||
# http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cp.html
|
||||
# Since the destination filesystem can be anything, it might not support
|
||||
# O_TRUNC, so 'cp' would unlink it first.
|
||||
# Use 'cat' and append-redirection '>>' to save to the final location,
|
||||
# since that is the only way we can be 100% sure of the behaviour.
|
||||
if ! cat "${tmpf}" >>"${tmp_output}"; then
|
||||
rm -rf "${tmpd}" "${tmp_output}"
|
||||
exit 1
|
||||
fi
|
||||
rm -rf "${tmpd}"
|
||||
|
||||
# tmp_output and output are on the same filesystem, so POSIX guarantees
|
||||
# that 'mv' is atomic, because it then uses rename() that POSIX mandates
|
||||
# to be atomic, see:
|
||||
# http://pubs.opengroup.org/onlinepubs/9699919799/functions/rename.html
|
||||
if ! mv -f "${tmp_output}" "${output}"; then
|
||||
rm -f "${tmp_output}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
help() {
|
||||
cat <<_EOF_
|
||||
NAME
|
||||
${my_name} - download wrapper for Buildroot
|
||||
|
||||
SYNOPSIS
|
||||
${my_name} [OPTION]... -- [BACKEND OPTION]...
|
||||
|
||||
DESCRIPTION
|
||||
Wrapper script around different download mechanisms. Ensures that
|
||||
concurrent downloads do not conflict, that partial downloads are
|
||||
properly evicted without leaving temporary files, and that access
|
||||
rights are maintained.
|
||||
|
||||
-h This help text.
|
||||
|
||||
-b BACKEND
|
||||
Wrap the specified BACKEND. Known backends are:
|
||||
bzr Bazaar
|
||||
cp Local files
|
||||
cvs Concurrent Versions System
|
||||
git Git
|
||||
hg Mercurial
|
||||
scp Secure copy
|
||||
svn Subversion
|
||||
wget HTTP download
|
||||
|
||||
-o FILE
|
||||
Store the downloaded archive in FILE.
|
||||
|
||||
-H FILE
|
||||
Use FILE to read hashes from, and check them against the downloaded
|
||||
archive.
|
||||
|
||||
Exit status:
|
||||
0 if OK
|
||||
!0 in case of error
|
||||
|
||||
ENVIRONMENT
|
||||
|
||||
BUILD_DIR
|
||||
The path to Buildroot's build dir
|
||||
_EOF_
|
||||
}
|
||||
|
||||
trace() { local msg="${1}"; shift; printf "%s: ${msg}" "${my_name}" "${@}"; }
|
||||
warn() { trace "${@}" >&2; }
|
||||
errorN() { local ret="${1}"; shift; warn "${@}"; exit ${ret}; }
|
||||
error() { errorN 1 "${@}"; }
|
||||
|
||||
my_name="${0##*/}"
|
||||
main "${@}"
|
||||
58
deprecated/firmware/buildroot/support/download/git
Executable file
58
deprecated/firmware/buildroot/support/download/git
Executable file
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# We want to catch any unexpected failure, and exit immediately
|
||||
set -e
|
||||
|
||||
# Download helper for git, to be called from the download wrapper script
|
||||
#
|
||||
# Call it as:
|
||||
# .../git [-q] OUT_FILE REPO_URL CSET BASENAME
|
||||
#
|
||||
# Environment:
|
||||
# GIT : the git command to call
|
||||
|
||||
verbose=
|
||||
while getopts :q OPT; do
|
||||
case "${OPT}" in
|
||||
q) verbose=-q; exec >/dev/null;;
|
||||
\?) printf "unknown option '%s'\n" "${OPTARG}" >&2; exit 1;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
output="${1}"
|
||||
repo="${2}"
|
||||
cset="${3}"
|
||||
basename="${4}"
|
||||
|
||||
# Caller needs to single-quote its arguments to prevent them from
|
||||
# being expanded a second time (in case there are spaces in them)
|
||||
_git() {
|
||||
eval ${GIT} "${@}"
|
||||
}
|
||||
|
||||
# Try a shallow clone, since it is faster than a full clone - but that only
|
||||
# works if the version is a ref (tag or branch). Before trying to do a shallow
|
||||
# clone we check if ${cset} is in the list provided by git ls-remote. If not
|
||||
# we fall back on a full clone.
|
||||
#
|
||||
# Messages for the type of clone used are provided to ease debugging in case of
|
||||
# problems
|
||||
git_done=0
|
||||
if [ -n "$(_git ls-remote "'${repo}'" "'${cset}'" 2>&1)" ]; then
|
||||
printf "Doing shallow clone\n"
|
||||
if _git clone ${verbose} --depth 1 -b "'${cset}'" --bare "'${repo}'" "'${basename}'"; then
|
||||
git_done=1
|
||||
else
|
||||
printf "Shallow clone failed, falling back to doing a full clone\n"
|
||||
fi
|
||||
fi
|
||||
if [ ${git_done} -eq 0 ]; then
|
||||
printf "Doing full clone\n"
|
||||
_git clone ${verbose} --mirror "'${repo}'" "'${basename}'"
|
||||
fi
|
||||
|
||||
GIT_DIR="${basename}" \
|
||||
_git archive --prefix="'${basename}/'" -o "'${output}.tmp'" --format=tar "'${cset}'"
|
||||
|
||||
gzip -n <"${output}.tmp" >"${output}"
|
||||
38
deprecated/firmware/buildroot/support/download/hg
Executable file
38
deprecated/firmware/buildroot/support/download/hg
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# We want to catch any unexpected failure, and exit immediately
|
||||
set -e
|
||||
|
||||
# Download helper for hg, to be called from the download wrapper script
|
||||
#
|
||||
# Call it as:
|
||||
# .../hg [-q] OUT_FILE REPO_URL CSET BASENAME
|
||||
#
|
||||
# Environment:
|
||||
# HG : the hg command to call
|
||||
|
||||
verbose=
|
||||
while getopts :q OPT; do
|
||||
case "${OPT}" in
|
||||
q) verbose=-q;;
|
||||
\?) printf "unknown option '%s'\n" "${OPTARG}" >&2; exit 1;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
output="${1}"
|
||||
repo="${2}"
|
||||
cset="${3}"
|
||||
basename="${4}"
|
||||
|
||||
# Caller needs to single-quote its arguments to prevent them from
|
||||
# being expanded a second time (in case there are spaces in them)
|
||||
_hg() {
|
||||
eval ${HG} "${@}"
|
||||
}
|
||||
|
||||
_hg clone ${verbose} --noupdate "'${repo}'" "'${basename}'"
|
||||
|
||||
_hg archive ${verbose} --repository "'${basename}'" --type tgz \
|
||||
--prefix "'${basename}'" --rev "'${cset}'" \
|
||||
- >"${output}"
|
||||
32
deprecated/firmware/buildroot/support/download/scp
Executable file
32
deprecated/firmware/buildroot/support/download/scp
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# We want to catch any unexpected failure, and exit immediately
|
||||
set -e
|
||||
|
||||
# Download helper for scp, to be called from the download wrapper script
|
||||
#
|
||||
# Call it as:
|
||||
# .../scp [-q] OUT_FILE SRC_URL
|
||||
#
|
||||
# Environment:
|
||||
# SCP : the scp command to call
|
||||
|
||||
verbose=
|
||||
while getopts :q OPT; do
|
||||
case "${OPT}" in
|
||||
q) verbose=-q;;
|
||||
\?) printf "unknown option '%s'\n" "${OPTARG}" >&2; exit 1;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
output="${1}"
|
||||
url="${2}"
|
||||
|
||||
# Caller needs to single-quote its arguments to prevent them from
|
||||
# being expanded a second time (in case there are spaces in them)
|
||||
_scp() {
|
||||
eval ${SCP} "${@}"
|
||||
}
|
||||
|
||||
_scp ${verbose} "'${url}'" "'${output}'"
|
||||
36
deprecated/firmware/buildroot/support/download/svn
Executable file
36
deprecated/firmware/buildroot/support/download/svn
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# We want to catch any unexpected failure, and exit immediately
|
||||
set -e
|
||||
|
||||
# Download helper for svn, to be called from the download wrapper script
|
||||
#
|
||||
# Call it as:
|
||||
# .../svn [-q] OUT_FILE REPO_URL REV BASNAME
|
||||
#
|
||||
# Environment:
|
||||
# SVN : the svn command to call
|
||||
|
||||
verbose=
|
||||
while getopts :q OPT; do
|
||||
case "${OPT}" in
|
||||
q) verbose=-q;;
|
||||
\?) printf "unknown option '%s'\n" "${OPTARG}" >&2; exit 1;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
output="${1}"
|
||||
repo="${2}"
|
||||
rev="${3}"
|
||||
basename="${4}"
|
||||
|
||||
# Caller needs to single-quote its arguments to prevent them from
|
||||
# being expanded a second time (in case there are spaces in them)
|
||||
_svn() {
|
||||
eval ${SVN} "${@}"
|
||||
}
|
||||
|
||||
_svn export ${verbose} "'${repo}@${rev}'" "'${basename}'"
|
||||
|
||||
tar czf "${output}" "${basename}"
|
||||
32
deprecated/firmware/buildroot/support/download/wget
Executable file
32
deprecated/firmware/buildroot/support/download/wget
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# We want to catch any unexpected failure, and exit immediately
|
||||
set -e
|
||||
|
||||
# Download helper for wget, to be called from the download wrapper script
|
||||
#
|
||||
# Call it as:
|
||||
# .../wget [-q] OUT_FILE URL
|
||||
#
|
||||
# Environment:
|
||||
# WGET : the wget command to call
|
||||
|
||||
verbose=
|
||||
while getopts :q OPT; do
|
||||
case "${OPT}" in
|
||||
q) verbose=-q;;
|
||||
\?) printf "unknown option '%s'\n" "${OPTARG}" >&2; exit 1;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
output="${1}"
|
||||
url="${2}"
|
||||
|
||||
# Caller needs to single-quote its arguments to prevent them from
|
||||
# being expanded a second time (in case there are spaces in them)
|
||||
_wget() {
|
||||
eval ${WGET} "${@}"
|
||||
}
|
||||
|
||||
_wget ${verbose} -O "'${output}'" "'${url}'"
|
||||
Reference in New Issue
Block a user