-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate-dmg.sh
More file actions
executable file
·69 lines (54 loc) · 1.99 KB
/
create-dmg.sh
File metadata and controls
executable file
·69 lines (54 loc) · 1.99 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
#!/bin/bash
# Build iQualize and create a distributable DMG installer
set -e
cd "$(dirname "$0")"
VERSION=$(/usr/libexec/PlistBuddy -c "Print :CFBundleShortVersionString" Sources/iQualize/Info.plist)
DMG_NAME="iQualize-${VERSION}.dmg"
DMG_VOLUME="iQualize"
echo "=== Building iQualize v${VERSION} ==="
bash install.sh
echo "=== Creating DMG ==="
STAGING=.build/dmg-staging
TMP_DMG=.build/tmp-rw.dmg
# Clean previous staging
rm -rf "$STAGING" "$TMP_DMG" "$DMG_NAME"
mkdir -p "$STAGING"
# Copy app bundle from /Applications
cp -R /Applications/iQualize.app "$STAGING/"
# Create Applications symlink (the drag target)
ln -s /Applications "$STAGING/Applications"
# Create writable DMG
hdiutil create -volname "$DMG_VOLUME" -srcfolder "$STAGING" \
-ov -format UDRW -fs HFS+ "$TMP_DMG"
# Mount it to configure window appearance
DEVICE=$(hdiutil attach -readwrite -noverify "$TMP_DMG" | grep "Apple_HFS" | awk '{print $1}')
MOUNT_POINT="/Volumes/$DMG_VOLUME"
# Configure Finder window: icon positions, size, view options
osascript <<EOF
tell application "Finder"
tell disk "$DMG_VOLUME"
open
set current view of container window to icon view
set toolbar visible of container window to false
set statusbar visible of container window to false
set bounds of container window to {200, 200, 780, 540}
set theViewOptions to icon view options of container window
set arrangement of theViewOptions to not arranged
set icon size of theViewOptions to 128
set position of item "iQualize.app" of container window to {140, 170}
set position of item "Applications" of container window to {440, 170}
update without registering applications
close
end tell
end tell
EOF
# Flush and detach
sync
hdiutil detach "$DEVICE"
# Convert to compressed read-only DMG
hdiutil convert "$TMP_DMG" -format UDZO -imagekey zlib-level=9 -o "$DMG_NAME"
# Clean up
rm -rf "$STAGING" "$TMP_DMG"
echo ""
echo "=== Done: $DMG_NAME ==="
ls -lh "$DMG_NAME"