-
Notifications
You must be signed in to change notification settings - Fork 17
/
makeDMG.sh
executable file
·190 lines (148 loc) · 5.12 KB
/
makeDMG.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
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
#!/bin/bash
#
# parse args
#
DMG_METHOD="NEW"
release=${1:-"NO_RELEASE"}
#
# Paramaters
#
APP_NAME="Hydro-UQ"
APP_FILE="Hydro_UQ.app"
DMG_FILENAME="Hydro-UQ_Mac_Download.dmg"
# remove & rebuild app and macdeploy it
QTDIR="/Users/fmckenna/Qt/5.15.2/clang_64/"
#QTDIR="/Users/fmckenna/Qt/6.6.0/macos/"
pathToBackendApps="/Users/fmckenna/NHERI/SimCenterBackendApplications"
pathToOpenSees="/Users/fmckenna/bin/OpenSees3.6.0"
pathToDakota="/Users/fmckenna/dakota/dakota-6.16.0"
#pathToPython="/Users/fmckenna/PythonEnvR2D"
#
# source userID file containig stuff dor signing, ok if not there
#
#
# build it
#
source ./makeEXE.sh $release
cd build
rm $DMG_FILENAME
#
# Check to see if the app built
#
if ! [ -x "$(command -v open $pathApp)" ]; then
echo "$APP_FILE did not build. Exiting."
exit
fi
#
# macdeployqt it
#
macdeployqt ./Hydro_UQ.app
# copy applications folderm opensees and dakota
#echo "cp -fR $pathToBackendApps/applications ./$APP_FILE/Contents/MacOS"
mkdir ./$APP_FILE/Contents/MacOS/applications
cp -fR $pathToBackendApps/applications ./$APP_FILE/Contents/MacOS/
mkdir ./$APP_FILE/Contents/MacOS/applications/opensees
#mkdir ./$APP_FILE/Contents/MacOS/applications/opensees/bin
#mkdir ./$APP_FILE/Contents/Resources/opensees
mkdir ./$APP_FILE/Contents/MacOS/applications/dakota
#cp -fr $pathToOpenSees/bin/* ./$APP_FILE/Contents/MacOS/applications/opensees/bin
#cp -fr $pathToOpenSees/lib/* ./$APP_FILE/Contents/Resources/opensees
cp -fr $pathToOpenSees/* ./$APP_FILE/Contents/MacOS/applications/opensees
cp -fr $pathToDakota/* ./$APP_FILE/Contents/MacOS/applications/dakota
# clean up
declare -a notWantedApp=("createBIM"
"performRegionalMapping"
"performRegionalEventSimulation"
"performDL"
"createEDP/standardEarthquakeEDP_R"
"createEDP/userEDP_R"
"createEDP/gmtEDP"
"createEVENT/ASCE7_WindSpeed"
"createEVENT/MultiplePEER"
"createEVENT/SiteResponse"
"createEVENT/CFDEvent"
"createEVENT/hazardBasedEvent"
"createEVENT/DEDM_HRP"
"createEVENT/stochasticGroundMotion"
"createEVENT/stochasticWind"
"createEVENT/ASCE7_WindSpeed"
"createEVENT/LLNL_SW4"
"createEVENT/windTunnelExperiment"
"createEVENT/LowRiseTPU"
"createEVENT/pointWindSpeed"
"performSIMULATION/IMasEDP"
"performSIMULATION/extractPGA"
"performSIMULATION/openSees_R"
)
for app in "${notWantedApp[@]}"
do
echo "removing $app"
# rm -fr ./$APP_FILE/Contents/MacOS/applications/$app
done
#find ./$APP_FILE -name __pycache__ -exec rm -rf {} +;
#
# load my credential file
#
userID="../userID.sh"
if [ ! -f "$userID" ]; then
echo "creating dmg $DMG_FILENAME"
rm $DMG_FILENAME
hdiutil create $DMG_FILENAME -fs HFS+ -srcfolder ./$APP_FILE -format UDZO -volname $APP_NAME
echo "No password & credential file to continue with codesign and App store verification"
exit
fi
source $userID
echo $appleID
if [ "${DMG_METHOD}" = "NEW" ]; then
#
# mv app into empty folder for create-dmg to work
# brew install create-dmg
#
echo "codesign --deep --force --verbose --options runtime --timestamp --sign "$appleCredential" $APP_FILE"
codesign --deep --force --verbose --options runtime --timestamp --sign "$appleCredential" $APP_FILE
mkdir app
mv $APP_FILE app
#horizontal
../macInstall/create-dmg \
--volname "${APP_NAME}" \
--background "../macInstall/background3.png" \
--window-pos 200 120 \
--window-size 600 350 \
--no-internet-enable \
--icon-size 125 \
--icon "${APP_FILE}" 125 130 \
--hide-extension "${APP_FILE}" \
--app-drop-link 450 130 \
--codesign $appleCredential \
"${DMG_FILENAME}" \
"app"
mv ./app/$APP_FILE ./
rm -fr app
else
#codesign
echo "codesign --deep --force --verbose --options=runtime --sign "$appleCredential" $APP_FILE"
codesign --deep --force --verbose --options=runtime --sign "$appleCredential" $APP_FILE
# create dmg
echo "hdiutil create $DMG_FILENAME -fs HFS+ -srcfolder ./$APP_FILE -format UDZO -volname $APP_NAME"
hdiutil create $DMG_FILENAME -fs HFS+ -srcfolder ./$APP_FILE -format UDZO -volname $APP_NAME
cmd_status=$?
if [[ $cmd_status != 0 ]]
then
echo "DMG Creation FAILED cd build and try the following:"
echo "hdiutil create $DMG_FILENAME -fs HFS+ -srcfolder ./$APP_FILE -format UDZO -volname $APP_NAME"
echo "codesign --force --sign "$appleCredential" $DMG_FILENAME"
echo "xcrun altool --notarize-app -u $appleID -p $appleAppPassword -f ./$DMG_FILENAME --primary-bundle-id altool"
echo "xcrun altool --notarization-info ID -u $appleID -p $appleAppPassword"
echo "xcrun stapler staple \"$APP_NAME\" $DMG_FILENAME"
fi
#codesign dmg
echo "codesign --force --sign "$appleCredential" $DMG_FILENAME"
codesign --force --sign "$appleCredential" $DMG_FILENAME
fi
echo "Issue the following: "
echo ""
echo "xcrun notarytool submit ./$DMG_FILENAME --apple-id $appleID --password $appleAppPassword --team-id $appleCredential"
echo "xcrun notarytool log ID --apple-id $appleID --team-id $appleCredential --password $appleAppPAssword"
echo ""
echo "Finally staple the dmg"
echo "xcrun stapler staple \"$APP_NAME\" $DMG_FILENAME"