From 886f49f2dd16cf7d6a38cb1a01af257260df2c59 Mon Sep 17 00:00:00 2001 From: Marc Culler Date: Wed, 25 Oct 2023 12:15:05 -0500 Subject: [PATCH] Add notarization. --- .github/workflows/macOS.yml | 6 +-- build-mac-app.sh | 5 +++ macOS/bin/notarize.sh | 18 +++++++++ macOS/bin/sign-bundle.sh | 6 ++- macOS/dmg-maker/background.png | Bin 0 -> 11735 bytes macOS/dmg-maker/dmg-maker.py | 68 +++++++++++++++++++++++++++++++++ macOS/dmg-maker/dotDS_Store | Bin 0 -> 12292 bytes 7 files changed, 97 insertions(+), 6 deletions(-) create mode 100644 macOS/bin/notarize.sh create mode 100644 macOS/dmg-maker/background.png create mode 100755 macOS/dmg-maker/dmg-maker.py create mode 100644 macOS/dmg-maker/dotDS_Store diff --git a/.github/workflows/macOS.yml b/.github/workflows/macOS.yml index 2d9db6f..799ddec 100644 --- a/.github/workflows/macOS.yml +++ b/.github/workflows/macOS.yml @@ -55,10 +55,8 @@ jobs: - name: assemble bundle run: | bash build-mac-app.sh - mv macos/snappy/SnapPy.app . - tar cfz Snappy_app.tgz SnapPy.app - uses: actions/upload-artifact@v3 with: - name: SnapPy_app.tgz - path: ./SnapPy_app.tgz + name: SnapPy.dmg + path: ./macOS/dmg-maker/SnapPy.dmg diff --git a/build-mac-app.sh b/build-mac-app.sh index a24516b..bda112b 100644 --- a/build-mac-app.sh +++ b/build-mac-app.sh @@ -3,3 +3,8 @@ cd macOS rm -rf snappy/SnapPy.app . bin/make-bundle.sh . bin/sign-bundle.sh +rm -rf dist +mkdir dist +mv snappy/SnapPy.app dist +. bin/notarize.sh + diff --git a/macOS/bin/notarize.sh b/macOS/bin/notarize.sh new file mode 100644 index 0000000..0cf0660 --- /dev/null +++ b/macOS/bin/notarize.sh @@ -0,0 +1,18 @@ +#!/bin/bash +source Ids.sh +set -e +cd dmg-maker +APP="../dist/SnapPy.app" +DMG="SnapPy.dmg" +OPTIONS="--wait --no-progress --apple-id $USERNAME \ +--team-id $IDENTITY --password $PASSWORD --wait" +python3 dmg-maker.py +echo "Notarizing app ..." +xcrun notarytool submit $DMG $OPTIONS +xcrun stapler staple $APP +python3 dmg-maker.py +echo "Signing disk image ..." +codesign -s $IDENTITY --timestamp --options runtime --force $DMG +echo "Notarizing disk image ..." +xcrun notarytool submit $DMG $OPTIONS +xcrun stapler staple $DMG diff --git a/macOS/bin/sign-bundle.sh b/macOS/bin/sign-bundle.sh index bc81fea..c30aa4d 100644 --- a/macOS/bin/sign-bundle.sh +++ b/macOS/bin/sign-bundle.sh @@ -4,7 +4,7 @@ set -e APP=SnapPy.app WORK_DIR=snappy -echo Signing SnapPy.app +echo "Signing $APP ..." FRAMEWORKS=$APP/Contents/Frameworks MACOS=$APP/Contents/MacOS pushd $WORK_DIR @@ -24,6 +24,8 @@ done $SIGN $APP # Of course spctl will fail, since the app is not notarized. -# But we want to see what it says. +# But we want to see what it says anyway. +echo "Verifying with spctl - should be rejected as unnotarized ..." spctl --verbose --assess SnapPy.app || true popd + diff --git a/macOS/dmg-maker/background.png b/macOS/dmg-maker/background.png new file mode 100644 index 0000000000000000000000000000000000000000..25b31a818afb11f52c3466cf2840278d8338ac6f GIT binary patch literal 11735 zcmdsdS6owH&}|T$CjbBd#Oi9wdH?{{(cSL@Je<4l z6XDdScNctDH4_g2fRN(;g9XUUrUd{9blxc`y?XW5#nZ*(t&8gubtR=IuI?`O?>^W8 z06z0M`VI#Ao78frh$BVK$lzp67d-j-}G&CyFMR!(C_n9v@l|89j2j;#c4}(|)=!cGEBmLX~53>c(-q@rY8@M0CZ1 ziAofi$^V89_6@A83o3*VaJT}<@ao>MdR(((0nP$tW%<~;aXSH6K2wBvfNt%qZehlV zThcAX40EjDFsyFRL`hA&U`l|3Z@gk5KtTm7I47M;AMouVz#0m+T?4!l09bPeZA<}z zbIvmSumEPstW;Rv5&=&r>>`x`Z)E`G>*zz8H)GLQyI0gEgVuWLd@_4+;EMI z1eu@0)M@xA#cdwgWGV>$f@IJ=3lSy#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DpUrwvq@3>F?b3W&|Q`a}r#1R==tv?N@yQd7uC%3GIwxS7s%405avd19- z;%3Wx_QYwYjb}*Q+4F-LyU+iTVilQMGNEcVCual}s5PKF=o%^Tu@J1)Vr3q3wEsw& zF=tFtCa)^c$whi&O~$Cj`;vgdN&7yKZ|H4Dp}lL3tNy8H>jex~7i*_;^n8(>F?O?V zKAt1}{!zg2U3I9?-Cnp^EF2sc-;e*7DrSLJp0Yt+8X5=7L0%D70iH?)YF!>)xsp<5 zu4fmqAmv7GfqTI0?<1^Bh3^&NE5qAKY3Nv)U%PiTG(tj1-{`{e%A!A6QWms^oRHGq zZSh70-=d*rJ0IdG|2vF=%EYIaT7h>B^lZz@R;r18|%B2;0Hu0Mt1jDOKeJQz$tV5qa4UAKYlj}SH2(o zvfbbG|9RKof8XL=Deynd{NJ!RtNG;rqhX0%Hn%Q-9e;=fLfG=}-J3H2^%pOdD;2Fj F{U7n1m4N^N literal 0 HcmV?d00001 diff --git a/macOS/dmg-maker/dmg-maker.py b/macOS/dmg-maker/dmg-maker.py new file mode 100755 index 0000000..e19ec89 --- /dev/null +++ b/macOS/dmg-maker/dmg-maker.py @@ -0,0 +1,68 @@ +#! /usr/bin/env python3 +""" +Creates a nice disk image, with background and /Applications symlink +for the app. + +One issue here is that Snow Leopard uses a different (undocumented, of +course) format for the .DS_Store files than earlier versions, which makes +disk images created on it not work correctly on those systems. Thus this "solution" uses a .DS_Store file created on Leopard as follows: + +(1) Use Disk Utility to create a r/w DMG large enough to store everything and open it. + +(2) Copy over the application and add a symlink to /Applications. + +(3) Create a subdirectory ".background" containing the file "background.png". + +(4) Open the disk image in the Finder and do View->Hide Tool Bar and then View->Show View Options. To add the background picture inside the hidden directory, use cmd-shift-g in the file dialog. Adjust everything to suit, close window and open it. Then copy the .DS_Store file to dotDS_store. + +""" +import os +import re +import shutil +from subprocess import check_call +from math import ceil + +name = "SnapPy" +dist_dir = "../dist" +print('dmg name is %s' % name) + +def main(): + # Make sure the dmg isn't currently mounted, or this won't work. + mount_name = "/Volumes/" + name + while os.path.exists(mount_name): + print("Trying to eject " + mount_name) + subprocess.check_call("hdiutil detach " + mount_name) + # Remove old dmg if there is one + while os.path.exists(name + ".dmg"): + os.remove(name + ".dmg") + while os.path.exists(name + "-tmp.dmg"): + os.remove(name + "-tmp.dmg") + # Add symlink to /Applications if not there: + if not os.path.exists(dist_dir + "/Applications"): + os.symlink("/Applications/", dist_dir + "/Applications") + + # copy over the background and .DS_Store file + background = os.path.join(dist_dir, '.background') + shutil.rmtree(background, ignore_errors=True) + os.mkdir(background) + shutil.copy('background.png', background) + shutil.copy('dotDS_Store', os.path.join(dist_dir, '.DS_Store')) + + # figure out the needed size: + raw_size = os.popen("du -sh " + dist_dir).read() + size, units = re.search("([0-9.]+)([KMG])", raw_size).groups() + new_size = "%d" % ceil(1.2 * float(size)) + units + # Run the main script: + check_call(['hdiutil', 'makehybrid', '-hfs', + '-hfs-volume-name', 'SnapPy', + '-hfs-openfolder', dist_dir, + '-o', 'SnapPy-tmp.dmg', + dist_dir] ) + check_call(['hdiutil', 'convert', '-format', 'UDZO', + 'SnapPy-tmp.dmg', '-o', '%s.dmg'%name]) + os.remove("SnapPy-tmp.dmg") + # Delete symlink to /Applications or egg_info will be glacial on newer setuptools. + os.remove(dist_dir + "/Applications") + +if __name__ == "__main__": + main() diff --git a/macOS/dmg-maker/dotDS_Store b/macOS/dmg-maker/dotDS_Store new file mode 100644 index 0000000000000000000000000000000000000000..c2018c901d61fb60fef3fb9963742d0ad71d336e GIT binary patch literal 12292 zcmeHMId2m|6n=x9D2L+&0w^4UMHCc(7X+1+!ZAi90*go?5lCG2u4Auk?^<3TgvuRN zBwBt35;aY#h>`+IY9u7uG{8599mftrNGXVTPn!A0Z{9KUz1{JyO++HybgvW55z!c$ z#F+=upMpF_v1O-`9N%A7<>BlpYzGce46es@o#@7~GeEB){95!^^$Pr^Y^ zV(He}{d^Equv9vF`l7$nh;mS56|&iCc3f++m*mCLi48U(<+6fppH-9wZ?N= zfr(;ae3LqU;1}{iql)>i$c!#>s=Tmjm>4mwsd-LA$B@eCi!_b-QCh(` z2hB2V&@nn=_rgsqT}l%^Od_ zD@C(U9!=HT2^}EeR^>JDmooBg^C5U`yMVGmhX_tGRLk7nNdlYxC86 z*mPO_gt4GGxgxaHX!h}?$j;l3k)2Zyh+baAj+Xj2lw1u9^)Tr+{dKQUag*(!UQU`) zXjrJ#lD(YCflbEgEKQ*fZB(G2^#p2CRrNScG0Lind8kSQ6$`0E7A;Z+wV7Ax?QVKo zrZ;6Ufb@1Ry}dX6ED4+F1okv7uR+-$FY*2?9t42BKMXOpU@Co520I#|f$$FjiU#hO0cL<1 gU