-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcreate-dmg.sh
More file actions
executable file
·76 lines (60 loc) · 1.99 KB
/
create-dmg.sh
File metadata and controls
executable file
·76 lines (60 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
70
71
72
73
74
75
76
#!/bin/bash
# PopZeit DMG Creation Script
# Creates a distributable DMG file for PopZeit
set -e
# Configuration
APP_NAME="PopZeit"
VERSION="1.0.0"
DMG_NAME="${APP_NAME}-${VERSION}.dmg"
VOLUME_NAME="${APP_NAME}"
SOURCE_APP="build/${APP_NAME}.app"
DMG_PATH="build/${DMG_NAME}"
TEMP_DMG="build/temp.dmg"
# Check if app exists
if [ ! -d "$SOURCE_APP" ]; then
echo "Error: App bundle not found at $SOURCE_APP"
echo "Please run ./build.sh first"
exit 1
fi
echo "Creating DMG for ${APP_NAME} v${VERSION}..."
# Clean up any existing DMG
rm -f "$DMG_PATH" "$TEMP_DMG"
# Create a temporary DMG
echo "Creating temporary DMG..."
hdiutil create -size 50m -fs HFS+ -volname "$VOLUME_NAME" "$TEMP_DMG"
# Mount the temporary DMG
echo "Mounting temporary DMG..."
MOUNT_OUTPUT=$(hdiutil attach "$TEMP_DMG")
MOUNT_PATH=$(echo "$MOUNT_OUTPUT" | grep -o '/Volumes/.*' | head -1)
# Copy app to DMG
echo "Copying app to DMG..."
cp -R "$SOURCE_APP" "$MOUNT_PATH/"
# Create a symbolic link to Applications folder
ln -s /Applications "$MOUNT_PATH/Applications"
# Create a simple background and layout (optional)
# This would normally include a background image and icon positioning
# For now, we'll keep it simple
# Unmount the temporary DMG
echo "Unmounting temporary DMG..."
hdiutil detach "$MOUNT_PATH"
# Convert to compressed DMG
echo "Creating final compressed DMG..."
hdiutil convert "$TEMP_DMG" -format UDZO -o "$DMG_PATH"
# Clean up temporary DMG
rm -f "$TEMP_DMG"
# Calculate DMG size
DMG_SIZE=$(du -h "$DMG_PATH" | cut -f1)
echo ""
echo "DMG created successfully!"
echo "Location: $DMG_PATH"
echo "Size: $DMG_SIZE"
echo ""
echo "Distribution notes:"
echo "1. This DMG contains an unsigned app"
echo "2. Users will see a security warning when opening"
echo "3. They'll need to right-click and choose 'Open' to bypass Gatekeeper"
echo ""
echo "For proper distribution without warnings:"
echo "1. Sign the app with a Developer ID certificate"
echo "2. Notarize the app with Apple"
echo "3. Staple the notarization ticket to the DMG"