diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2014-12-28 13:47:45 -0500 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2014-12-28 13:47:45 -0500 |
commit | a45f20c0266103ed948d4a644e6d6d1c33a90b38 (patch) | |
tree | 4ad5d5e02ccded7feeac0a9b7f9e39490949a39f /get | |
parent | 63508d43f3c2f558c04065041919706cf2a86ef4 (diff) |
refactor
Diffstat (limited to 'get')
-rwxr-xr-x | get | 46 |
1 files changed, 46 insertions, 0 deletions
@@ -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 "$@" |