@mobrowser/sdk-darwin-x64 2.16.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.
- package/README.md +1 -0
- package/assets/app-Info.plist +233 -0
- package/assets/app-helper (Alerts)-Info.plist +53 -0
- package/assets/app-helper (GPU)-Info.plist +47 -0
- package/assets/app-helper (Plugin)-Info.plist +47 -0
- package/assets/app-helper (Renderer)-Info.plist +47 -0
- package/assets/app-helper-Info.plist +47 -0
- package/bin/7zr-mac +0 -0
- package/bin/cc_nativegen +0 -0
- package/bin/dmg/create-dmg +575 -0
- package/bin/dmg/seticon.swift +22 -0
- package/bin/dmg/support/eula-resources-template.xml +105 -0
- package/bin/dmg/support/template.applescript +74 -0
- package/bin/mobrowser +0 -0
- package/bin/mobrowser-mac-x64.info +323 -0
- package/bin/ninja +0 -0
- package/bin/protoc +0 -0
- package/bin/ts_servicegen +0 -0
- package/package.json +23 -0
- package/preinstall.js +10 -0
- package/proto/google/protobuf/any.proto +162 -0
- package/proto/google/protobuf/api.proto +229 -0
- package/proto/google/protobuf/descriptor.proto +1426 -0
- package/proto/google/protobuf/duration.proto +115 -0
- package/proto/google/protobuf/empty.proto +51 -0
- package/proto/google/protobuf/field_mask.proto +245 -0
- package/proto/google/protobuf/source_context.proto +48 -0
- package/proto/google/protobuf/struct.proto +95 -0
- package/proto/google/protobuf/timestamp.proto +145 -0
- package/proto/google/protobuf/type.proto +217 -0
- package/proto/google/protobuf/wrappers.proto +157 -0
- package/sbom/chromium/chromium-spdx-manifest.json +17 -0
- package/sbom/chromium/mobrowser-2.16.0-chromium-151.0.7922.76-darwin-x64.spdx.json +9434 -0
- package/sbom/chromium/mobrowser-2.16.0-chromium-151.0.7922.76-darwin-x64.spdx.json.sha256 +1 -0
- package/sbom/mobrowser-third-party/mobrowser-2.16.0-third-party-darwin-x64.spdx.json +371 -0
- package/sbom/mobrowser-third-party/mobrowser-2.16.0-third-party-darwin-x64.spdx.json.sha256 +1 -0
- package/sbom/mobrowser-third-party/mobrowser-third-party-spdx-manifest.json +14 -0
- package/sbom/velopack/velopack-1.0.8-darwin-x64.spdx-manifest.json +29 -0
- package/sbom/velopack/velopack-1.0.8-darwin-x64.spdx.json +17891 -0
- package/sbom/velopack/velopack-1.0.8-darwin-x64.spdx.json.sha256 +1 -0
|
@@ -0,0 +1,575 @@
|
|
|
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
|
+
# Any command that exits with non-zero code will cause the pipeline to fail
|
|
8
|
+
set -o pipefail;
|
|
9
|
+
|
|
10
|
+
CDMG_VERSION='1.1.1'
|
|
11
|
+
|
|
12
|
+
# The full path to the "support/" directory this script is using
|
|
13
|
+
# (This will be set up by code later in the script.)
|
|
14
|
+
CDMG_SUPPORT_DIR=""
|
|
15
|
+
|
|
16
|
+
OS_FULL_VERSION="$(sw_vers | sed -n 2p | cut -d : -f 2 | tr -d '[:space:]' | cut -c1-)"
|
|
17
|
+
OS_MAJOR_VERSION="$(echo $OS_FULL_VERSION | cut -d . -f 1)"
|
|
18
|
+
OS_MINOR_VERSION="$(echo $OS_FULL_VERSION | cut -d . -f 2)"
|
|
19
|
+
WINX=10
|
|
20
|
+
WINY=60
|
|
21
|
+
WINW=500
|
|
22
|
+
WINH=350
|
|
23
|
+
ICON_SIZE=128
|
|
24
|
+
TEXT_SIZE=16
|
|
25
|
+
FORMAT="UDZO"
|
|
26
|
+
FILESYSTEM="HFS+"
|
|
27
|
+
ADD_FILE_SOURCES=()
|
|
28
|
+
ADD_FILE_TARGETS=()
|
|
29
|
+
IMAGEKEY=""
|
|
30
|
+
HDIUTIL_VERBOSITY=""
|
|
31
|
+
SANDBOX_SAFE=0
|
|
32
|
+
BLESS=0
|
|
33
|
+
SKIP_JENKINS=0
|
|
34
|
+
MAXIMUM_UNMOUNTING_ATTEMPTS=3
|
|
35
|
+
SIGNATURE=""
|
|
36
|
+
TEAM_ID=""
|
|
37
|
+
APPLE_ID=""
|
|
38
|
+
PASSWORD=""
|
|
39
|
+
|
|
40
|
+
function pure_version() {
|
|
41
|
+
echo "$CDMG_VERSION"
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function hdiutil_detach_retry() {
|
|
45
|
+
# Unmount
|
|
46
|
+
unmounting_attempts=0
|
|
47
|
+
until
|
|
48
|
+
echo "Unmounting disk image..."
|
|
49
|
+
(( unmounting_attempts++ ))
|
|
50
|
+
hdiutil detach "$1"
|
|
51
|
+
exit_code=$?
|
|
52
|
+
(( exit_code == 0 )) && break # nothing goes wrong
|
|
53
|
+
(( exit_code != 16 )) && exit $exit_code # exit with the original exit code
|
|
54
|
+
# The above statement returns 1 if test failed (exit_code == 16).
|
|
55
|
+
# It can make the code in the {do... done} block to be executed
|
|
56
|
+
do
|
|
57
|
+
(( unmounting_attempts == MAXIMUM_UNMOUNTING_ATTEMPTS )) && exit 16 # patience exhausted, exit with code EBUSY
|
|
58
|
+
echo "Wait a moment..."
|
|
59
|
+
sleep $(( 1 * (2 ** unmounting_attempts) ))
|
|
60
|
+
done
|
|
61
|
+
unset unmounting_attempts
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function version() {
|
|
65
|
+
echo "create-dmg $(pure_version)"
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function usage() {
|
|
69
|
+
version
|
|
70
|
+
cat <<EOHELP
|
|
71
|
+
|
|
72
|
+
Creates a fancy DMG file.
|
|
73
|
+
|
|
74
|
+
Usage: $(basename $0) [options] <output_name.dmg> <source_folder>
|
|
75
|
+
|
|
76
|
+
All contents of <source_folder> will be copied into the disk image.
|
|
77
|
+
|
|
78
|
+
Options:
|
|
79
|
+
--volname <name>
|
|
80
|
+
set volume name (displayed in the Finder sidebar and window title)
|
|
81
|
+
--volicon <icon.icns>
|
|
82
|
+
set volume icon
|
|
83
|
+
--background <pic.png>
|
|
84
|
+
set folder background image (provide png, gif, or jpg)
|
|
85
|
+
--window-pos <x> <y>
|
|
86
|
+
set position the folder window
|
|
87
|
+
--window-size <width> <height>
|
|
88
|
+
set size of the folder window
|
|
89
|
+
--text-size <text_size>
|
|
90
|
+
set window text size (10-16)
|
|
91
|
+
--icon-size <icon_size>
|
|
92
|
+
set window icons size (up to 128)
|
|
93
|
+
--icon file_name <x> <y>
|
|
94
|
+
set position of the file's icon
|
|
95
|
+
--hide-extension <file_name>
|
|
96
|
+
hide the extension of file
|
|
97
|
+
--app-drop-link <x> <y>
|
|
98
|
+
make a drop link to Applications, at location x,y
|
|
99
|
+
--ql-drop-link <x> <y>
|
|
100
|
+
make a drop link to user QuickLook install dir, at location x,y
|
|
101
|
+
--eula <eula_file>
|
|
102
|
+
attach a license file to the dmg (plain text or RTF)
|
|
103
|
+
--no-internet-enable
|
|
104
|
+
disable automatic mount & copy
|
|
105
|
+
--format <format>
|
|
106
|
+
specify the final disk image format (UDZO|UDBZ|ULFO|ULMO) (default is UDZO)
|
|
107
|
+
--filesystem <filesystem>
|
|
108
|
+
specify the disk image filesystem (HFS+|APFS) (default is HFS+, APFS supports macOS 10.13 or newer)
|
|
109
|
+
--add-file <target_name> <file>|<folder> <x> <y>
|
|
110
|
+
add additional file or folder (can be used multiple times)
|
|
111
|
+
--disk-image-size <x>
|
|
112
|
+
set the disk image size manually to x MB
|
|
113
|
+
--hdiutil-verbose
|
|
114
|
+
execute hdiutil in verbose mode
|
|
115
|
+
--hdiutil-quiet
|
|
116
|
+
execute hdiutil in quiet mode
|
|
117
|
+
--bless
|
|
118
|
+
bless the mount folder (deprecated, needs macOS 12.2.1 or older)
|
|
119
|
+
--codesign <signature>
|
|
120
|
+
codesign the disk image with the specified signature
|
|
121
|
+
--notarize <credentials>
|
|
122
|
+
notarize the disk image (waits and staples) with the keychain stored credentials
|
|
123
|
+
--sandbox-safe
|
|
124
|
+
execute hdiutil with sandbox compatibility and do not bless (not supported for APFS disk images)
|
|
125
|
+
--version
|
|
126
|
+
show create-dmg version number
|
|
127
|
+
-h, --help
|
|
128
|
+
display this help screen
|
|
129
|
+
|
|
130
|
+
EOHELP
|
|
131
|
+
exit 0
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
# Argument parsing
|
|
135
|
+
|
|
136
|
+
while [[ "${1:0:1}" = "-" ]]; do
|
|
137
|
+
case $1 in
|
|
138
|
+
--volname)
|
|
139
|
+
VOLUME_NAME="$2"
|
|
140
|
+
shift; shift;;
|
|
141
|
+
--volicon)
|
|
142
|
+
VOLUME_ICON_FILE="$2"
|
|
143
|
+
shift; shift;;
|
|
144
|
+
--background)
|
|
145
|
+
BACKGROUND_FILE="$2"
|
|
146
|
+
BACKGROUND_FILE_NAME="$(basename "$BACKGROUND_FILE")"
|
|
147
|
+
BACKGROUND_CLAUSE="set background picture of opts to file \".background:$BACKGROUND_FILE_NAME\""
|
|
148
|
+
REPOSITION_HIDDEN_FILES_CLAUSE="set position of every item to {theBottomRightX + 100, 100}"
|
|
149
|
+
shift; shift;;
|
|
150
|
+
--icon-size)
|
|
151
|
+
ICON_SIZE="$2"
|
|
152
|
+
shift; shift;;
|
|
153
|
+
--text-size)
|
|
154
|
+
TEXT_SIZE="$2"
|
|
155
|
+
shift; shift;;
|
|
156
|
+
--window-pos)
|
|
157
|
+
WINX=$2; WINY=$3
|
|
158
|
+
shift; shift; shift;;
|
|
159
|
+
--window-size)
|
|
160
|
+
WINW=$2; WINH=$3
|
|
161
|
+
shift; shift; shift;;
|
|
162
|
+
--icon)
|
|
163
|
+
POSITION_CLAUSE="${POSITION_CLAUSE}set position of item \"$2\" to {$3, $4}
|
|
164
|
+
"
|
|
165
|
+
shift; shift; shift; shift;;
|
|
166
|
+
--hide-extension)
|
|
167
|
+
HIDING_CLAUSE="${HIDING_CLAUSE}set the extension hidden of item \"$2\" to true
|
|
168
|
+
"
|
|
169
|
+
shift; shift;;
|
|
170
|
+
-h | --help)
|
|
171
|
+
usage;;
|
|
172
|
+
--version)
|
|
173
|
+
version; exit 0;;
|
|
174
|
+
--pure-version)
|
|
175
|
+
pure_version; exit 0;;
|
|
176
|
+
--ql-drop-link)
|
|
177
|
+
QL_LINK=$2
|
|
178
|
+
QL_CLAUSE="set position of item \"QuickLook\" to {$2, $3}
|
|
179
|
+
"
|
|
180
|
+
shift; shift; shift;;
|
|
181
|
+
--app-drop-link)
|
|
182
|
+
APPLICATION_LINK=$2
|
|
183
|
+
APPLICATION_CLAUSE="set position of item \"Applications\" to {$2, $3}
|
|
184
|
+
"
|
|
185
|
+
shift; shift; shift;;
|
|
186
|
+
--eula)
|
|
187
|
+
EULA_RSRC=$2
|
|
188
|
+
shift; shift;;
|
|
189
|
+
--no-internet-enable)
|
|
190
|
+
NOINTERNET=1
|
|
191
|
+
shift;;
|
|
192
|
+
--format)
|
|
193
|
+
FORMAT="$2"
|
|
194
|
+
shift; shift;;
|
|
195
|
+
--filesystem)
|
|
196
|
+
FILESYSTEM="$2"
|
|
197
|
+
shift; shift;;
|
|
198
|
+
--add-file | --add-folder)
|
|
199
|
+
ADD_FILE_TARGETS+=("$2")
|
|
200
|
+
ADD_FILE_SOURCES+=("$3")
|
|
201
|
+
POSITION_CLAUSE="${POSITION_CLAUSE}
|
|
202
|
+
set position of item \"$2\" to {$4, $5}
|
|
203
|
+
"
|
|
204
|
+
shift; shift; shift; shift; shift;;
|
|
205
|
+
--disk-image-size)
|
|
206
|
+
DISK_IMAGE_SIZE="$2"
|
|
207
|
+
shift; shift;;
|
|
208
|
+
--hdiutil-verbose)
|
|
209
|
+
HDIUTIL_VERBOSITY='-verbose'
|
|
210
|
+
shift;;
|
|
211
|
+
--hdiutil-quiet)
|
|
212
|
+
HDIUTIL_VERBOSITY='-quiet'
|
|
213
|
+
shift;;
|
|
214
|
+
--codesign)
|
|
215
|
+
SIGNATURE="$2"
|
|
216
|
+
shift; shift;;
|
|
217
|
+
--team-id)
|
|
218
|
+
TEAM_ID="$2"
|
|
219
|
+
shift; shift;;
|
|
220
|
+
--apple-id)
|
|
221
|
+
APPLE_ID="$2"
|
|
222
|
+
shift; shift;;
|
|
223
|
+
--password)
|
|
224
|
+
PASSWORD="$2"
|
|
225
|
+
shift; shift;;
|
|
226
|
+
--sandbox-safe)
|
|
227
|
+
SANDBOX_SAFE=1
|
|
228
|
+
shift;;
|
|
229
|
+
--bless)
|
|
230
|
+
BLESS=1
|
|
231
|
+
shift;;
|
|
232
|
+
--rez)
|
|
233
|
+
echo "REZ is no more directly used. You can remove the --rez argument."
|
|
234
|
+
shift; shift;;
|
|
235
|
+
--skip-jenkins)
|
|
236
|
+
SKIP_JENKINS=1
|
|
237
|
+
shift;;
|
|
238
|
+
-*)
|
|
239
|
+
echo "Unknown option: $1. Run 'create-dmg --help' for help."
|
|
240
|
+
exit 1;;
|
|
241
|
+
esac
|
|
242
|
+
case $FORMAT in
|
|
243
|
+
UDZO)
|
|
244
|
+
IMAGEKEY="-imagekey zlib-level=9";;
|
|
245
|
+
UDBZ)
|
|
246
|
+
IMAGEKEY="-imagekey bzip2-level=9";;
|
|
247
|
+
ULFO)
|
|
248
|
+
;;
|
|
249
|
+
ULMO)
|
|
250
|
+
;;
|
|
251
|
+
*)
|
|
252
|
+
echo >&2 "Unknown disk image format: $FORMAT"
|
|
253
|
+
exit 1;;
|
|
254
|
+
esac
|
|
255
|
+
done
|
|
256
|
+
|
|
257
|
+
if [[ -z "$2" ]]; then
|
|
258
|
+
echo "Not enough arguments. Run 'create-dmg --help' for help."
|
|
259
|
+
exit 1
|
|
260
|
+
fi
|
|
261
|
+
|
|
262
|
+
DMG_PATH="$1"
|
|
263
|
+
SRC_FOLDER="$(cd "$2" > /dev/null; pwd)"
|
|
264
|
+
|
|
265
|
+
# Argument validation checks
|
|
266
|
+
|
|
267
|
+
if [[ "${DMG_PATH: -4}" != ".dmg" ]]; then
|
|
268
|
+
echo "Output file name must end with a .dmg extension. Run 'create-dmg --help' for help."
|
|
269
|
+
exit 1
|
|
270
|
+
fi
|
|
271
|
+
|
|
272
|
+
if [[ "${FILESYSTEM}" != "HFS+" ]] && [[ "${FILESYSTEM}" != "APFS" ]]; then
|
|
273
|
+
echo "Unknown disk image filesystem: ${FILESYSTEM}. Run 'create-dmg --help' for help."
|
|
274
|
+
exit 1
|
|
275
|
+
fi
|
|
276
|
+
|
|
277
|
+
if [[ "${FILESYSTEM}" == "APFS" ]] && [[ ${SANDBOX_SAFE} -eq 1 ]]; then
|
|
278
|
+
echo "Creating an APFS disk image that is sandbox safe is not supported."
|
|
279
|
+
exit 1
|
|
280
|
+
fi
|
|
281
|
+
|
|
282
|
+
# Main script logic
|
|
283
|
+
|
|
284
|
+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
285
|
+
DMG_DIRNAME="$(dirname "$DMG_PATH")"
|
|
286
|
+
DMG_DIR="$(cd "$DMG_DIRNAME" > /dev/null; pwd)"
|
|
287
|
+
DMG_NAME="$(basename "$DMG_PATH")"
|
|
288
|
+
DMG_TEMP_NAME="$DMG_DIR/rw.${DMG_NAME}"
|
|
289
|
+
|
|
290
|
+
bin_dir="$SCRIPT_DIR"
|
|
291
|
+
prefix_dir=$(dirname "$bin_dir")
|
|
292
|
+
CDMG_SUPPORT_DIR="$prefix_dir/dmg/support"
|
|
293
|
+
|
|
294
|
+
if [[ -z "$VOLUME_NAME" ]]; then
|
|
295
|
+
VOLUME_NAME="$(basename "$DMG_PATH" .dmg)"
|
|
296
|
+
fi
|
|
297
|
+
|
|
298
|
+
if [[ ! -d "$CDMG_SUPPORT_DIR" ]]; then
|
|
299
|
+
echo >&2 "Cannot find support/ directory: expected at: $CDMG_SUPPORT_DIR"
|
|
300
|
+
exit 1
|
|
301
|
+
fi
|
|
302
|
+
|
|
303
|
+
if [[ -f "$SRC_FOLDER/.DS_Store" ]]; then
|
|
304
|
+
echo "Deleting .DS_Store found in source folder"
|
|
305
|
+
rm "$SRC_FOLDER/.DS_Store"
|
|
306
|
+
fi
|
|
307
|
+
|
|
308
|
+
# Create the image
|
|
309
|
+
echo "Creating disk image..."
|
|
310
|
+
if [[ -f "${DMG_TEMP_NAME}" ]]; then
|
|
311
|
+
rm -f "${DMG_TEMP_NAME}"
|
|
312
|
+
fi
|
|
313
|
+
|
|
314
|
+
# Use Megabytes since hdiutil fails with very large byte numbers
|
|
315
|
+
function blocks_to_megabytes() {
|
|
316
|
+
# Add 1 extra MB, since there's no decimal retention here
|
|
317
|
+
MB_SIZE=$((($1 * 512 / 1000 / 1000) + 1))
|
|
318
|
+
echo $MB_SIZE
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
function get_size() {
|
|
322
|
+
# Get block size in disk
|
|
323
|
+
if [[ $OS_MAJOR_VERSION -ge 12 ]]; then
|
|
324
|
+
bytes_size=$(du -B 512 -s "$1")
|
|
325
|
+
else
|
|
326
|
+
bytes_size=$(du -s "$1")
|
|
327
|
+
fi
|
|
328
|
+
bytes_size=$(echo $bytes_size | sed -e 's/ .*//g')
|
|
329
|
+
echo $(blocks_to_megabytes $bytes_size)
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
# Create the DMG with the specified size or the hdiutil estimation
|
|
333
|
+
CUSTOM_SIZE=''
|
|
334
|
+
if [[ -n "$DISK_IMAGE_SIZE" ]]; then
|
|
335
|
+
CUSTOM_SIZE="-size ${DISK_IMAGE_SIZE}m"
|
|
336
|
+
fi
|
|
337
|
+
|
|
338
|
+
if [[ $SANDBOX_SAFE -eq 0 ]]; then
|
|
339
|
+
if [[ "$FILESYSTEM" == "APFS" ]]; then
|
|
340
|
+
FILESYSTEM_ARGUMENTS=""
|
|
341
|
+
else
|
|
342
|
+
FILESYSTEM_ARGUMENTS="-c c=64,a=16,e=16"
|
|
343
|
+
fi
|
|
344
|
+
hdiutil create ${HDIUTIL_VERBOSITY} -srcfolder "$SRC_FOLDER" -volname "${VOLUME_NAME}" \
|
|
345
|
+
-fs "${FILESYSTEM}" -fsargs "${FILESYSTEM_ARGUMENTS}" -format UDRW ${CUSTOM_SIZE} "${DMG_TEMP_NAME}"
|
|
346
|
+
else
|
|
347
|
+
hdiutil makehybrid ${HDIUTIL_VERBOSITY} -default-volume-name "${VOLUME_NAME}" -hfs -o "${DMG_TEMP_NAME}" "$SRC_FOLDER"
|
|
348
|
+
hdiutil convert -format UDRW -ov -o "${DMG_TEMP_NAME}" "${DMG_TEMP_NAME}"
|
|
349
|
+
DISK_IMAGE_SIZE_CUSTOM=$DISK_IMAGE_SIZE
|
|
350
|
+
fi
|
|
351
|
+
|
|
352
|
+
# Get the created DMG actual size
|
|
353
|
+
DISK_IMAGE_SIZE=$(get_size "${DMG_TEMP_NAME}")
|
|
354
|
+
|
|
355
|
+
# Use the custom size if bigger
|
|
356
|
+
if [[ $SANDBOX_SAFE -eq 1 ]] && [[ ! -z "$DISK_IMAGE_SIZE_CUSTOM" ]] && [[ $DISK_IMAGE_SIZE_CUSTOM -gt $DISK_IMAGE_SIZE ]]; then
|
|
357
|
+
DISK_IMAGE_SIZE=$DISK_IMAGE_SIZE_CUSTOM
|
|
358
|
+
fi
|
|
359
|
+
|
|
360
|
+
# Estimate the additional sources size
|
|
361
|
+
if [[ -n "$ADD_FILE_SOURCES" ]]; then
|
|
362
|
+
for i in "${!ADD_FILE_SOURCES[@]}"; do
|
|
363
|
+
SOURCE_SIZE=$(get_size "${ADD_FILE_SOURCES[$i]}")
|
|
364
|
+
DISK_IMAGE_SIZE=$(expr $DISK_IMAGE_SIZE + $SOURCE_SIZE)
|
|
365
|
+
done
|
|
366
|
+
fi
|
|
367
|
+
|
|
368
|
+
# Add extra space for additional resources
|
|
369
|
+
DISK_IMAGE_SIZE=$(expr $DISK_IMAGE_SIZE + 20)
|
|
370
|
+
|
|
371
|
+
# Make sure target image size is within limits
|
|
372
|
+
MIN_DISK_IMAGE_SIZE=$(hdiutil resize -limits "${DMG_TEMP_NAME}" | awk 'NR=1{print int($1/2048+1)}')
|
|
373
|
+
if [ $MIN_DISK_IMAGE_SIZE -gt $DISK_IMAGE_SIZE ]; then
|
|
374
|
+
DISK_IMAGE_SIZE=$MIN_DISK_IMAGE_SIZE
|
|
375
|
+
fi
|
|
376
|
+
|
|
377
|
+
# Resize the image for the extra stuff
|
|
378
|
+
hdiutil resize ${HDIUTIL_VERBOSITY} -size ${DISK_IMAGE_SIZE}m "${DMG_TEMP_NAME}"
|
|
379
|
+
|
|
380
|
+
# Mount the new DMG
|
|
381
|
+
|
|
382
|
+
MOUNT_DIR="/Volumes/${VOLUME_NAME}"
|
|
383
|
+
|
|
384
|
+
# Unmount leftover dmg if it was mounted previously (e.g. developer mounted dmg, installed app and forgot to unmount it)
|
|
385
|
+
if [[ -d "${MOUNT_DIR}" ]]; then
|
|
386
|
+
echo "Unmounting old disk image from $MOUNT_DIR..."
|
|
387
|
+
DEV_NAME=$(hdiutil info | grep -E --color=never '^/dev/' | sed 1q | awk '{print $1}')
|
|
388
|
+
hdiutil_detach_retry "${DEV_NAME}"
|
|
389
|
+
fi
|
|
390
|
+
|
|
391
|
+
echo "Mounting disk image..."
|
|
392
|
+
|
|
393
|
+
echo "Mount directory: $MOUNT_DIR"
|
|
394
|
+
DEV_NAME=$(hdiutil attach -readwrite -noverify -noautoopen "${DMG_TEMP_NAME}" | grep -E --color=never '^/dev/' | sed 1q | awk '{print $1}')
|
|
395
|
+
echo "Device name: $DEV_NAME"
|
|
396
|
+
|
|
397
|
+
if [[ -n "$BACKGROUND_FILE" ]]; then
|
|
398
|
+
echo "Copying background file '$BACKGROUND_FILE'..."
|
|
399
|
+
[[ -d "$MOUNT_DIR/.background" ]] || mkdir "$MOUNT_DIR/.background"
|
|
400
|
+
cp "$BACKGROUND_FILE" "$MOUNT_DIR/.background/$BACKGROUND_FILE_NAME"
|
|
401
|
+
fi
|
|
402
|
+
|
|
403
|
+
if [[ -n "$APPLICATION_LINK" ]]; then
|
|
404
|
+
echo "Making link to Applications dir..."
|
|
405
|
+
echo $MOUNT_DIR
|
|
406
|
+
ln -s /Applications "$MOUNT_DIR/Applications"
|
|
407
|
+
fi
|
|
408
|
+
|
|
409
|
+
if [[ -n "$QL_LINK" ]]; then
|
|
410
|
+
echo "Making link to QuickLook install dir..."
|
|
411
|
+
echo $MOUNT_DIR
|
|
412
|
+
ln -s "/Library/QuickLook" "$MOUNT_DIR/QuickLook"
|
|
413
|
+
fi
|
|
414
|
+
|
|
415
|
+
if [[ -n "$VOLUME_ICON_FILE" ]]; then
|
|
416
|
+
echo "Copying volume icon file '$VOLUME_ICON_FILE'..."
|
|
417
|
+
cp "$VOLUME_ICON_FILE" "$MOUNT_DIR/.VolumeIcon.icns"
|
|
418
|
+
SetFile -c icnC "$MOUNT_DIR/.VolumeIcon.icns"
|
|
419
|
+
fi
|
|
420
|
+
|
|
421
|
+
if [[ -n "$ADD_FILE_SOURCES" ]]; then
|
|
422
|
+
echo "Copying custom files..."
|
|
423
|
+
for i in "${!ADD_FILE_SOURCES[@]}"; do
|
|
424
|
+
echo "${ADD_FILE_SOURCES[$i]}"
|
|
425
|
+
cp -a "${ADD_FILE_SOURCES[$i]}" "$MOUNT_DIR/${ADD_FILE_TARGETS[$i]}"
|
|
426
|
+
done
|
|
427
|
+
fi
|
|
428
|
+
|
|
429
|
+
# Run AppleScript to do all the Finder cosmetic stuff
|
|
430
|
+
APPLESCRIPT_FILE=$(mktemp -t createdmg.tmp.XXXXXXXXXX)
|
|
431
|
+
if [[ $SANDBOX_SAFE -eq 1 ]]; then
|
|
432
|
+
echo "Skipping Finder-prettifying AppleScript because we are in Sandbox..."
|
|
433
|
+
else
|
|
434
|
+
if [[ $SKIP_JENKINS -eq 0 ]]; then
|
|
435
|
+
cat "$CDMG_SUPPORT_DIR/template.applescript" \
|
|
436
|
+
| sed -e "s/WINX/$WINX/g" -e "s/WINY/$WINY/g" -e "s/WINW/$WINW/g" \
|
|
437
|
+
-e "s/WINH/$WINH/g" -e "s/BACKGROUND_CLAUSE/$BACKGROUND_CLAUSE/g" \
|
|
438
|
+
-e "s/REPOSITION_HIDDEN_FILES_CLAUSE/$REPOSITION_HIDDEN_FILES_CLAUSE/g" \
|
|
439
|
+
-e "s/ICON_SIZE/$ICON_SIZE/g" -e "s/TEXT_SIZE/$TEXT_SIZE/g" \
|
|
440
|
+
| perl -pe "s/POSITION_CLAUSE/$POSITION_CLAUSE/g" \
|
|
441
|
+
| perl -pe "s/QL_CLAUSE/$QL_CLAUSE/g" \
|
|
442
|
+
| perl -pe "s/APPLICATION_CLAUSE/$APPLICATION_CLAUSE/g" \
|
|
443
|
+
| perl -pe "s/HIDING_CLAUSE/$HIDING_CLAUSE/" \
|
|
444
|
+
> "$APPLESCRIPT_FILE"
|
|
445
|
+
sleep 2 # pause to workaround occasional "Can’t get disk" (-1728) issues
|
|
446
|
+
echo "Running AppleScript to make Finder stuff pretty: /usr/bin/osascript \"${APPLESCRIPT_FILE}\" \"${VOLUME_NAME}\""
|
|
447
|
+
if /usr/bin/osascript "${APPLESCRIPT_FILE}" "${VOLUME_NAME}"; then
|
|
448
|
+
# Okay, we're cool
|
|
449
|
+
true
|
|
450
|
+
else
|
|
451
|
+
echo >&2 "Failed running AppleScript"
|
|
452
|
+
hdiutil_detach_retry "${DEV_NAME}"
|
|
453
|
+
exit 64
|
|
454
|
+
fi
|
|
455
|
+
echo "Done running the AppleScript..."
|
|
456
|
+
sleep 4
|
|
457
|
+
rm "$APPLESCRIPT_FILE"
|
|
458
|
+
fi
|
|
459
|
+
fi
|
|
460
|
+
|
|
461
|
+
# Make sure it's not world writeable
|
|
462
|
+
echo "Fixing permissions..."
|
|
463
|
+
chmod -Rf go-w "${MOUNT_DIR}" &> /dev/null || true
|
|
464
|
+
echo "Done fixing permissions"
|
|
465
|
+
|
|
466
|
+
# Make the top window open itself on mount:
|
|
467
|
+
if [[ $BLESS -eq 1 && $SANDBOX_SAFE -eq 0 ]]; then
|
|
468
|
+
echo "Blessing started"
|
|
469
|
+
if [ $(uname -m) == "arm64" ]; then
|
|
470
|
+
bless --folder "${MOUNT_DIR}"
|
|
471
|
+
else
|
|
472
|
+
bless --folder "${MOUNT_DIR}" --openfolder "${MOUNT_DIR}"
|
|
473
|
+
fi
|
|
474
|
+
echo "Blessing finished"
|
|
475
|
+
else
|
|
476
|
+
echo "Skipping blessing on sandbox"
|
|
477
|
+
fi
|
|
478
|
+
|
|
479
|
+
if [[ -n "$VOLUME_ICON_FILE" ]]; then
|
|
480
|
+
# Tell the volume that it has a special file attribute
|
|
481
|
+
SetFile -a C "$MOUNT_DIR"
|
|
482
|
+
fi
|
|
483
|
+
|
|
484
|
+
# Delete unnecessary file system events log if possible
|
|
485
|
+
echo "Deleting .fseventsd"
|
|
486
|
+
rm -rf "${MOUNT_DIR}/.fseventsd" || true
|
|
487
|
+
|
|
488
|
+
hdiutil_detach_retry "${DEV_NAME}"
|
|
489
|
+
|
|
490
|
+
# Compress image
|
|
491
|
+
echo "Compressing disk image..."
|
|
492
|
+
hdiutil convert ${HDIUTIL_VERBOSITY} "${DMG_TEMP_NAME}" -format ${FORMAT} ${IMAGEKEY} -o "${DMG_DIR}/${DMG_NAME}"
|
|
493
|
+
rm -f "${DMG_TEMP_NAME}"
|
|
494
|
+
|
|
495
|
+
# Adding EULA resources
|
|
496
|
+
if [[ -n "${EULA_RSRC}" && "${EULA_RSRC}" != "-null-" ]]; then
|
|
497
|
+
echo "Adding EULA resources..."
|
|
498
|
+
#
|
|
499
|
+
# Use udifrez instead flatten/rez/unflatten
|
|
500
|
+
# https://github.com/create-dmg/create-dmg/issues/109
|
|
501
|
+
#
|
|
502
|
+
# Based on a thread from dawn2dusk & peterguy
|
|
503
|
+
# https://developer.apple.com/forums/thread/668084
|
|
504
|
+
#
|
|
505
|
+
EULA_RESOURCES_FILE=$(mktemp -t createdmg.tmp.XXXXXXXXXX)
|
|
506
|
+
EULA_FORMAT=$(file -b ${EULA_RSRC})
|
|
507
|
+
if [[ ${EULA_FORMAT} == 'Rich Text Format data'* ]] ; then
|
|
508
|
+
EULA_FORMAT='RTF '
|
|
509
|
+
else
|
|
510
|
+
EULA_FORMAT='TEXT'
|
|
511
|
+
fi
|
|
512
|
+
# Encode the EULA to base64
|
|
513
|
+
# Replace 'openssl base64' with 'base64' if Mac OS X 10.6 support is no more needed
|
|
514
|
+
# EULA_DATA="$(base64 -b 52 "${EULA_RSRC}" | sed s$'/^\(.*\)$/\t\t\t\\1/')"
|
|
515
|
+
EULA_DATA="$(openssl base64 -in "${EULA_RSRC}" | tr -d '\n' | awk '{gsub(/.{52}/,"&\n")}1' | sed s$'/^\(.*\)$/\t\t\t\\1/')"
|
|
516
|
+
# Fill the template with the custom EULA contents
|
|
517
|
+
eval "cat > \"${EULA_RESOURCES_FILE}\" <<EOF
|
|
518
|
+
$(<${CDMG_SUPPORT_DIR}/eula-resources-template.xml)
|
|
519
|
+
EOF
|
|
520
|
+
"
|
|
521
|
+
# Apply the resources
|
|
522
|
+
hdiutil udifrez -xml "${EULA_RESOURCES_FILE}" '' -quiet "${DMG_DIR}/${DMG_NAME}" || {
|
|
523
|
+
echo "Failed to add the EULA license"
|
|
524
|
+
exit 1
|
|
525
|
+
}
|
|
526
|
+
echo "Successfully added the EULA license"
|
|
527
|
+
fi
|
|
528
|
+
|
|
529
|
+
# Enable "internet", whatever that is
|
|
530
|
+
if [[ ! -z "${NOINTERNET}" && "${NOINTERNET}" == 1 ]]; then
|
|
531
|
+
echo "Not setting 'internet-enable' on the dmg, per caller request"
|
|
532
|
+
else
|
|
533
|
+
# Check if hdiutil supports internet-enable
|
|
534
|
+
# Support was removed in macOS 10.15. See https://github.com/andreyvit/create-dmg/issues/76
|
|
535
|
+
if hdiutil internet-enable -help >/dev/null 2>/dev/null; then
|
|
536
|
+
hdiutil internet-enable -yes "${DMG_DIR}/${DMG_NAME}"
|
|
537
|
+
else
|
|
538
|
+
echo "hdiutil does not support internet-enable. Note it was removed in macOS 10.15."
|
|
539
|
+
fi
|
|
540
|
+
fi
|
|
541
|
+
|
|
542
|
+
if [[ -n "${SIGNATURE}" && "${SIGNATURE}" != "-null-" ]]; then
|
|
543
|
+
echo "Codesign started"
|
|
544
|
+
codesign -s "${SIGNATURE}" "${DMG_DIR}/${DMG_NAME}"
|
|
545
|
+
dmgsignaturecheck="$(codesign --verify --deep --verbose=2 --strict "${DMG_DIR}/${DMG_NAME}" 2>&1 >/dev/null)"
|
|
546
|
+
if [ $? -eq 0 ]; then
|
|
547
|
+
echo "The disk image is now codesigned"
|
|
548
|
+
else
|
|
549
|
+
echo "The signature seems invalid${NC}"
|
|
550
|
+
exit 1
|
|
551
|
+
fi
|
|
552
|
+
fi
|
|
553
|
+
|
|
554
|
+
if [[ -n "${APPLE_ID}" && "${APPLE_ID}" != "-null-" ]]; then
|
|
555
|
+
echo "Notarization started"
|
|
556
|
+
xcrun notarytool submit "${DMG_DIR}/${DMG_NAME}" --team-id "${TEAM_ID}" --apple-id "${APPLE_ID}" --password "${PASSWORD}" --wait
|
|
557
|
+
echo "Stapling the notarization ticket"
|
|
558
|
+
staple="$(xcrun stapler staple "${DMG_DIR}/${DMG_NAME}")"
|
|
559
|
+
if [ $? -eq 0 ]; then
|
|
560
|
+
echo "The disk image is now notarized"
|
|
561
|
+
else
|
|
562
|
+
echo "$staple"
|
|
563
|
+
echo "The notarization failed with error $?"
|
|
564
|
+
exit 1
|
|
565
|
+
fi
|
|
566
|
+
fi
|
|
567
|
+
|
|
568
|
+
# All done!
|
|
569
|
+
echo "Disk image done"
|
|
570
|
+
|
|
571
|
+
if [[ -n "$VOLUME_ICON_FILE" ]]; then
|
|
572
|
+
echo "Updating DMG icon"
|
|
573
|
+
"$prefix_dir/dmg/seticon" "$VOLUME_ICON_FILE" "$DMG_PATH"
|
|
574
|
+
fi
|
|
575
|
+
exit 0
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import AppKit
|
|
2
|
+
|
|
3
|
+
// Usage: ./seticon /path/to/my.icns /path/to/some.dmg
|
|
4
|
+
|
|
5
|
+
let args = CommandLine.arguments
|
|
6
|
+
|
|
7
|
+
if args.count != 3 {
|
|
8
|
+
print("Error: usage: ./seticon /path/to/my.icns /path/to/some.dmg")
|
|
9
|
+
exit(1)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
var icns = args[1]
|
|
13
|
+
var dmg = args[2]
|
|
14
|
+
|
|
15
|
+
var img = NSImage(byReferencingFile: icns)!
|
|
16
|
+
|
|
17
|
+
if NSWorkspace.shared.setIcon(img, forFile: dmg) {
|
|
18
|
+
print("Set \(dmg) icon to \(icns) [\(img.size)]")
|
|
19
|
+
} else {
|
|
20
|
+
print("Setting icon failed")
|
|
21
|
+
exit(2)
|
|
22
|
+
}
|
|
@@ -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>
|