summaryrefslogtreecommitdiff
path: root/get
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2014-12-28 13:47:45 -0500
committerLuke Shumaker <lukeshu@sbcglobal.net>2014-12-28 13:47:45 -0500
commita45f20c0266103ed948d4a644e6d6d1c33a90b38 (patch)
tree4ad5d5e02ccded7feeac0a9b7f9e39490949a39f /get
parent63508d43f3c2f558c04065041919706cf2a86ef4 (diff)
refactor
Diffstat (limited to 'get')
-rwxr-xr-xget46
1 files changed, 46 insertions, 0 deletions
diff --git a/get b/get
new file mode 100755
index 0000000..c8cdd77
--- /dev/null
+++ b/get
@@ -0,0 +1,46 @@
+#!/bin/bash
+
+pkg=$1
+
+pkgbuild="$(mktemp --tmpdir libreboot.XXXXXXXXXX)"
+makepkg_conf="$(mktemp --tmpdir libreboot.XXXXXXXXXX)"
+trap "rm -f -- $(printf -- '%q ' "$pkgbuild" "$makepkg_conf")" EXIT
+
+get() {
+ pkg="$1"
+ {
+ # Bogus stuff to keep makepkg happy
+ printf 'pkgname=%q\n' "$pkg"
+ printf 'pkgver=libreboot\n'
+ printf 'pkgrel=1\n'
+ printf 'arch=(any)\n'
+ printf 'package() { :; }\n'
+ printf 'md5sums=(SKIP)\n'
+ # Actual stuff we care about
+ printf 'source=("${%s_source}")\n' "$pkg"
+ printf 'if type %s_mksource &>/dev/null; then\n' "$pkg"
+ printf 'prepare() { resources=%q; %s_mksource; }\n' "$PWD/resources" "$pkg"
+ printf 'fi\n'
+ } | cat source-locations.sh - > "$pkgbuild"
+
+ makepkg -o -p "$pkgbuild" --config "$makepkg_conf"
+}
+
+main() {
+ {
+ printf -- '%s\n' \
+ "DLAGENTS=('ftp::/usr/bin/curl -fC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %u'" \
+ " 'http::/usr/bin/curl -fLC - --retry 3 --retry-delay 3 -o %o %u'" \
+ " 'https::/usr/bin/curl -fLC - --retry 3 --retry-delay 3 -o %o %u'" \
+ " 'rsync::/usr/bin/rsync --no-motd -z %u %o'" \
+ " 'scp::/usr/bin/scp -C %u %o')"
+ printf 'BUILDENV=(fakeroot color)\n'
+ printf 'SRCDEST=%q\n' "$PWD/src/downloads"
+ } > "$makepkg_conf"
+ mkdir -p -- "$PWD/src/downloads"
+ for pkg in "$@"; do
+ get "$pkg"
+ done
+}
+
+main "$@"