-
Notifications
You must be signed in to change notification settings - Fork 2
/
notarize.sh
69 lines (53 loc) · 2.87 KB
/
notarize.sh
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/sh
if [ "$EUID" -ne 0 ]
then echo "Error: Please run this command as root using sudo..."
echo ""
exit
fi
PLUGIN_NAME="EXAMPLE"
DEVELOPER_ID="USER NAME (XXXXXXXXXX)"
APP_PASS="xxxx-xxxx-xxxx-xxxx"
APPLE_ID="[email protected]"
IDENTIFIER="com.xxxx.pkg"
VERSION="1.0"
VERSION_UNDERSCORES="1_0"
if ! [ -d "tmp" ]; then
`mkdir -p tmp`
fi
if ! [ -d "install/resources" ]; then
`mkdir -p install/resources`
fi
UPPER=$(echo "$PLUGIN_NAME" | tr '[:lower:]' '[:upper:]' )
BUILD_FOLDER=build/"$UPPER"_artefacts/Release
cp -r "$BUILD_FOLDER"/AU/"$PLUGIN_NAME".component tmp/
cp -r "$BUILD_FOLDER"/VST3/"$PLUGIN_NAME".vst3 tmp/
cp EULA.txt install/resources
cp README.txt install/resources
cp Welcome.txt install/resources
cp resources/img/BG.png install/resources
AU_PATH=tmp/"$PLUGIN_NAME".component
VST3_PATH=tmp/"$PLUGIN_NAME".vst3
#use pkgbuild to build the plugin installers - and sign with Apple Developer ID Application certificate
sudo codesign -s "Developer ID Application: $DEVELOPER_ID" "$AU_PATH" --timestamp --force --deep -o runtime,hard
pkgbuild --install-location /Library/Audio/Plug-Ins/Components --identifier "$IDENTIFIER"au --version $VERSION --component "$AU_PATH" install/"$PLUGIN_NAME"_au.pkg
sudo codesign -s "Developer ID Application: $DEVELOPER_ID" "$VST3_PATH" --timestamp --force --deep -o runtime,hard
pkgbuild --install-location /Library/Audio/Plug-Ins/VST3 --identifier "$IDENTIFIER"vst3 --version $VERSION --component "$VST3_PATH" install/"$PLUGIN_NAME"_vst3.pkg
cd install
# use productbuild to synthesize installers
productbuild --synthesize --package "$PLUGIN_NAME"_au.pkg --package "$PLUGIN_NAME"_vst3.pkg distribution.xml
# include EULA, README, Welcome file, and Background image in installer
gsed -i~ '3i\ <license file="EULA.txt" mime-type="text/plain" />' distribution.xml
gsed -i~ '3i\ <welcome file="Welcome.txt" mime-type="text/plain" />' distribution.xml
gsed -i~ '3i\ <readme file="README.txt" mime-type="text/plain" />' distribution.xml
gsed -i~ '3i\ <background file="BG.png" alignment="bottomleft" mime-type="image/png" scaling="tofit" />' distribution.xml
gsed -i~ "3i\ <title>$PLUGIN_NAME</title>" distribution.xml
# use productbuild to combine everything into a single installer and sign with Apple Developer ID Installer certificate
productbuild --distribution distribution.xml --resources resources/ "$PLUGIN_NAME".pkg
productsign --sign "Developer ID Installer: $DEVELOPER_ID" "$PLUGIN_NAME".pkg "$PLUGIN_NAME"_MacOS_v_"$VERSION_UNDERSCORES".pkg
# notarize the installer
xcrun altool --notarize-app --primary-bundle-id "$IDENTIFIER" --username "$APPLE_ID" --password "$APP_PASS" --file "$PLUGIN_NAME"_MacOS_v_"$VERSION_UNDERSCORES".pkg
cd ..
rm -r tmp
echo "Done!"
# Wait for email (wait a few minutes), and then when success email is received, staple the ticket to the installer
#sudo xcrun stapler staple install/$PLUGIN_NAME_MacOS_v_1_0.pkg