Created
October 27, 2019 16:41
-
-
Save talkingmoose/295f6e03b2e82e8856583e14f0e559cd to your computer and use it in GitHub Desktop.
Add this to a new Automator Actions item and save as a Service. Right-click or Control-click an app or kext to verify notarization. Optionally, run as a script in Terminal using the path to an app or kext as the first argument.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| testFile="$1" | |
| if [[ "$testFile" != *'.app' ]] && [[ "$testFile" != *'.kext' ]] ; then | |
| theCommand='display dialog "This item does not appear to be an application or kernel extension." with title "Verify Notarization" buttons {"OK"} default button {"OK"}' | |
| else | |
| testBinary=$( /usr/bin/stapler validate "$testFile" | /usr/bin/grep '64-bit' ) | |
| # per the man page, stapler returns 0 on successful stapling or validation | |
| if [ "$?" != 0 ] && [[ "$testFile" = *'.kext' ]] ; then | |
| theCommand='display dialog "Warning! This kext is not notarized and will not be compatible with macOS Mojave 10.14.5 and later." with title "Verify Notarization" buttons {"OK"} default button {"OK"}' | |
| elif [ "$?" != 0 ] && [[ "$testFile" = *'.app' ]] ; then | |
| theCommand='display dialog "Alert! This applications is not notarized and will not be compatible with a future version of macOS Mojave after 10.14.5." with title "Verify Notarization" buttons {"OK"} default button {"OK"}' | |
| else | |
| theCommand='display dialog "Confirmed Notarization is valid." with title "Verify Notarization" buttons {"OK"} default button {"OK"}' | |
| fi | |
| fi | |
| /usr/bin/osascript -e "$theCommand" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment