-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpack_mac.sh
More file actions
executable file
·81 lines (69 loc) · 2.9 KB
/
Copy pathpack_mac.sh
File metadata and controls
executable file
·81 lines (69 loc) · 2.9 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
77
78
79
80
81
#!/bin/bash
set -e
echo "Building release..."
cargo build --release
APP_NAME="NeverMiss.app"
rm -rf "$APP_NAME"
mkdir -p "$APP_NAME/Contents/MacOS"
mkdir -p "$APP_NAME/Contents/Resources"
cat <<PLIST > "$APP_NAME/Contents/Info.plist"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>NeverMiss</string>
<key>CFBundleIdentifier</key>
<string>com.nevermiss.gui</string>
<key>CFBundleName</key>
<string>NeverMiss</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>LSMinimumSystemVersion</key>
<string>10.15</string>
<key>CFBundleIconFile</key>
<string>AppIcon</string>
</dict>
</plist>
PLIST
# If an icon.png exists in the root, automatically convert it to Apple's .icns format
if [ -f "icon.png" ]; then
echo "Converting icon.png to AppIcon.icns..."
mkdir -p MyIcon.iconset
sips -z 16 16 icon.png --out MyIcon.iconset/icon_16x16.png > /dev/null
sips -z 32 32 icon.png --out MyIcon.iconset/[email protected] > /dev/null
sips -z 32 32 icon.png --out MyIcon.iconset/icon_32x32.png > /dev/null
sips -z 64 64 icon.png --out MyIcon.iconset/[email protected] > /dev/null
sips -z 128 128 icon.png --out MyIcon.iconset/icon_128x128.png > /dev/null
sips -z 256 256 icon.png --out MyIcon.iconset/[email protected] > /dev/null
sips -z 256 256 icon.png --out MyIcon.iconset/icon_256x256.png > /dev/null
sips -z 512 512 icon.png --out MyIcon.iconset/[email protected] > /dev/null
sips -z 512 512 icon.png --out MyIcon.iconset/icon_512x512.png > /dev/null
sips -z 1024 1024 icon.png --out MyIcon.iconset/[email protected] > /dev/null
iconutil -c icns MyIcon.iconset -o "$APP_NAME/Contents/Resources/AppIcon.icns"
rm -rf MyIcon.iconset
else
echo "No icon.png found. Using default macOS application icon."
fi
cp target/release/never-miss "$APP_NAME/Contents/MacOS/"
cp target/release/never-miss-gui "$APP_NAME/Contents/MacOS/NeverMiss"
cp config.yaml "$APP_NAME/Contents/Resources/"
cp -r models "$APP_NAME/Contents/Resources/"
echo "NeverMiss.app successfully created!"
echo "Packaging into ~/Downloads/NeverMiss.dmg..."
DMG_NAME="$HOME/Downloads/NeverMiss.dmg"
STAGING_DIR="dmg_staging"
# Clean previous dmg and staging area
rm -f "$DMG_NAME"
rm -rf "$STAGING_DIR"
mkdir -p "$STAGING_DIR"
# Move app and create an Applications symlink for drag-and-drop installation
mv "$APP_NAME" "$STAGING_DIR/"
ln -s /Applications "$STAGING_DIR/Applications"
# Create the Disk Image (DMG)
hdiutil create -volname "NeverMiss" -srcfolder "$STAGING_DIR" -ov -format UDZO "$DMG_NAME" > /dev/null
# Clean up staging area
rm -rf "$STAGING_DIR"
echo "$DMG_NAME successfully created! You can now distribute this file."