-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackage.sh
More file actions
executable file
·41 lines (35 loc) · 920 Bytes
/
package.sh
File metadata and controls
executable file
·41 lines (35 loc) · 920 Bytes
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
#!/bin/bash
set -e
APP_NAME="MacTemp"
APP_BUNDLE="$APP_NAME.app"
DMG_NAME="$APP_NAME.dmg"
STAGING_DIR="dmg_staging"
echo "==> Building $APP_NAME..."
swiftc \
-framework Cocoa \
-framework IOKit \
-framework ServiceManagement \
-O \
Sources/main.swift \
-o "$APP_BUNDLE/Contents/MacOS/$APP_NAME"
echo "==> Staging DMG contents..."
rm -rf "$STAGING_DIR"
mkdir "$STAGING_DIR"
cp -R "$APP_BUNDLE" "$STAGING_DIR/"
# Add a symlink to /Applications so users can drag-install
ln -s /Applications "$STAGING_DIR/Applications"
echo "==> Creating $DMG_NAME..."
rm -f "$DMG_NAME"
hdiutil create \
-volname "$APP_NAME" \
-srcfolder "$STAGING_DIR" \
-ov \
-format UDZO \
-fs HFS+ \
"$DMG_NAME"
rm -rf "$STAGING_DIR"
echo ""
echo "Done! → $DMG_NAME"
echo ""
echo "Note: Since the app is unsigned, your friend must right-click → Open"
echo "the first time to bypass Gatekeeper."