diff options
| author | Michael Forney <mforney@mforney.org> | 2018-02-15 21:24:24 -0800 |
|---|---|---|
| committer | Michael Forney <mforney@mforney.org> | 2018-02-16 02:52:34 -0800 |
| commit | 741d25282274e59c785b9cbee23cefff3d2721a2 (patch) | |
| tree | b7eaf7402cb1a61c220a3f0eecc3bc63cec14eaa /scripts/fetch-curl.sh | |
| parent | 83d57181d1565d9c12b7d2467be9008d2b6edeab (diff) | |
Port build scripts to POSIX shell
Since we are now using Lua to generate ninja files, use of rc in build scripts
seems unnecessary and adds an additional bootstrap dependency. None of them are
too fancy, so just port to POSIX sh instead.
Diffstat (limited to 'scripts/fetch-curl.sh')
| -rw-r--r-- | scripts/fetch-curl.sh | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/scripts/fetch-curl.sh b/scripts/fetch-curl.sh new file mode 100644 index 00000000..86f7598e --- /dev/null +++ b/scripts/fetch-curl.sh @@ -0,0 +1,40 @@ +set -e + +if [ "$#" != 1 ] ; then + echo 'usage: fetch-curl.sh dir' >&2 + exit 2 +fi + +dir=$1 +shift + +cd "$dir" + +if [ -e src ] ; then + rm -rf src +fi + +if ! sha256sum -c sha256 2>/dev/null ; then + curl -L -K url -O + sha256sum -c sha256 +fi + +while read -r checksum archive ; do + case $archive in + *.tar.gz|*.tgz) + tool=zcat ;; + *.tar.bz2) + tool=bzcat ;; + *.tar.xz) + tool=xzcat ;; + *) + tool= + esac + if [ -n "$tool" ] ; then + "$tool" "$archive" | pax -r -s '/^\.\|[^\/]*/src/' '*/*' + fi +done <sha256 + +if [ -d patch ] ; then + git apply -v --whitespace=nowarn --directory "$dir/src" patch/* +fi |
