Skip to content
This repository has been archived by the owner on Jan 14, 2022. It is now read-only.

Commit

Permalink
Issue #5 check for gsha256sum
Browse files Browse the repository at this point in the history
  • Loading branch information
nickg committed May 11, 2017
1 parent 314c703 commit c2935f7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion samples/godownloader-goreleaser.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ fi
# portable sha256sum
checksum() {
TARGET=$1
if which sha256sum > /dev/null; then
if which gsha256sum > /dev/null; then
# mac homebrew, others
gsha256sum $TARGET | cut -d ' ' -f 1
elif which sha256sum > /dev/null; then
# gnu, busybox
sha256sum $TARGET | cut -d ' ' -f 1
elif which shasum > /dev/null; then
Expand Down Expand Up @@ -112,6 +115,9 @@ download ${TMPDIR}/${TARBALL} ${TARBALL_URL}
if [ 1 -eq 1 ]; then
rm -f ${TMPDIR}/${CHECKSUM}
download ${TMPDIR}/${CHECKSUM} ${CHECKSUM_URL}
# remove tabs: old version of goreleaser used them
# https://github.com/goreleaser/goreleaser/issues/233
# fixed 2017-05-11
WANT=$(grep ${TARBALL} ${TMPDIR}/${CHECKSUM} | tr '\t' ' ' | cut -d ' ' -f 1)
GOT=$(checksum $TMPDIR/$TARBALL)
if [ "$GOT" != "$WANT" ]; then
Expand Down
8 changes: 7 additions & 1 deletion samples/godownloader-hugo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ fi
# portable sha256sum
checksum() {
TARGET=$1
if which sha256sum > /dev/null; then
if which gsha256sum > /dev/null; then
# mac homebrew, others
gsha256sum $TARGET | cut -d ' ' -f 1
elif which sha256sum > /dev/null; then
# gnu, busybox
sha256sum $TARGET | cut -d ' ' -f 1
elif which shasum > /dev/null; then
Expand Down Expand Up @@ -129,6 +132,9 @@ download ${TMPDIR}/${TARBALL} ${TARBALL_URL}
if [ 1 -eq 1 ]; then
rm -f ${TMPDIR}/${CHECKSUM}
download ${TMPDIR}/${CHECKSUM} ${CHECKSUM_URL}
# remove tabs: old version of goreleaser used them
# https://github.com/goreleaser/goreleaser/issues/233
# fixed 2017-05-11
WANT=$(grep ${TARBALL} ${TMPDIR}/${CHECKSUM} | tr '\t' ' ' | cut -d ' ' -f 1)
GOT=$(checksum $TMPDIR/$TARBALL)
if [ "$GOT" != "$WANT" ]; then
Expand Down

0 comments on commit c2935f7

Please sign in to comment.