-
Notifications
You must be signed in to change notification settings - Fork 167
Expand file tree
/
Copy pathcreate_osx_installer.sh
More file actions
executable file
·161 lines (130 loc) · 5.92 KB
/
Copy pathcreate_osx_installer.sh
File metadata and controls
executable file
·161 lines (130 loc) · 5.92 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#!/usr/local/bin/bash
set -e
development=false
# Check if using development switch
if [ "$1" != "" ]; then
if [[ "$1" == "-d" ]] || [[ "$1" == "--development" ]]; then
development=true
fi
fi
if !($development); then
if [ "x$AC_USERNAME" = x ]; then
echo "Notarization username not set (AC_USERNAME)"
exit 1
fi
if [ "x$AC_PASSWORD" = x ]; then
echo "Notarization account password not set (AC_PASSWORD)"
exit 1
fi
git reset --hard
cd client
git reset --hard
cd ..
python3 build/replace_versions.py
fi
rm -R osx-pkg || true
rm -R osx-pkg2 || true
./download_cryptopp.sh
mkdir -p osx-pkg/Library/LaunchDaemons
cp osx_installer/daemon.plist osx-pkg/Library/LaunchDaemons/org.urbackup.client.plist
mkdir -p osx-pkg/Library/LaunchAgents
cp osx_installer/agent.plist osx-pkg/Library/LaunchAgents/org.urbackup.client.plist
./configure --enable-embedded-cryptopp --enable-clientupdate CXXFLAGS="-mmacosx-version-min=10.10 -DNDEBUG -DURB_WITH_CLIENTUPDATE" CFLAGS="-DNDEBUG -DURB_WITH_CLIENTUPDATE" LDFLAGS="-mmacosx-version-min=10.10" --prefix="/Applications/UrBackup Client.app/Contents/MacOS" --sysconfdir="/Library/Application Support/UrBackup Client/etc" --localstatedir="/Library/Application Support/UrBackup Client/var"
make clean
make -j5
make install DESTDIR=$PWD/osx-pkg2
mkdir -p "osx-pkg2/Applications/UrBackup Client.app/Contents/MacOS/bin"
mkdir -p "osx-pkg2/Applications/UrBackup Client.app/Contents/MacOS"
mkdir -p "osx-pkg2/Applications/UrBackup Client.app/Contents/Resources"
if !($development); then
cp osx_installer/info.plist "osx-pkg2/Applications/UrBackup Client.app/Contents/Info.plist"
else
cp osx_installer/info_development.plist "osx-pkg2/Applications/UrBackup Client.app/Contents/Info.plist"
fi
cp osx_installer/urbackup.icns "osx-pkg2/Applications/UrBackup Client.app/Contents/Resources/"
cp osx_installer/buildmacOSexclusions "osx-pkg2/Applications/UrBackup Client.app/Contents/MacOS/bin/buildmacOSexclusions"
mv "osx-pkg2/Library/Application Support" "osx-pkg/Library"
rm -R "osx-pkg2/Library"
mv "osx-pkg2/Applications/UrBackup Client.app/Contents/MacOS/bin/urbackupclientgui" "osx-pkg2/Applications/UrBackup Client.app/Contents/MacOS/"
strip "osx-pkg2/Applications/UrBackup Client.app/Contents/MacOS/urbackupclientgui"
strip "osx-pkg2/Applications/UrBackup Client.app/Contents/MacOS/sbin/urbackupclientbackend"
mkdir -p "$PWD/osx-pkg2/Applications/UrBackup Client.app/Contents/MacOS/sbin"
UNINSTALLER="$PWD/osx-pkg2/Applications/UrBackup Client.app/Contents/MacOS/sbin/urbackup_uninstall"
cat osx_installer/uninstall1.sh > "$UNINSTALLER"
cd osx-pkg
find . -type f | cut -d"." -f2-100 | while read line; do echo "rm -fv \"$line\""; done >> "$UNINSTALLER"
cd ..
cd osx-pkg2
find . -type f | cut -d"." -f2-100 | while read line; do echo "rm -fv \"$line\""; done >> "$UNINSTALLER"
cd ..
echo "rm -Rf \"/Applications/UrBackup Client.app\"" >> "$UNINSTALLER"
echo "OK=true" >> "$UNINSTALLER"
chmod +x "$UNINSTALLER"
if !($development); then
VERSION_SHORT_NUM="$version_num_short$"
VERSION_SHORT="$version_short$"
else
VERSION_SHORT_NUM="0.1"
VERSION_SHORT="0.1"
fi
function notarization_info {
echo "$UPLOAD_INFO_PLIST" > tmp.plist
xcrun altool --notarization-info `/usr/libexec/PlistBuddy -c "Print :notarization-upload:RequestUUID" tmp.plist` -u "$AC_USERNAME" -p "@env:AC_PASSWORD" --output-format xml
}
function wait_for_notarization {
echo "Waiting for notarization to finish..."
sleep 30
while true; do
REQUEST_INFO_PLIST=$(notarization_info || true)
echo "$REQUEST_INFO_PLIST" > tmp.plist
if [ "x$(/usr/libexec/PlistBuddy -c 'Print :product-errors:0:code' tmp.plist)" = x1519 ]; then
sleep 30
continue
fi
if [ "x$(/usr/libexec/PlistBuddy -c 'Print :notarization-info:Status' tmp.plist)" != "xin progress" ]; then
echo "Notarization finished"
break
fi
sleep 60
done
}
function notarize_int {
xcrun altool --notarize-app --primary-bundle-id "org.urbackup.client.frontend" -u "$AC_USERNAME" -p "@env:AC_PASSWORD" -t osx -f "$1" --output-format xml
}
function notarize {
echo "Sending $1 to notarization..."
UPLOAD_INFO_PLIST=$(notarize_int $1)
echo $UPLOAD_INFO_PLIST
wait_for_notarization
}
if !($development); then
echo "Signing code..."
security unlock-keychain -p foobar /Users/martin/Library/Keychains/dev.keychain
codesign --deep --keychain dev.keychain --sign 3Y4WACCWC5 --timestamp --options runtime osx-pkg2/Applications/UrBackup\ Client.app
ditto -c -k --keepParent "osx-pkg2/Applications" "urbackup-client.zip"
notarize "urbackup-client.zip"
xcrun stapler staple "osx-pkg2/Applications/UrBackup Client.app"
fi
rm -R pkg1 || true
mkdir pkg1 || true
pkgbuild --root osx-pkg --identifier org.urbackup.client.service --version $VERSION_SHORT_NUM --ownership recommended pkg1/output.pkg
pkgbuild --root "osx-pkg2/Applications/UrBackup Client.app" --identifier "org.urbackup.client" --version $VERSION_SHORT_NUM --scripts osx_installer/scripts2 --ownership recommended pkg1/output2.pkg --install-location "/Applications/UrBackup Client.app"
productbuild --distribution osx_installer/distribution.xml --resources osx_installer/resources --package-path pkg1 --version $VERSION_SHORT_NUM final.pkg
if !($development); then
productsign --keychain /Users/martin/Library/Keychains/dev.keychain --sign 3Y4WACCWC5 final.pkg final-signed.pkg
notarize final-signed.pkg
xcrun stapler staple final-signed.pkg
cp final-signed.pkg "UrBackup Client $VERSION_SHORT.pkg"
mkdir -p update_installer
cp final-signed.pkg update_installer/final.pkg
cp osx_installer/update_install.sh update_installer/update_install.sh
chmod +x update_installer/update_install.sh
makeself --nocomp --nomd5 --nocrc update_installer "UrBackupUpdateMac.sh" "UrBackup Client Installer for Mac OS X" ./update_install.sh
else
cp final.pkg "UrBackup Client $VERSION_SHORT.pkg"
fi
if ($development); then
sudo pkgutil --forget org.urbackup.client.service || true
sudo pkgutil --forget org.urbackup.client || true
sudo rm -R "/Applications/UrBackup Client.app" || true
fi