fastlane-plugin-create_dmg 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +48 -0
  3. data/README.md +52 -0
  4. data/lib/fastlane/plugin/create_dmg/actions/create_dmg_action.rb +226 -0
  5. data/lib/fastlane/plugin/create_dmg/actions/update_dmg_action.rb +118 -0
  6. data/lib/fastlane/plugin/create_dmg/assets/update-dmg.sh +206 -0
  7. data/lib/fastlane/plugin/create_dmg/helper/create_dmg_helper.rb +86 -0
  8. data/lib/fastlane/plugin/create_dmg/helper/update_dmg_helper.rb +43 -0
  9. data/lib/fastlane/plugin/create_dmg/vendor/create-dmg/LICENSE +22 -0
  10. data/lib/fastlane/plugin/create_dmg/vendor/create-dmg/Makefile +33 -0
  11. data/lib/fastlane/plugin/create_dmg/vendor/create-dmg/README.md +115 -0
  12. data/lib/fastlane/plugin/create_dmg/vendor/create-dmg/builder/create-dmg.builder +26 -0
  13. data/lib/fastlane/plugin/create_dmg/vendor/create-dmg/create-dmg +484 -0
  14. data/lib/fastlane/plugin/create_dmg/vendor/create-dmg/doc-project/Developer Notes.md +35 -0
  15. data/lib/fastlane/plugin/create_dmg/vendor/create-dmg/doc-project/Release Checklist.md +10 -0
  16. data/lib/fastlane/plugin/create_dmg/vendor/create-dmg/examples/01-main-example/installer_background.png +0 -0
  17. data/lib/fastlane/plugin/create_dmg/vendor/create-dmg/examples/01-main-example/sample +25 -0
  18. data/lib/fastlane/plugin/create_dmg/vendor/create-dmg/examples/01-main-example/source_folder/Application.app +0 -0
  19. data/lib/fastlane/plugin/create_dmg/vendor/create-dmg/support/eula-resources-template.xml +105 -0
  20. data/lib/fastlane/plugin/create_dmg/vendor/create-dmg/support/template.applescript +74 -0
  21. data/lib/fastlane/plugin/create_dmg/vendor/create-dmg/tests/007-space-in-dir-name/my files/hello.txt +1 -0
  22. data/lib/fastlane/plugin/create_dmg/vendor/create-dmg/tests/007-space-in-dir-name/run-test +5 -0
  23. data/lib/fastlane/plugin/create_dmg/version.rb +5 -0
  24. data/lib/fastlane/plugin/create_dmg.rb +16 -0
  25. data/lib/fastlane.dmg +0 -0
  26. metadata +207 -0
