diff options
| -rw-r--r-- | pkg/git/fetch.sh | 6 | ||||
| -rw-r--r-- | pkg/linux-headers/fetch.sh | 6 | ||||
| -rw-r--r-- | pkg/openbsd/fetch.sh | 6 | ||||
| -rw-r--r-- | scripts/checksum.sh | 8 | ||||
| -rw-r--r-- | scripts/fetch-curl.sh | 6 |
5 files changed, 16 insertions, 16 deletions
diff --git a/pkg/git/fetch.sh b/pkg/git/fetch.sh index 9b17a0d5..326e7338 100644 --- a/pkg/git/fetch.sh +++ b/pkg/git/fetch.sh @@ -1,5 +1,3 @@ -: "${SHA256SUM:=sha256sum}" - set -e sh scripts/fetch-git.sh "$@" @@ -11,9 +9,9 @@ if [ -e src/man ] ; then rm -rf src/man fi -if ! $SHA256SUM -c sha256 2>/dev/null ; then +if ! sh "$OLDPWD/scripts/checksum.sh" -c sha256 2>/dev/null ; then curl -L -O -K url - $SHA256SUM -c sha256 + sh "$OLDPWD/scripts/checksum.sh" -c sha256 fi read -r _ archive <sha256 diff --git a/pkg/linux-headers/fetch.sh b/pkg/linux-headers/fetch.sh index 0d5f32d8..0866f9b7 100644 --- a/pkg/linux-headers/fetch.sh +++ b/pkg/linux-headers/fetch.sh @@ -1,5 +1,3 @@ -: "${SHA256SUM:=sha256sum}" - set -e dir=$1 @@ -11,9 +9,9 @@ if [ -e src ] ; then rm -rf src fi -if ! $SHA256SUM -c sha256 2>/dev/null ; then +if ! sh "$OLDPWD/scripts/checksum.sh" -c sha256 2>/dev/null ; then curl -L -K url -O - $SHA256SUM -c sha256 + sh "$OLDPWD/scripts/checksum.sh" -c sha256 fi read -r _ archive <sha256 diff --git a/pkg/openbsd/fetch.sh b/pkg/openbsd/fetch.sh index 021eb802..bff225ed 100644 --- a/pkg/openbsd/fetch.sh +++ b/pkg/openbsd/fetch.sh @@ -1,5 +1,3 @@ -: "${SHA256SUM:=sha256sum}" - set -e dir=$1 @@ -11,9 +9,9 @@ if [ -e src ] ; then rm -rf src fi -if ! $SHA256SUM -c sha256 2>/dev/null ; then +if ! sh "$OLDPWD/scripts/checksum.sh" -c sha256 2>/dev/null ; then curl -L -K url -O - $SHA256SUM -c sha256 + sh "$OLDPWD/scripts/checksum.sh" -c sha256 fi sh "$OLDPWD/scripts/extract.sh" src.tar.gz -s ',^,src/,' \ diff --git a/scripts/checksum.sh b/scripts/checksum.sh new file mode 100644 index 00000000..6452d932 --- /dev/null +++ b/scripts/checksum.sh @@ -0,0 +1,8 @@ +if command -v sha256sum >/dev/null; then + exec sha256sum "$@" +elif command -v shasum >/dev/null; then + exec shasum -a 256 "$@" +else + printf '%s: sha256sum or shasum required\n' "$0" >&2 + exit 1 +fi diff --git a/scripts/fetch-curl.sh b/scripts/fetch-curl.sh index 80d70ee0..a6d5af57 100644 --- a/scripts/fetch-curl.sh +++ b/scripts/fetch-curl.sh @@ -1,5 +1,3 @@ -: "${SHA256SUM:=sha256sum}" - set -e if [ "$#" != 1 ] ; then @@ -16,9 +14,9 @@ if [ -e src ] ; then rm -rf src fi -if ! $SHA256SUM -c sha256 2>/dev/null ; then +if ! sh "$OLDPWD/scripts/checksum.sh" -c sha256 2>/dev/null ; then curl -L -K url -O - $SHA256SUM -c sha256 + sh "$OLDPWD/scripts/checksum.sh" -c sha256 fi while read -r _ archive ; do |
