File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -170,6 +170,16 @@ show_disk_usage() {
170170 done
171171}
172172
173+ dmg_size_for_source () {
174+ local source_dir=" $1 "
175+ local source_kib
176+ source_kib=" $( du -sk " $source_dir " | awk ' {print $1}' ) "
177+
178+ # hdiutil's inferred size for -srcfolder can be too small for signed app
179+ # bundles. Add 30% plus 64 MiB for filesystem metadata and small-file slack.
180+ echo $(( (source_kib * 13 / 10 + 65536 + 1023 ) / 1024 ))
181+ }
182+
173183clean_target_intermediates_for_ci () {
174184 if [[ " ${GITCOMET_MACOS_PACKAGE_CLEAN_TARGET:- 0} " != " 1" ]]; then
175185 return
@@ -296,12 +306,16 @@ if [[ $create_dmg -eq 1 ]]; then
296306 mkdir -p " $dmg_stage "
297307 cp -R " $app_bundle " " ${dmg_stage} /GitComet.app"
298308 ln -s /Applications " ${dmg_stage} /Applications"
309+ dmg_size_mib=" $( dmg_size_for_source " $dmg_stage " ) "
310+ echo " Creating macOS DMG with ${dmg_size_mib} MiB filesystem."
299311
300312 # Preserve compatibility with older macOS tooling.
301313 rm -f " $dmg_path "
302314 hdiutil create \
303315 -volname " GitComet" \
304316 -srcfolder " $dmg_stage " \
317+ -fs HFS+ \
318+ -size " ${dmg_size_mib} m" \
305319 -ov \
306320 -format UDZO \
307321 " $dmg_path " > /dev/null
You can’t perform that action at this time.
0 commit comments