Browse Source
fixes #6128 some of this is based on:mastere1354632d2/scripts/package/macos-notarize-app.sh
1eb8b71e7d
24e44e9784
5abec73eee
SomberNight
5 years ago
5 changed files with 175 additions and 71 deletions
@ -1,23 +0,0 @@ |
|||||
#!/usr/bin/env bash |
|
||||
|
|
||||
. $(dirname "$0")/../build_tools_util.sh |
|
||||
|
|
||||
|
|
||||
function DoCodeSignMaybe { # ARGS: infoName fileOrDirName codesignIdentity |
|
||||
infoName="$1" |
|
||||
file="$2" |
|
||||
identity="$3" |
|
||||
deep="" |
|
||||
if [ -z "$identity" ]; then |
|
||||
# we are ok with them not passing anything; master script calls us unconditionally even if no identity is specified |
|
||||
return |
|
||||
fi |
|
||||
if [ -d "$file" ]; then |
|
||||
deep="--deep" |
|
||||
fi |
|
||||
if [ -z "$infoName" ] || [ -z "$file" ] || [ -z "$identity" ] || [ ! -e "$file" ]; then |
|
||||
fail "Argument error to internal function DoCodeSignMaybe()" |
|
||||
fi |
|
||||
info "Code signing ${infoName}..." |
|
||||
codesign -f -v $deep -s "$identity" "$file" || fail "Could not code sign ${infoName}" |
|
||||
} |
|
@ -0,0 +1,19 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
||||
|
<plist version="1.0"> |
||||
|
<dict> |
||||
|
<!-- These are required for binaries built by PyInstaller --> |
||||
|
<!-- see pyinstaller/pyinstaller#4629 --> |
||||
|
<key>com.apple.security.cs.allow-unsigned-executable-memory</key> |
||||
|
<true/> |
||||
|
<key>com.apple.security.cs.disable-library-validation</key> |
||||
|
<true/> |
||||
|
|
||||
|
<!-- These are required for USB HID access (hw wallets). --> |
||||
|
<!-- see https://github.com/Electron-Cash/Electron-Cash/commit/5abec73eee0cdeb725e3c5a989621ec4ccfb92a0 --> |
||||
|
<key>com.apple.security.cs.allow-dyld-environment-variables</key> |
||||
|
<true/> |
||||
|
<key>com.apple.security.cs.allow-jit</key> |
||||
|
<true/> |
||||
|
</dict> |
||||
|
</plist> |
@ -0,0 +1,77 @@ |
|||||
|
#!/usr/bin/env bash |
||||
|
# from https://github.com/metabrainz/picard/blob/e1354632d2db305b7a7624282701d34d73afa225/scripts/package/macos-notarize-app.sh |
||||
|
|
||||
|
|
||||
|
if [ -z "$1" ]; then |
||||
|
echo "Specify app bundle as first parameter" |
||||
|
exit 1 |
||||
|
fi |
||||
|
|
||||
|
if [ -z "$APPLE_ID_USER" ] || [ -z "$APPLE_ID_PASSWORD" ]; then |
||||
|
echo "You need to set your Apple ID credentials with \$APPLE_ID_USER and \$APPLE_ID_PASSWORD." |
||||
|
exit 1 |
||||
|
fi |
||||
|
|
||||
|
APP_BUNDLE=$(basename "$1") |
||||
|
APP_BUNDLE_DIR=$(dirname "$1") |
||||
|
|
||||
|
cd "$APP_BUNDLE_DIR" || exit 1 |
||||
|
|
||||
|
# Package app for submission |
||||
|
echo "Generating ZIP archive ${APP_BUNDLE}.zip..." |
||||
|
ditto -c -k --rsrc --keepParent "$APP_BUNDLE" "${APP_BUNDLE}.zip" |
||||
|
|
||||
|
# Submit for notarization |
||||
|
echo "Submitting $APP_BUNDLE for notarization..." |
||||
|
RESULT=$(xcrun altool --notarize-app --type osx \ |
||||
|
--file "${APP_BUNDLE}.zip" \ |
||||
|
--primary-bundle-id org.electrum.electrum \ |
||||
|
--username $APPLE_ID_USER \ |
||||
|
--password @env:APPLE_ID_PASSWORD \ |
||||
|
--output-format xml) |
||||
|
|
||||
|
if [ $? -ne 0 ]; then |
||||
|
echo "Submitting $APP_BUNDLE failed:" |
||||
|
echo "$RESULT" |
||||
|
exit 1 |
||||
|
fi |
||||
|
|
||||
|
REQUEST_UUID=$(echo "$RESULT" | xpath \ |
||||
|
"//key[normalize-space(text()) = 'RequestUUID']/following-sibling::string[1]/text()" 2> /dev/null) |
||||
|
|
||||
|
if [ -z "$REQUEST_UUID" ]; then |
||||
|
echo "Submitting $APP_BUNDLE failed:" |
||||
|
echo "$RESULT" |
||||
|
exit 1 |
||||
|
fi |
||||
|
|
||||
|
echo "$(echo "$RESULT" | xpath \ |
||||
|
"//key[normalize-space(text()) = 'success-message']/following-sibling::string[1]/text()" 2> /dev/null)" |
||||
|
|
||||
|
# Poll for notarization status |
||||
|
echo "Submitted notarization request $REQUEST_UUID, waiting for response..." |
||||
|
sleep 60 |
||||
|
while : |
||||
|
do |
||||
|
RESULT=$(xcrun altool --notarization-info "$REQUEST_UUID" \ |
||||
|
--username "$APPLE_ID_USER" \ |
||||
|
--password @env:APPLE_ID_PASSWORD \ |
||||
|
--output-format xml) |
||||
|
STATUS=$(echo "$RESULT" | xpath \ |
||||
|
"//key[normalize-space(text()) = 'Status']/following-sibling::string[1]/text()" 2> /dev/null) |
||||
|
|
||||
|
if [ "$STATUS" = "success" ]; then |
||||
|
echo "Notarization of $APP_BUNDLE succeeded!" |
||||
|
break |
||||
|
elif [ "$STATUS" = "in progress" ]; then |
||||
|
echo "Notarization in progress..." |
||||
|
sleep 20 |
||||
|
else |
||||
|
echo "Notarization of $APP_BUNDLE failed:" |
||||
|
echo "$RESULT" |
||||
|
exit 1 |
||||
|
fi |
||||
|
done |
||||
|
|
||||
|
# Staple the notary ticket |
||||
|
xcrun stapler staple "$APP_BUNDLE" |
Loading…
Reference in new issue