summaryrefslogtreecommitdiff
path: root/indra/newview/installers/darwin/apple-notarize.sh
blob: b953af81af37f2acc0bddc06802a9d307cf66a49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/sh
CONFIG_FILE="$build_secrets_checkout/code-signing-osx/notarize_creds.sh"
if [ -f "$CONFIG_FILE" ]; then
    source $CONFIG_FILE
    app_file="$1"
    zip_file=${app_file/app/zip}
    ditto -c -k --keepParent "$app_file" "$zip_file"
    if [ -f "$zip_file" ]; then
        requestUUID=$(xcrun altool --notarize-app --primary-bundle-id "com.secondlife.viewer" \
                                --username $USERNAME \
                                --password $PASSWORD \
                                --asc-provider $ASC_PROVIDER \
                                --file "$zip_file" 2>&1 \
                    | awk '/RequestUUID/ { print $NF; }')

        echo "Apple Notarization RequestUUID: $requestUUID"

        if [[ -n $requestUUID ]]; then
            status="in progress"
            while [[ "$status" == "in progress" ]]; do
                sleep 30
                status=$(xcrun altool --notarization-info "$requestUUID" \
                                            --username $USERNAME \
                                            --password $PASSWORD 2>&1 \
                                | awk -F ': ' '/Status:/ { print $2; }' )
                echo "$status"
            done
            # log results
            xcrun altool --notarization-info "$requestUUID" \
                        --username $USERNAME \
                        --password $PASSWORD

            #remove temporary file
            rm "$zip_file"

            if [["$status" == "success"]]; then
                xcrun stapler staple "$app_file"
            elif [["$status" == "invalid"]]; then
                exit 1
            fi
        fi
    fi
fi