Skip to content

Commit

Permalink
detect missing/bad shasum for make homebrew
Browse files Browse the repository at this point in the history
  • Loading branch information
synfinatic committed Sep 29, 2022
1 parent 1d0a3a7 commit 6145a96
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,16 @@ homebrew: $(HOMEBREW) ## Build homebrew tap file
#DOWNLOAD_URL := https://synfin.net/misc/aws-sso-cli.$(PROJECT_VERSION).tar.gz
DOWNLOAD_URL ?= https://github.com/synfinatic/aws-sso-cli/archive/refs/tags/v$(PROJECT_VERSION).tar.gz

.PHONY: shasum
shasum:
@which shasum >/dev/null || (echo "Missing 'shasum' binary" ; exit 1)
@echo "foo" | shasum -a 256 >/dev/null || (echo "'shasum' does not support: -a 256"; exit 1)

.PHONY: $(HOMEBREW)
$(HOMEBREW): homebrew/template.rb ## no-help
$(HOMEBREW): homebrew/template.rb shasum ## no-help
TEMPFILE=$$(mktemp) && wget -q -O $${TEMPFILE} $(DOWNLOAD_URL) ; \
if test -s $${TEMPFILE}; then \
export SHA=$$(cat $${TEMPFILE} | sha256sum | sed -e 's| -||') && rm $${TEMPFILE} && \
export SHA=$$(cat $${TEMPFILE} | shasum -a 256 | sed -e 's| -||') && rm $${TEMPFILE} && \
m4 -D __SHA256__=$${SHA} \
-D __VERSION__=$(PROJECT_VERSION) \
-D __COMMIT__=$(PROJECT_COMMIT) \
Expand Down

0 comments on commit 6145a96

Please sign in to comment.