Skip to content

Commit 32029ad

Browse files
committed
action: support openssl and sha256sum
As availability may be limited in some edge-cases. Signed-off-by: Hidde Beydals <[email protected]>
1 parent e88577f commit 32029ad

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

action/action.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,16 @@ runs:
8181
curl -fsSL -o "$DL_DIR/$FLUX_CHECKSUMS_FILE" "$FLUX_DOWNLOAD_URL/$FLUX_CHECKSUMS_FILE"
8282
8383
echo "Verifying checksum"
84-
sum=$(openssl sha1 -sha256 "$DL_DIR/$FLUX_TARGET_FILE" | awk '{print $2}')
84+
sum=""
85+
if command -v openssl > /dev/null; then
86+
sum=$(openssl sha256 "$DL_DIR/$FLUX_TARGET_FILE" | awk '{print $2}')
87+
elif command -v sha256sum > /dev/null; then
88+
sum=$(sha256sum "$DL_DIR/$FLUX_TARGET_FILE" | awk '{print $1}')
89+
else
90+
echo "Neither openssl nor sha256sum found. Cannot calculate checksum."
91+
exit 1
92+
fi
93+
8594
expected_sum=$(grep " $FLUX_TARGET_FILE\$" "$DL_DIR/$FLUX_CHECKSUMS_FILE" | awk '{print $1}')
8695
if [ "$sum" != "$expected_sum" ]; then
8796
echo "SHA sum of ${FLUX_TARGET_FILE} does not match. Aborting."

0 commit comments

Comments
 (0)