-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-dmg.sh
More file actions
executable file
·44 lines (35 loc) · 1.13 KB
/
Copy pathbuild-dmg.sh
File metadata and controls
executable file
·44 lines (35 loc) · 1.13 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
#!/bin/bash
set -e
CONFIG="${1:-release}"
VERSION=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" Info.plist)
DMG_NAME="APIBypass-${VERSION}.dmg"
STAGING="dmg_staging"
echo "==> Building $CONFIG..."
./build-app.sh "$CONFIG"
if [[ -x ./verify-release.sh ]]; then
echo "==> Verifying app bundle..."
./verify-release.sh APIBypass.app
fi
echo "==> Preparing DMG staging..."
rm -rf "$STAGING"
mkdir "$STAGING"
cp -R APIBypass.app "$STAGING/"
# Create Applications symlink for drag-to-install
ln -s /Applications "$STAGING/Applications"
echo "==> Creating $DMG_NAME..."
rm -f "$DMG_NAME"
hdiutil create -volname "APIBypass $VERSION" \
-srcfolder "$STAGING" \
-ov \
-format UDZO \
"$DMG_NAME"
if [[ -x ./verify-release.sh ]]; then
echo "==> Verifying DMG contents..."
MOUNT_OUTPUT=$(hdiutil attach "$DMG_NAME" -nobrowse -readonly)
MOUNT_POINT=$(printf '%s\n' "$MOUNT_OUTPUT" | grep '/Volumes/' | sed 's#.*\(/Volumes/.*\)#\1#' | tail -n 1)
./verify-release.sh "$MOUNT_POINT/APIBypass.app"
hdiutil detach "$MOUNT_POINT"
fi
echo "==> Cleaning up..."
rm -rf "$STAGING"
echo "==> Done: $DMG_NAME"