hbnotarize: switch to the new notarytool, altool is deprecated and will stop working next year.

This commit is contained in:
Damiano galassi 2022-06-10 13:12:18 +02:00
parent 8ff5550f61
commit 15d2070dc2
No known key found for this signature in database
GPG Key ID: 5452E231DFDBCA11
2 changed files with 16 additions and 8 deletions

View File

@ -23,7 +23,7 @@ SELF="${0}"
SELF_NAME=$(basename "${SELF}") SELF_NAME=$(basename "${SELF}")
HELP="\ HELP="\
usage: ${SELF_NAME} [-h] usage: ${SELF_NAME} [-h]
${SELF_NAME} username application [application2 ...] ${SELF_NAME} username teamid application [application2 ...]
where: where:
-h display this help text -h display this help text
" "
@ -69,11 +69,19 @@ if [[ "${USERNAME}" == "" ]]; then
fi fi
shift 1 shift 1
TEAMID="${1:-}"
if [[ "${TEAMID}" == "" ]]; then
exit_with_error 1 "${SELF_NAME}: TeamID not specified" true
fi
shift 1
if [[ ${#@} -eq 0 ]]; then if [[ ${#@} -eq 0 ]]; then
exit_with_error 1 "${SELF_NAME}: application not specified" true exit_with_error 1 "${SELF_NAME}: application not specified" true
fi fi
echo "Username: ${USERNAME}" echo "Username: ${USERNAME}"
echo "TeamID: ${TEAMID}"
echo -n "Password: " echo -n "Password: "
read -s PASSWORD read -s PASSWORD
echo echo
@ -81,7 +89,7 @@ if [[ "${PASSWORD}" == "" ]]; then
exit_with_error 1 "${SELF_NAME}: password not specified" true exit_with_error 1 "${SELF_NAME}: password not specified" true
fi fi
CREDENTIALS="--username ${USERNAME} --password ${PASSWORD}" CREDENTIALS="--apple-id=${USERNAME} --password=${PASSWORD} --team-id=${TEAMID}"
for TARGET in "${@}"; do for TARGET in "${@}"; do
@ -101,7 +109,7 @@ for TARGET in "${@}"; do
echo " Uploading app to notary service" echo " Uploading app to notary service"
uuid=$(xcrun altool --notarize-app --primary-bundle-id "fr.handbrake.HandBrake" ${CREDENTIALS} --file "${ARCHIVE}" 2>&1 | grep 'RequestUUID' | awk '{ print $3 }') uuid=$(xcrun notarytool submit "${ARCHIVE}" ${CREDENTIALS} 2>&1 | grep -m 1 'id:' | awk '{ print $2 }')
echo " Upload successful" echo " Upload successful"
echo " Identifier = ${uuid}" echo " Identifier = ${uuid}"
@ -111,9 +119,9 @@ for TARGET in "${@}"; do
while : while :
do do
notaryStatus=$(xcrun altool --notarization-info "${uuid}" ${CREDENTIALS} 2>&1) notaryStatus=$(xcrun notarytool info "${uuid}" ${CREDENTIALS} 2>&1)
status=$(echo "$notaryStatus" | grep 'Status\:' | awk '{ print $2 }') status=$(echo "$notaryStatus" | grep 'status:' | awk '{ print $2 }')
if [ "${status}" = "success" ]; then if [ "${status}" = "Accepted" ]; then
# It's not possible to staple a command line exec # It's not possible to staple a command line exec
if [[ "${EXTENSION}" != "${TARGET}" ]]; then if [[ "${EXTENSION}" != "${TARGET}" ]]; then
xcrun stapler staple "${TARGET}" >>"${LOG}" 2>&1 || exit_with_error 1 "Failed to staple the app. More info may be available in ${LOG}" xcrun stapler staple "${TARGET}" >>"${LOG}" 2>&1 || exit_with_error 1 "Failed to staple the app. More info may be available in ${LOG}"
@ -123,7 +131,7 @@ for TARGET in "${@}"; do
echo " Success" echo " Success"
fi fi
break break
elif [ "$status" = "in" ]; then elif [ "$status" = "In" ]; then
echo " In progress" echo " In progress"
sleep 20 sleep 20
else else

View File

@ -79,7 +79,7 @@ MACOSX.SIGN.flags = $(if $(filter 1,$(SECURITY.sandbox)),-sr,-r)
MACOSX.SIGN.id = $(if $(ID),$(ID),-) MACOSX.SIGN.id = $(if $(ID),$(ID),-)
MACOSX.SIGN = $(strip $(MACOSX.src/)hbsign $(MACOSX.SIGN.flags) '$(MACOSX.SIGN.id)' $(MACOSX.xroot/)HandBrake.app $(MACOSX.xroot/)HandBrakeCLI) MACOSX.SIGN = $(strip $(MACOSX.src/)hbsign $(MACOSX.SIGN.flags) '$(MACOSX.SIGN.id)' $(MACOSX.xroot/)HandBrake.app $(MACOSX.xroot/)HandBrakeCLI)
MACOSX.NOTARIZE = $(strip $(MACOSX.src/)hbnotarize '$(USERNAME)' $(MACOSX.xroot/)HandBrake.app $(MACOSX.xroot/)HandBrakeCLI) MACOSX.NOTARIZE = $(strip $(MACOSX.src/)hbnotarize '$(USERNAME)' '$(TEAMID)' $(MACOSX.xroot/)HandBrake.app $(MACOSX.xroot/)HandBrakeCLI)
############################################################################### ###############################################################################
## ##