Skip to content

Commit

Permalink
PMM-13487 better compat for shasum
Browse files Browse the repository at this point in the history
  • Loading branch information
ademidoff committed Feb 15, 2025
1 parent 77100c5 commit ff2f8b4
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions build/scripts/build-server-rpm
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,24 @@ get_rpm_version() {

get_shasum256() {
local DIR=${1:-}
local SHASUM=sha256sum
if [ ! -d "$DIR" ]; then
echo -e "Error: directory '$1' does not exist, exiting..."
echo
echo "Error: directory '$1' does not exist, exiting..." >&2
exit 1
fi

find "$DIR" -type f -print0 | sort -z | xargs -0 shasum -a 256 | shasum -a 256 | cut -d " " -f1 | cut -c 1-8
if ! command -v sha256sum &> /dev/null; then
if command -v shasum &> /dev/null; then
SHASUM="shasum -a 256"
else
echo
echo "Error: 'sha256sum' or 'shasum' command not found, exiting..." >&2
exit 1
fi
fi

find "$DIR" -type f -print0 | sort -z | xargs -0 "$SHASUM" | "$SHASUM" | cut -d " " -f1 | cut -c 1-8
}

is_build_needed() {
Expand Down

0 comments on commit ff2f8b4

Please sign in to comment.