-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_app_bundle.sh
More file actions
executable file
·54 lines (41 loc) · 1.41 KB
/
create_app_bundle.sh
File metadata and controls
executable file
·54 lines (41 loc) · 1.41 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
#!/bin/bash
# Configuration
APP_NAME="PomodoroCalendar"
# Build the project first
echo "Building project..."
swift build -c release
BIN_PATH=$(swift build -c release --show-bin-path)
# Create App Bundle Structure
mkdir -p "$APP_NAME.app/Contents/MacOS"
mkdir -p "$APP_NAME.app/Contents/Resources"
# Copy Binary
cp "$BIN_PATH/$APP_NAME" "$APP_NAME.app/Contents/MacOS/"
# Create basic PkgInfo
echo "APPL????" > "$APP_NAME.app/Contents/PkgInfo"
# Copy Info.plist
cp Info.plist "$APP_NAME.app/Contents/"
# Copy App Icon
cp AppIcon.icns "$APP_NAME.app/Contents/Resources/AppIcon.icns"
# Set Permissions
chmod +x "$APP_NAME.app/Contents/MacOS/$APP_NAME"
# Sign the app with entitlements (MUST be last step)
echo "Signing with entitlements..."
codesign --force --deep --sign - --entitlements Entitlements.plist "$APP_NAME.app"
echo "App bundle created at $APP_NAME.app"
# Create DMG
echo "Creating DMG..."
DMG_NAME="$APP_NAME.dmg"
# Remove existing DMG if it exists
rm -f "$DMG_NAME"
# Create a temporary folder for DMG contents to include a symlink to Applications
DMG_SRC_DIR="dmg_source"
rm -rf "$DMG_SRC_DIR"
mkdir -p "$DMG_SRC_DIR"
cp -r "$APP_NAME.app" "$DMG_SRC_DIR/"
ln -s /Applications "$DMG_SRC_DIR/Applications"
# Create the DMG
hdiutil create -volname "$APP_NAME" -srcfolder "$DMG_SRC_DIR" -ov -format UDZO "$DMG_NAME"
# Cleanup
rm -rf "$DMG_SRC_DIR"
echo "DMG created at $DMG_NAME"
echo "You can open it with: open $DMG_NAME"