@@ -0,0 +1,484 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # Create a read-only disk image of the contents of a folder
4
+
5
+ # Bail out on any unhandled errors
6
+ set -e;
7
+
8
+ CDMG_VERSION='1.0.9'
9
+
10
+ # The full path to the "support/" directory this script is using
11
+ # (This will be set up by code later in the script.)
12
+ CDMG_SUPPORT_DIR=""
13
+
14
+ WINX=10
15
+ WINY=60
16
+ WINW=500
17
+ WINH=350
18
+ ICON_SIZE=128
19
+ TEXT_SIZE=16
20
+ FORMAT="UDZO"
21
+ ADD_FILE_SOURCES=()
22
+ ADD_FILE_TARGETS=()
23
+ IMAGEKEY=""
24
+ HDIUTIL_VERBOSITY=""
25
+ SANDBOX_SAFE=0
26
+ SKIP_JENKINS=0
27
+ MAXIMUM_UNMOUNTING_ATTEMPTS=3
28
+
29
+ function pure_version() {
30
+ echo "$CDMG_VERSION"
31
+ }
32
+
33
+ function version() {
34
+ echo "create-dmg $(pure_version)"
35
+ }
36
+
37
+ function usage() {
38
+ version
39
+ cat <<EOHELP
40
+
41
+ Creates a fancy DMG file.
42
+
43
+ Usage: $(basename $0) [options] <output_name.dmg> <source_folder>
44
+
45
+ All contents of <source_folder> will be copied into the disk image.
46
+
47
+ Options:
48
+ --volname <name>
49
+ set volume name (displayed in the Finder sidebar and window title)
50
+ --volicon <icon.icns>
51
+ set volume icon
52
+ --background <pic.png>
53
+ set folder background image (provide png, gif, or jpg)
54
+ --window-pos <x> <y>
55
+ set position the folder window
56
+ --window-size <width> <height>
57
+ set size of the folder window
58
+ --text-size <text_size>
59
+ set window text size (10-16)
60
+ --icon-size <icon_size>
61
+ set window icons size (up to 128)
62
+ --icon file_name <x> <y>
63
+ set position of the file's icon
64
+ --hide-extension <file_name>
65
+ hide the extension of file
66
+ --app-drop-link <x> <y>
67
+ make a drop link to Applications, at location x,y
68
+ --ql-drop-link <x> <y>
69
+ make a drop link to user QuickLook install dir, at location x,y
70
+ --eula <eula_file>
71
+ attach a license file to the dmg (plain text or RTF)
72
+ --no-internet-enable
73
+ disable automatic mount & copy
74
+ --format <format>
75
+ specify the final image format (default is UDZO)
76
+ --add-file <target_name> <file>|<folder> <x> <y>
77
+ add additional file or folder (can be used multiple times)
78
+ --disk-image-size <x>
79
+ set the disk image size manually to x MB
80
+ --hdiutil-verbose
81
+ execute hdiutil in verbose mode
82
+ --hdiutil-quiet
83
+ execute hdiutil in quiet mode
84
+ --sandbox-safe
85
+ execute hdiutil with sandbox compatibility and do not bless
86
+ --version
87
+ show create-dmg version number
88
+ -h, --help
89
+ display this help screen
90
+
91
+ EOHELP
92
+ exit 0
93
+ }
94
+
95
+ # Argument parsing
96
+
97
+ while [[ "${1:0:1}" = "-" ]]; do
98
+ case $1 in
99
+ --volname)
100
+ VOLUME_NAME="$2"
101
+ shift; shift;;
102
+ --volicon)
103
+ VOLUME_ICON_FILE="$2"
104
+ shift; shift;;
105
+ --background)
106
+ BACKGROUND_FILE="$2"
107
+ BACKGROUND_FILE_NAME="$(basename "$BACKGROUND_FILE")"
108
+ BACKGROUND_CLAUSE="set background picture of opts to file \".background:$BACKGROUND_FILE_NAME\""
109
+ REPOSITION_HIDDEN_FILES_CLAUSE="set position of every item to {theBottomRightX + 100, 100}"
110
+ shift; shift;;
111
+ --icon-size)
112
+ ICON_SIZE="$2"
113
+ shift; shift;;
114
+ --text-size)
115
+ TEXT_SIZE="$2"
116
+ shift; shift;;
117
+ --window-pos)
118
+ WINX=$2; WINY=$3
119
+ shift; shift; shift;;
120
+ --window-size)
121
+ WINW=$2; WINH=$3
122
+ shift; shift; shift;;
123
+ --icon)
124
+ POSITION_CLAUSE="${POSITION_CLAUSE}set position of item \"$2\" to {$3, $4}
125
+ "
126
+ shift; shift; shift; shift;;
127
+ --hide-extension)
128
+ HIDING_CLAUSE="${HIDING_CLAUSE}set the extension hidden of item \"$2\" to true
129
+ "
130
+ shift; shift;;
131
+ -h | --help)
132
+ usage;;
133
+ --version)
134
+ version; exit 0;;
135
+ --pure-version)
136
+ pure_version; exit 0;;
137
+ --ql-drop-link)
138
+ QL_LINK=$2
139
+ QL_CLAUSE="set position of item \"QuickLook\" to {$2, $3}
140
+ "
141
+ shift; shift; shift;;
142
+ --app-drop-link)
143
+ APPLICATION_LINK=$2
144
+ APPLICATION_CLAUSE="set position of item \"Applications\" to {$2, $3}
145
+ "
146
+ shift; shift; shift;;
147
+ --eula)
148
+ EULA_RSRC=$2
149
+ shift; shift;;
150
+ --no-internet-enable)
151
+ NOINTERNET=1
152
+ shift;;
153
+ --format)
154
+ FORMAT="$2"
155
+ shift; shift;;
156
+ --add-file | --add-folder)
157
+ ADD_FILE_TARGETS+=("$2")
158
+ ADD_FILE_SOURCES+=("$3")
159
+ POSITION_CLAUSE="${POSITION_CLAUSE}
160
+ set position of item \"$2\" to {$4, $5}
161
+ "
162
+ shift; shift; shift; shift; shift;;
163
+ --disk-image-size)
164
+ DISK_IMAGE_SIZE="$2"
165
+ shift; shift;;
166
+ --hdiutil-verbose)
167
+ HDIUTIL_VERBOSITY='-verbose'
168
+ shift;;
169
+ --hdiutil-quiet)
170
+ HDIUTIL_VERBOSITY='-quiet'
171
+ shift;;
172
+ --sandbox-safe)
173
+ SANDBOX_SAFE=1
174
+ shift;;
175
+ --rez)
176
+ echo "REZ is no more directly used. You can remove the --rez argument."
177
+ shift; shift;;
178
+ --skip-jenkins)
179
+ SKIP_JENKINS=1
180
+ shift;;
181
+ -*)
182
+ echo "Unknown option: $1. Run 'create-dmg --help' for help."
183
+ exit 1;;
184
+ esac
185
+ case $FORMAT in
186
+ UDZO)
187
+ IMAGEKEY="-imagekey zlib-level=9";;
188
+ UDBZ)
189
+ IMAGEKEY="-imagekey bzip2-level=9";;
190
+ *)
191
+ echo >&2 "Unknown format: $FORMAT"
192
+ exit 1;;
193
+ esac
194
+ done
195
+
196
+ if [[ -z "$2" ]]; then
197
+ echo "Not enough arguments. Run 'create-dmg --help' for help."
198
+ exit 1
199
+ fi
200
+
201
+ DMG_PATH="$1"
202
+ SRC_FOLDER="$(cd "$2" > /dev/null; pwd)"
203
+
204
+ # Argument validation checks
205
+
206
+ if [[ "${DMG_PATH: -4}" != ".dmg" ]]; then
207
+ echo "Output file name must end with a .dmg extension. Run 'create-dmg --help' for help."
208
+ exit 1
209
+ fi
210
+
211
+ # Main script logic
212
+
213
+ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
214
+ DMG_DIRNAME="$(dirname "$DMG_PATH")"
215
+ DMG_DIR="$(cd "$DMG_DIRNAME" > /dev/null; pwd)"
216
+ DMG_NAME="$(basename "$DMG_PATH")"
217
+ DMG_TEMP_NAME="$DMG_DIR/rw.${DMG_NAME}"
218
+
219
+ # Detect where we're running from
220
+
221
+ sentinel_file="$SCRIPT_DIR/.this-is-the-create-dmg-repo"
222
+ if [[ -f "$sentinel_file" ]]; then
223
+ # We're running from inside a repo
224
+ CDMG_SUPPORT_DIR="$SCRIPT_DIR/support"
225
+ else
226
+ # We're running inside an installed location
227
+ bin_dir="$SCRIPT_DIR"
228
+ prefix_dir=$(dirname "$bin_dir")
229
+ CDMG_SUPPORT_DIR="$prefix_dir/share/create-dmg/support"
230
+ fi
231
+
232
+ if [[ -z "$VOLUME_NAME" ]]; then
233
+ VOLUME_NAME="$(basename "$DMG_PATH" .dmg)"
234
+ fi
235
+
236
+ if [[ ! -d "$CDMG_SUPPORT_DIR" ]]; then
237
+ echo >&2 "Cannot find support/ directory: expected at: $CDMG_SUPPORT_DIR"
238
+ exit 1
239
+ fi
240
+
241
+ if [[ -f "$SRC_FOLDER/.DS_Store" ]]; then
242
+ echo "Deleting .DS_Store found in source folder"
243
+ rm "$SRC_FOLDER/.DS_Store"
244
+ fi
245
+
246
+ # Create the image
247
+ echo "Creating disk image..."
248
+ if [[ -f "${DMG_TEMP_NAME}" ]]; then
249
+ rm -f "${DMG_TEMP_NAME}"
250
+ fi
251
+
252
+ # Use Megabytes since hdiutil fails with very large byte numbers
253
+ function blocks_to_megabytes() {
254
+ # Add 1 extra MB, since there's no decimal retention here
255
+ MB_SIZE=$((($1 * 512 / 1000 / 1000) + 1))
256
+ echo $MB_SIZE
257
+ }
258
+
259
+ function get_size() {
260
+ # Get block size in disk
261
+ bytes_size=$(du -s "$1" | sed -e 's/ .*//g')
262
+ echo $(blocks_to_megabytes $bytes_size)
263
+ }
264
+
265
+ # Create the DMG with the specified size or the hdiutil estimation
266
+ CUSTOM_SIZE=''
267
+ if [[ -n "$DISK_IMAGE_SIZE" ]]; then
268
+ CUSTOM_SIZE="-size ${DISK_IMAGE_SIZE}m"
269
+ fi
270
+
271
+ if [[ $SANDBOX_SAFE -eq 0 ]]; then
272
+ hdiutil create ${HDIUTIL_VERBOSITY} -srcfolder "$SRC_FOLDER" -volname "${VOLUME_NAME}" \
273
+ -fs HFS+ -fsargs "-c c=64,a=16,e=16" -format UDRW ${CUSTOM_SIZE} "${DMG_TEMP_NAME}"
274
+ else
275
+ hdiutil makehybrid ${HDIUTIL_VERBOSITY} -default-volume-name "${VOLUME_NAME}" -hfs -o "${DMG_TEMP_NAME}" "$SRC_FOLDER"
276
+ hdiutil convert -format UDRW -ov -o "${DMG_TEMP_NAME}" "${DMG_TEMP_NAME}"
277
+ DISK_IMAGE_SIZE_CUSTOM=$DISK_IMAGE_SIZE
278
+ fi
279
+
280
+ # Get the created DMG actual size
281
+ DISK_IMAGE_SIZE=$(get_size "${DMG_TEMP_NAME}")
282
+
283
+ # Use the custom size if bigger
284
+ if [[ $SANDBOX_SAFE -eq 1 ]] && [[ ! -z "$DISK_IMAGE_SIZE_CUSTOM" ]] && [[ $DISK_IMAGE_SIZE_CUSTOM -gt $DISK_IMAGE_SIZE ]]; then
285
+ DISK_IMAGE_SIZE=$DISK_IMAGE_SIZE_CUSTOM
286
+ fi
287
+
288
+ # Estimate the additional soruces size
289
+ if [[ -n "$ADD_FILE_SOURCES" ]]; then
290
+ for i in "${!ADD_FILE_SOURCES[@]}"; do
291
+ SOURCE_SIZE=$(get_size "${ADD_FILE_SOURCES[$i]}")
292
+ DISK_IMAGE_SIZE=$(expr $DISK_IMAGE_SIZE + $SOURCE_SIZE)
293
+ done
294
+ fi
295
+
296
+ # Add extra space for additional resources
297
+ DISK_IMAGE_SIZE=$(expr $DISK_IMAGE_SIZE + 20)
298
+
299
+ # Make sure target image size is within limits
300
+ MIN_DISK_IMAGE_SIZE=$(hdiutil resize -limits "${DMG_TEMP_NAME}" | awk 'NR=1{print int($1/2048+1)}')
301
+ if [ $MIN_DISK_IMAGE_SIZE -gt $DISK_IMAGE_SIZE ]; then
302
+ DISK_IMAGE_SIZE=$MIN_DISK_IMAGE_SIZE
303
+ fi
304
+
305
+ # Resize the image for the extra stuff
306
+ hdiutil resize ${HDIUTIL_VERBOSITY} -size ${DISK_IMAGE_SIZE}m "${DMG_TEMP_NAME}"
307
+
308
+ # Mount the new DMG
309
+
310
+ MOUNT_DIR="/Volumes/${VOLUME_NAME}"
311
+
312
+ # Unmount leftover dmg if it was mounted previously (e.g. developer mounted dmg, installed app and forgot to unmount it)
313
+ if [[ -d "${MOUNT_DIR}" ]]; then
314
+ echo "Unmounting old disk image from $MOUNT_DIR..."
315
+ DEV_NAME=$(hdiutil info | egrep --color=never '^/dev/' | sed 1q | awk '{print $1}')
316
+ hdiutil detach "${DEV_NAME}"
317
+ fi
318
+
319
+ echo "Mounting disk image..."
320
+
321
+ echo "Mount directory: $MOUNT_DIR"
322
+ DEV_NAME=$(hdiutil attach -readwrite -noverify -noautoopen "${DMG_TEMP_NAME}" | egrep --color=never '^/dev/' | sed 1q | awk '{print $1}')
323
+ echo "Device name: $DEV_NAME"
324
+
325
+ if [[ -n "$BACKGROUND_FILE" ]]; then
326
+ echo "Copying background file '$BACKGROUND_FILE'..."
327
+ [[ -d "$MOUNT_DIR/.background" ]] || mkdir "$MOUNT_DIR/.background"
328
+ cp "$BACKGROUND_FILE" "$MOUNT_DIR/.background/$BACKGROUND_FILE_NAME"
329
+ fi
330
+
331
+ if [[ -n "$APPLICATION_LINK" ]]; then
332
+ echo "Making link to Applications dir..."
333
+ echo $MOUNT_DIR
334
+ ln -s /Applications "$MOUNT_DIR/Applications"
335
+ fi
336
+
337
+ if [[ -n "$QL_LINK" ]]; then
338
+ echo "Making link to QuickLook install dir..."
339
+ echo $MOUNT_DIR
340
+ ln -s "/Library/QuickLook" "$MOUNT_DIR/QuickLook"
341
+ fi
342
+
343
+ if [[ -n "$VOLUME_ICON_FILE" ]]; then
344
+ echo "Copying volume icon file '$VOLUME_ICON_FILE'..."
345
+ cp "$VOLUME_ICON_FILE" "$MOUNT_DIR/.VolumeIcon.icns"
346
+ SetFile -c icnC "$MOUNT_DIR/.VolumeIcon.icns"
347
+ fi
348
+
349
+ if [[ -n "$ADD_FILE_SOURCES" ]]; then
350
+ echo "Copying custom files..."
351
+ for i in "${!ADD_FILE_SOURCES[@]}"; do
352
+ echo "${ADD_FILE_SOURCES[$i]}"
353
+ cp -a "${ADD_FILE_SOURCES[$i]}" "$MOUNT_DIR/${ADD_FILE_TARGETS[$i]}"
354
+ done
355
+ fi
356
+
357
+ # Run AppleScript to do all the Finder cosmetic stuff
358
+ APPLESCRIPT_FILE=$(mktemp -t createdmg.tmp.XXXXXXXXXX)
359
+ if [[ $SANDBOX_SAFE -eq 1 ]]; then
360
+ echo "Skipping Finder-prettifying AppleScript because we are in Sandbox..."
361
+ else
362
+ if [[ $SKIP_JENKINS -eq 0 ]]; then
363
+ cat "$CDMG_SUPPORT_DIR/template.applescript" \
364
+ | sed -e "s/WINX/$WINX/g" -e "s/WINY/$WINY/g" -e "s/WINW/$WINW/g" \
365
+ -e "s/WINH/$WINH/g" -e "s/BACKGROUND_CLAUSE/$BACKGROUND_CLAUSE/g" \
366
+ -e "s/REPOSITION_HIDDEN_FILES_CLAUSE/$REPOSITION_HIDDEN_FILES_CLAUSE/g" \
367
+ -e "s/ICON_SIZE/$ICON_SIZE/g" -e "s/TEXT_SIZE/$TEXT_SIZE/g" \
368
+ | perl -pe "s/POSITION_CLAUSE/$POSITION_CLAUSE/g" \
369
+ | perl -pe "s/QL_CLAUSE/$QL_CLAUSE/g" \
370
+ | perl -pe "s/APPLICATION_CLAUSE/$APPLICATION_CLAUSE/g" \
371
+ | perl -pe "s/HIDING_CLAUSE/$HIDING_CLAUSE/" \
372
+ > "$APPLESCRIPT_FILE"
373
+ sleep 2 # pause to workaround occasional "Can’t get disk" (-1728) issues
374
+ echo "Running AppleScript to make Finder stuff pretty: /usr/bin/osascript \"${APPLESCRIPT_FILE}\" \"${VOLUME_NAME}\""
375
+ if /usr/bin/osascript "${APPLESCRIPT_FILE}" "${VOLUME_NAME}"; then
376
+ # Okay, we're cool
377
+ true
378
+ else
379
+ echo >&2 "Failed running AppleScript"
380
+ hdiutil detach "${DEV_NAME}"
381
+ exit 64
382
+ fi
383
+ echo "Done running the AppleScript..."
384
+ sleep 4
385
+ rm "$APPLESCRIPT_FILE"
386
+ fi
387
+ fi
388
+
389
+ # Make sure it's not world writeable
390
+ echo "Fixing permissions..."
391
+ chmod -Rf go-w "${MOUNT_DIR}" &> /dev/null || true
392
+ echo "Done fixing permissions"
393
+
394
+ # Make the top window open itself on mount:
395
+ if [[ $SANDBOX_SAFE -eq 0 ]]; then
396
+ echo "Blessing started"
397
+ bless --folder "${MOUNT_DIR}" --openfolder "${MOUNT_DIR}"
398
+ echo "Blessing finished"
399
+ else
400
+ echo "Skipping blessing on sandbox"
401
+ fi
402
+
403
+ if [[ -n "$VOLUME_ICON_FILE" ]]; then
404
+ # Tell the volume that it has a special file attribute
405
+ SetFile -a C "$MOUNT_DIR"
406
+ fi
407
+
408
+ # Delete unnecessary file system events log if possible
409
+ echo "Deleting .fseventsd"
410
+ rm -rf "${MOUNT_DIR}/.fseventsd" || true
411
+
412
+ # Unmount
413
+ unmounting_attempts=0
414
+ until
415
+ echo "Unmounting disk image..."
416
+ (( unmounting_attempts++ ))
417
+ hdiutil detach "${DEV_NAME}"
418
+ exit_code=$?
419
+ (( exit_code == 0 )) && break # nothing goes wrong
420
+ (( exit_code != 16 )) && exit $exit_code # exit with the original exit code
421
+ # The above statement returns 1 if test failed (exit_code == 16).
422
+ # It can make the code in the {do... done} block to be executed
423
+ do
424
+ (( unmounting_attempts == MAXIMUM_UNMOUNTING_ATTEMPTS )) && exit 16 # patience exhausted, exit with code EBUSY
425
+ echo "Wait a moment..."
426
+ sleep $(( 1 * (2 ** unmounting_attempts) ))
427
+ done
428
+ unset unmounting_attempts
429
+
430
+ # Compress image
431
+ echo "Compressing disk image..."
432
+ hdiutil convert ${HDIUTIL_VERBOSITY} "${DMG_TEMP_NAME}" -format ${FORMAT} ${IMAGEKEY} -o "${DMG_DIR}/${DMG_NAME}"
433
+ rm -f "${DMG_TEMP_NAME}"
434
+
435
+ # Adding EULA resources
436
+ if [[ -n "${EULA_RSRC}" && "${EULA_RSRC}" != "-null-" ]]; then
437
+ echo "Adding EULA resources..."
438
+ #
439
+ # Use udifrez instead flatten/rez/unflatten
440
+ # https://github.com/create-dmg/create-dmg/issues/109
441
+ #
442
+ # Based on a thread from dawn2dusk & peterguy
443
+ # https://developer.apple.com/forums/thread/668084
444
+ #
445
+ EULA_RESOURCES_FILE=$(mktemp -t createdmg.tmp.XXXXXXXXXX)
446
+ EULA_FORMAT=$(file -b ${EULA_RSRC})
447
+ if [[ ${EULA_FORMAT} == 'Rich Text Format data'* ]] ; then
448
+ EULA_FORMAT='RTF '
449
+ else
450
+ EULA_FORMAT='TEXT'
451
+ fi
452
+ # Encode the EULA to base64
453
+ # Replace 'openssl base64' with 'base64' if Mac OS X 10.6 support is no more needed
454
+ # EULA_DATA="$(base64 -b 52 "${EULA_RSRC}" | sed s$'/^\(.*\)$/\t\t\t\\1/')"
455
+ EULA_DATA="$(openssl base64 -in "${EULA_RSRC}" | tr -d '\n' | awk '{gsub(/.{52}/,"&\n")}1' | sed s$'/^\(.*\)$/\t\t\t\\1/')"
456
+ # Fill the template with the custom EULA contents
457
+ eval "cat > \"${EULA_RESOURCES_FILE}\" <<EOF
458
+ $(<${CDMG_SUPPORT_DIR}/eula-resources-template.xml)
459
+ EOF
460
+ "
461
+ # Apply the resources
462
+ hdiutil udifrez -xml "${EULA_RESOURCES_FILE}" '' -quiet "${DMG_DIR}/${DMG_NAME}" || {
463
+ echo "Failed to add the EULA license"
464
+ exit 1
465
+ }
466
+ echo "Successfully added the EULA license"
467
+ fi
468
+
469
+ # Enable "internet", whatever that is
470
+ if [[ ! -z "${NOINTERNET}" && "${NOINTERNET}" == 1 ]]; then
471
+ echo "Not setting 'internet-enable' on the dmg, per caller request"
472
+ else
473
+ # Check if hdiutil supports internet-enable
474
+ # Support was removed in macOS 10.15. See https://github.com/andreyvit/create-dmg/issues/76
475
+ if hdiutil internet-enable -help >/dev/null 2>/dev/null; then
476
+ hdiutil internet-enable -yes "${DMG_DIR}/${DMG_NAME}"
477
+ else
478
+ echo "hdiutil does not support internet-enable. Note it was removed in macOS 10.15."
479
+ fi
480
+ fi
481
+
482
+ # All done!
483
+ echo "Disk image done"
484
+ exit 0
@@ -0,0 +1,35 @@
1
+ # create-dmg Developer Notes
2
+
3
+ ## Repo layout
4
+
5
+ - `create-dmg` in the root of the repo is the main program
6
+ - `support/` contains auxiliary scripts used by `create-dmg`; it must be at that relative position to `create-dmg`
7
+ - `builder/` contains ????
8
+ - `examples/` contains user-facing examples
9
+ - `tests/` contains regression tests for developers
10
+ - `doc-project/` contains developer-facing documentation about this project
11
+
12
+ ### tests/
13
+
14
+ The `tests/` folder contains regression tests for developers.
15
+
16
+ Each test is in its own subfolder.
17
+ Each subfolder name should start with a 3-digit number that is the number of the corresponding bug report in create-dmg's GitHub issue tracker.
18
+
19
+ The tests are to be run manually, with the results examined manually.
20
+ There's no automated script to run them as a suite and check their results.
21
+ That might be nice to have.
22
+
23
+ ### examples/
24
+
25
+ Each example is in its own subfolder.
26
+ The subfolder prefix number is arbitrary; these numbers should roughly be in order of "advancedness" of examples, so it makes sense for users to go through them in order.
27
+
28
+ ## Versioning
29
+
30
+ As of May 2020, we're using SemVer versioning.
31
+ The old version numbers were 4-parters, like "1.0.0.7".
32
+ Now we use 3-part SemVer versions, like "1.0.8".
33
+ This change happened after version 1.0.0.7; 1.0.8 is the next release after 1.0.0.7.
34
+
35
+ The suffix "-SNAPSHOT" is used to denote a version that is still under development.
@@ -0,0 +1,10 @@
1
+ # Release Checklist
2
+
3
+ - Update the version in `create-dmg`'s `pure_version` function
4
+ - Remove the "-SNAPSHOT" suffix
5
+ - Commit
6
+ - Tag the release as `vX.X.X`
7
+ - `git push --tags`
8
+ - Create a release on the GitHub project page
9
+ - Open development on the next release
10
+ - Bump the version number and add a "-SNAPSHOT" suffix to it
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env bash
2
+
3
+ if [[ -e ../../create-dmg ]]; then
4
+ # We're running from the repo
5
+ CREATE_DMG=../../create-dmg
6
+ else
7
+ # We're running from an installation under a prefix
8
+ CREATE_DMG=../../../../bin/create-dmg
9
+ fi
10
+
11
+ # Since create-dmg does not clobber, be sure to delete previous DMG
12
+ [[ -f Application-Installer.dmg ]] && rm Application-Installer.dmg
13
+
14
+ # Create the DMG
15
+ $CREATE_DMG \
16
+ --volname "Application Installer" \
17
+ --background "installer_background.png" \
18
+ --window-pos 200 120 \
19
+ --window-size 800 400 \
20
+ --icon-size 100 \
21
+ --icon "Application.app" 200 190 \
22
+ --hide-extension "Application.app" \
23
+ --app-drop-link 600 185 \
24
+ "Application-Installer.dmg" \
25
+ "source_folder/"
@@ -0,0 +1,105 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>LPic</key>
6
+ <array>
7
+ <dict>
8
+ <key>Attributes</key>
9
+ <string>0x0000</string>
10
+ <key>Data</key>
11
+ <data>
12
+ AAAAAgAAAAAAAAAAAAQAAA==
13
+ </data>
14
+ <key>ID</key>
15
+ <string>5000</string>
16
+ <key>Name</key>
17
+ <string></string>
18
+ </dict>
19
+ </array>
20
+ <key>STR#</key>
21
+ <array>
22
+ <dict>
23
+ <key>Attributes</key>
24
+ <string>0x0000</string>
25
+ <key>Data</key>
26
+ <data>
27
+ AAYNRW5nbGlzaCB0ZXN0MQVBZ3JlZQhEaXNhZ3JlZQVQcmludAdT
28
+ YXZlLi4ueklmIHlvdSBhZ3JlZSB3aXRoIHRoZSB0ZXJtcyBvZiB0
29
+ aGlzIGxpY2Vuc2UsIGNsaWNrICJBZ3JlZSIgdG8gYWNjZXNzIHRo
30
+ ZSBzb2Z0d2FyZS4gIElmIHlvdSBkbyBub3QgYWdyZWUsIHByZXNz
31
+ ICJEaXNhZ3JlZS4i
32
+ </data>
33
+ <key>ID</key>
34
+ <string>5000</string>
35
+ <key>Name</key>
36
+ <string>English buttons</string>
37
+ </dict>
38
+ <dict>
39
+ <key>Attributes</key>
40
+ <string>0x0000</string>
41
+ <key>Data</key>
42
+ <data>
43
+ AAYHRW5nbGlzaAVBZ3JlZQhEaXNhZ3JlZQVQcmludAdTYXZlLi4u
44
+ e0lmIHlvdSBhZ3JlZSB3aXRoIHRoZSB0ZXJtcyBvZiB0aGlzIGxp
45
+ Y2Vuc2UsIHByZXNzICJBZ3JlZSIgdG8gaW5zdGFsbCB0aGUgc29m
46
+ dHdhcmUuICBJZiB5b3UgZG8gbm90IGFncmVlLCBwcmVzcyAiRGlz
47
+ YWdyZWUiLg==
48
+ </data>
49
+ <key>ID</key>
50
+ <string>5002</string>
51
+ <key>Name</key>
52
+ <string>English</string>
53
+ </dict>
54
+ </array>
55
+ <key>${EULA_FORMAT}</key>
56
+ <array>
57
+ <dict>
58
+ <key>Attributes</key>
59
+ <string>0x0000</string>
60
+ <key>Data</key>
61
+ <data>
62
+ ${EULA_DATA}
63
+ </data>
64
+ <key>ID</key>
65
+ <string>5000</string>
66
+ <key>Name</key>
67
+ <string>English</string>
68
+ </dict>
69
+ </array>
70
+ <key>TMPL</key>
71
+ <array>
72
+ <dict>
73
+ <key>Attributes</key>
74
+ <string>0x0000</string>
75
+ <key>Data</key>
76
+ <data>
77
+ E0RlZmF1bHQgTGFuZ3VhZ2UgSUREV1JEBUNvdW50T0NOVAQqKioq
78
+ TFNUQwtzeXMgbGFuZyBJRERXUkQebG9jYWwgcmVzIElEIChvZmZz
79
+ ZXQgZnJvbSA1MDAwRFdSRBAyLWJ5dGUgbGFuZ3VhZ2U/RFdSRAQq
80
+ KioqTFNURQ==
81
+ </data>
82
+ <key>ID</key>
83
+ <string>128</string>
84
+ <key>Name</key>
85
+ <string>LPic</string>
86
+ </dict>
87
+ </array>
88
+ <key>styl</key>
89
+ <array>
90
+ <dict>
91
+ <key>Attributes</key>
92
+ <string>0x0000</string>
93
+ <key>Data</key>
94
+ <data>
95
+ AAMAAAAAAAwACQAUAAAAAAAAAAAAAAAAACcADAAJABQBAAAAAAAA
96
+ AAAAAAAAKgAMAAkAFAAAAAAAAAAAAAA=
97
+ </data>
98
+ <key>ID</key>
99
+ <string>5000</string>
100
+ <key>Name</key>
101
+ <string>English</string>
102
+ </dict>
103
+ </array>
104
+ </dict>
105
+ </plist>