scripts: generate SHA256 manifest lines in addition to SHA512
The current autoupdater will only respect the last line for a given model name, so we can add SHA256 checksums as long as they occur before the corresponding SHA512 line.
This commit is contained in:
parent
242e636188
commit
f9d59be731
12
Makefile
12
Makefile
@ -180,6 +180,7 @@ GLUON_$(1)_MODEL_$(2)_ALIASES += $(3)
|
||||
endef
|
||||
|
||||
|
||||
export SHA256SUM := $(GLUONDIR)/scripts/sha256sum.sh
|
||||
export SHA512SUM := $(GLUONDIR)/scripts/sha512sum.sh
|
||||
|
||||
|
||||
@ -489,11 +490,16 @@ manifest: FORCE
|
||||
$(if $(GLUON_$(profile)_SYSUPGRADE_EXT), \
|
||||
$(foreach model,$(GLUON_$(profile)_MODELS), \
|
||||
file="$(IMAGE_PREFIX)-$(model)-sysupgrade$(GLUON_$(profile)_SYSUPGRADE_EXT)"; \
|
||||
[ -e "$$file" ] && echo '$(model)' "$(PREPARED_RELEASE)" "$$($(SHA512SUM) "$$file")" "$$file"; \
|
||||
\
|
||||
[ -e "$$file" ] && ( \
|
||||
echo '$(model)' "$(PREPARED_RELEASE)" "$$($(SHA256SUM) "$$file")" "$$file"; \
|
||||
echo '$(model)' "$(PREPARED_RELEASE)" "$$($(SHA512SUM) "$$file")" "$$file"; \
|
||||
); \
|
||||
$(foreach alias,$(GLUON_$(profile)_MODEL_$(model)_ALIASES), \
|
||||
file="$(IMAGE_PREFIX)-$(alias)-sysupgrade$(GLUON_$(profile)_SYSUPGRADE_EXT)"; \
|
||||
[ -e "$$file" ] && echo '$(alias)' "$(PREPARED_RELEASE)" "$$($(SHA512SUM) "$$file")" "$$file"; \
|
||||
[ -e "$$file" ] && ( \
|
||||
echo '$(alias)' "$(PREPARED_RELEASE)" "$$($(SHA256SUM) "$$file")" "$$file"; \
|
||||
echo '$(alias)' "$(PREPARED_RELEASE)" "$$($(SHA512SUM) "$$file")" "$$file"; \
|
||||
); \
|
||||
) \
|
||||
) \
|
||||
) \
|
||||
|
20
scripts/sha256sum.sh
Executable file
20
scripts/sha256sum.sh
Executable file
@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
|
||||
check_command() {
|
||||
which "$1" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
if check_command sha256sum; then
|
||||
ret="$(sha256sum "$@")"
|
||||
elif check_command shasum; then
|
||||
ret="$(shasum -a 256 "$@")"
|
||||
elif check_command cksum; then
|
||||
ret="$(cksum -q -a sha256 "$@")"
|
||||
else
|
||||
echo "$0: no suitable sha256sum implementation was found" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
[ "$?" -eq 0 ] || exit 1
|
||||
|
||||
echo "$ret" | awk '{ print $1 }'
|
Loading…
Reference in New Issue
Block a user