diff --git a/buildInstallomatorPkg.sh b/buildInstallomatorPkg.sh index aac9ac5..d5863fd 100755 --- a/buildInstallomatorPkg.sh +++ b/buildInstallomatorPkg.sh @@ -10,66 +10,19 @@ export PATH=/usr/bin:/bin:/usr/sbin:/sbin pkgname="Installomator" -version="0.5" +version="0.6" identifier="com.scriptingosx.${pkgname}" install_location="/usr/local/Installomator/" signature="Developer ID Installer: Armin Briegel (JME5BW3F3R)" dev_team="JME5BW3F3R" # asc-provider dev_account="developer@scriptingosx.com" -dev_keychain_label="Developer-altool" +dev_keychain_label="notary-scriptingosx" scriptfolder=$(dirname "$0") projectfolder=$(mktemp -d) payloadfolder="${projectfolder}/payload" -# MARK: functions -requeststatus() { # $1: requestUUID - requestUUID=${1?:"need a request UUID"} - req_status=$(xcrun altool --notarization-info "$requestUUID" \ - --username "$dev_account" \ - --password "@keychain:$dev_keychain_label" 2>&1 | awk -F ': ' '/Status:/ { print $2; }' ) - echo "$req_status" -} - -notarizefile() { # $1: path to file to notarize, $2: identifier - filepath=${1:?"need a filepath"} - identifier=${2:?"need an identifier"} - - # upload file - echo "## uploading $filepath for notarization" - requestUUID=$(xcrun altool --notarize-app \ - --primary-bundle-id "$identifier" \ - --username "$dev_account" \ - --password "@keychain:$dev_keychain_label" \ - --asc-provider "$dev_team" \ - --file "$filepath" 2>&1 | awk '/RequestUUID/ { print $NF; }') - - echo "Notarization RequestUUID: $requestUUID" - - if [[ $requestUUID == "" ]]; then - echo "could not upload for notarization" - exit 1 - fi - - # wait for status to be not "in progress" any more - request_status="in progress" - while [[ "$request_status" == "in progress" ]]; do - echo -n "waiting... " - sleep 10 - request_status=$(requeststatus "$requestUUID") - echo "$request_status" - done - - if [[ $request_status != "success" ]]; then - echo "## could not notarize $filepath" - xcrun altool --notarization-info "$requestUUID" \ - --username "$dev_account" \ - --password "@keychain:$dev_keychain_label" - exit 1 - fi - -} # MARK: main code starts here @@ -94,7 +47,6 @@ pkgbuild --root "${projectfolder}/payload" \ --install-location "${install_location}" \ "${pkgpath}" - # build the product archive productpath="${scriptfolder}/${pkgname}-${version}.pkg" @@ -108,8 +60,10 @@ productbuild --package "${pkgpath}" \ # clean up project folder rm -Rf "${projectfolder}" +# NOTE: notarytool requires Xcode 13 + # upload for notarization -notarizefile "$productpath" "$identifier" +xcrun notarytool submit "$productpath" --keychain-profile "$dev_keychain_label" --wait # staple result echo "## Stapling $productpath"