Skip to content

Commit

Permalink
scripts/codesign_example: Add check for sha256sum program
Browse files Browse the repository at this point in the history
  • Loading branch information
nywilken committed Feb 12, 2020
1 parent 746b7cb commit c121aa9
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions scripts/codesign_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ if ! command -v jq > /dev/null 2>&1; then
exit 1
fi

if ! command -v sha256sum > /dev/null 2>&1; then
if !command -v gsha256sum > /dev/null 2>&1; then
echo "This script requires sha256sum (linux) or gsha256sum (osx) to work properly."
exit 1
else
SHASUM_PROG=gsha256sum
fi
else
SHASUM_PROG=sha256sum
fi

PRODUCT_NAME="${PRODUCT_NAME:-""}"
if [ -z "$PRODUCT_NAME" ]; then
echo "Missing required product name: ${PRODUCT_NAME}"
Expand Down Expand Up @@ -145,6 +156,6 @@ signed_checksum=$(
| grep -i "x-checksum-sha256" | awk 'gsub("[\r\n]", "", $2) {print $2;}'
)

echo "${signed_checksum} signed_${SN_ID}.zip" | gsha256sum -c
echo "${signed_checksum} signed_${SN_ID}.zip" | SHASUM_PROG -c

mv "signed_${SN_ID}.zip" "$TARGET_ZIP"
mv "signed_${SN_ID}.zip" "$TARGET_ZIP"

0 comments on commit c121aa9

Please sign in to comment.