[Subtitles] Partial fix for text/border color gap
[xbmc.git] / tools / darwin / packaging / osx / notarize.sh
blob1c8f1322582e3c12b5b21012b833045a76a70734
1 #!/usr/bin/env bash
3 # credits: https://scriptingosx.com/2019/09/notarize-a-command-line-tool/
5 if [[ -z "$DEV_ACCOUNT" || -z "$DEV_ACCOUNT_PASSWORD" ]]; then
6 echo "skipping notarization"
7 exit 0
8 fi
10 notarizefile() { # $1: path to file to notarize, $2: identifier
11 filepath=${1:?"need a filepath"}
12 identifier=${2:?"need an identifier"}
14 # upload file
15 echo "uploading $filepath for notarization"
16 altoolOutput=$(xcrun altool \
17 --notarize-app \
18 --type osx \
19 --file "$filepath" \
20 --primary-bundle-id "$identifier" \
21 --username "$DEV_ACCOUNT" \
22 --password "$DEV_ACCOUNT_PASSWORD" \
23 ${DEV_TEAM:+--asc-provider "$DEV_TEAM"} 2>&1)
25 requestUUID=$(echo "$altoolOutput" | awk '/RequestUUID/ { print $NF; }')
27 if [[ $requestUUID == "" ]]; then
28 echo "Failed to upload:"
29 echo "$altoolOutput"
30 return 1
32 echo "requestUUID: $requestUUID, waiting..."
34 # wait for status to be not "in progress" any more
35 request_status="in progress"
36 while [[ "$request_status" == "in progress" ]]; do
37 sleep 60
38 altoolOutput=$(xcrun altool \
39 --notarization-info "$requestUUID" \
40 --username "$DEV_ACCOUNT" \
41 --password "$DEV_ACCOUNT_PASSWORD" 2>&1)
42 request_status=$(echo "$altoolOutput" | awk -F ': ' '/Status:/ { print $2; }' )
43 done
45 # print status information
46 echo "$altoolOutput"
48 if [[ $request_status != "success" ]]; then
49 echo "warning: could not notarize $filepath"
50 notarizationFailed=1
53 LogFileURL=$(echo "$altoolOutput" | awk -F ': ' '/LogFileURL:/ { print $2; }')
54 if [[ "$LogFileURL" ]]; then
55 echo -e "\nnotarization details:"
56 curl "$LogFileURL"
57 echo
59 if [[ $notarizationFailed == 1 ]]; then
60 return 1
62 return 0
65 dmg="$1"
66 notarizefile "$dmg" $(/usr/libexec/PlistBuddy -c 'Print :CFBundleIdentifier' "$2") \
67 && xcrun stapler staple "$dmg"