Skip to content

Commit

Permalink
build: Validate MacOSX notarization requirements to simplify later test
Browse files Browse the repository at this point in the history
and also fail on wrong configuration in place of skipping notarization
  • Loading branch information
g-bougard committed Feb 20, 2025
1 parent bfbfe66 commit 94a80b2
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions contrib/macosx/glpi-agent-packaging.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,22 @@ case "$(uname -s) $ARCH" in
;;
esac

# Check notarization requirements
if [ "$NOTARIZE" == "yes" ]; then
if [ -z "$NOTARIZE_USER" ]; then
echo "Can't planify notarization with empty NOTARIZE_USER" >&2
exit 4
fi
if [ -z "$NOTARIZE_PASSWORD" ]; then
echo "Can't planify notarization with empty NOTARIZE_PASSWORD" >&2
exit 5
fi
if [ -z "$NOTARIZE_TEAMID" ]
echo "Can't planify notarization with empty NOTARIZE_TEAMID" >&2
exit 6
fi
fi

export MACOSX_DEPLOYMENT_TARGET

BUILD_PREFIX="/Applications/GLPI-Agent"
Expand Down Expand Up @@ -463,7 +479,7 @@ fi
</dict>
BUILD_INFO
fi
if [ -n "$NOTARIZE_USER" -a -n "$NOTARIZE_PASSWORD" -a -n "$NOTARIZE_TEAMID" -a "$NOTARIZE" == "yes" ]; then
if [ "$NOTARIZE" == "yes" ]; then
cat >>pkg/build-info.plist <<-BUILD_INFO
<key>notarization_info</key>
<dict>
Expand Down Expand Up @@ -579,7 +595,7 @@ mv -vf "pkg/build/$PKG" "build/$PKG"
[ -n "$INSTSIGNID" ] && pkgutil --check-signature "build/$PKG"

# Notarization check
[ -n "$NOTARIZE_USER" -a -n "$NOTARIZE_PASSWORD" -a -n "$NOTARIZE_TEAMID" -a "$NOTARIZE" == "yes" ] && xcrun stapler validate "build/$PKG"
[ "$NOTARIZE" == "yes" ] && xcrun stapler validate "build/$PKG"

rm -f "build/$DMG"
echo "Create DMG"
Expand Down

0 comments on commit 94a80b2

Please sign in to comment.