Index: .fossil-settings/ignore-glob ================================================================== --- .fossil-settings/ignore-glob +++ .fossil-settings/ignore-glob @@ -0,0 +1,2 @@ +workdir-* +ARCHIVE Index: build ================================================================== --- build +++ build @@ -107,32 +107,48 @@ pkgfile="${pkgdir}/info" else pkgfile="pkgs/${pkg}" pkgdir="${pkgfile}" fi -pkgdate="$(find "${pkgdir}" -type f -printf '%TY%Tm%Td%TH%TM.%TS\n' | cut -f 1-2 -d '.' | sort -n | tail -n 1)" + +if [ ! -e "${pkgfile}" ]; then + echo "Invalid package." >&2 + + exit 1 +fi + +pkgdate="$(find "${pkgdir}" -type f -printf '%TY%Tm%Td%TH%TM.%TS\n' 2>/dev/null | cut -f 1-2 -d '.' | sort -n | tail -n 1)" . "${pkgfile}" archivedir="$(pwd)/ARCHIVE" workdir="workdir-$$${RANDOM}${RANDOM}${RANDOM}" -mkdir "${workdir}" "${archivedir}" +srcfile="${archivedir}/${pkg}" +mkdir "${archivedir}" >/dev/null 2>/dev/null +mkdir "${workdir}" || exit 1 cd "${workdir}" || exit 1 workdir="$(pwd)" -# Download -## Cleanup -rm -f src.new src - -## Fetch file -wget -O src.new "${url}" || exit 1 - -## Verify signature -### XXX:TODO - -## Move file into place -mv src.new src +if [ ! -e "${srcfile}" ]; then + # Download + ## Cleanup + rm -f src.new src + + ## Fetch file + wget -O src.new "${url}" || exit 1 + + ## Verify signature + src_sha256="$(openssl sha256 'src.new' | sed 's@^.*= @@')" + if [ "${src_sha256}" != "${sha256}" ]; then + echo "SHA256 mismatch: Downloaded: ${src_sha256} != Expected: ${sha256}" >&2 + + exit 1 + fi + + ## Move file into place + mv src.new "${archivedir}/${pkg}" +fi # Decompress archive ## Determine type of archive case "${url}" in *.tar.xz|*.tar.xz'?'*|*.txz) @@ -155,14 +171,14 @@ esac ## Do decompression case "${decompress}" in unzip) - unzip 'src' || die 'Unable to uncompress archive' + unzip "${srcfile}" || die 'Unable to uncompress archive' ;; *) - "${decompress}" -dc src | tar -xf - || die 'Unable to uncompress archive' + "${decompress}" -dc "${srcfile}" | tar -xf - || die 'Unable to uncompress archive' ;; esac ## Cleanup source rm -f src Index: pkgs/glibc ================================================================== --- pkgs/glibc +++ pkgs/glibc @@ -1,11 +1,11 @@ #! /usr/bin/env bash version=2.20 url="http://ftp.gnu.org/gnu/glibc/glibc-${version}.tar.xz" domain=core.appfs.rkeene.org -sha256='' +sha256='f84b6d42aecc288d593c397b0a3d02260a33ee686bce0c634eb9b32798f36ba5' function configure() { mkdir BUILD cd BUILD Index: pkgs/readline ================================================================== --- pkgs/readline +++ pkgs/readline @@ -1,6 +1,6 @@ #! /usr/bin/env bash version=6.3 url="https://ftp.gnu.org/gnu/readline/readline-${version}.tar.gz" domain=core.appfs.rkeene.org -sha256='' +sha256='56ba6071b9462f980c5a72ab0023893b65ba6debb4eeb475d7a563dc65cafd43' ADDED pkgs/zlib Index: pkgs/zlib ================================================================== --- /dev/null +++ pkgs/zlib @@ -0,0 +1,6 @@ +#! /usr/bin/env bash + +version=1.2.8 +url="http://zlib.net/zlib-${version}.tar.gz" +domain=core.appfs.rkeene.org +sha256='36658cb768a54c1d4dec43c3116c27ed893e88b02ecfcb44f2166f9c0b7f2a0d'