Files
Outpost/scripts/package-dmg.sh
T
Puranjay Savar Mattas 472b9658d8 feat(app): wire Check for Updates to releases page, add DMG packaging script
About screen's "Check for Updates..." was a no-op placeholder - opens
the Gitea releases page now (no Sparkle-style in-app updater yet).

scripts/package-dmg.sh packages an Xcode-exported .app into a
distributable DMG with an Applications symlink, versioned from the
app's own Info.plist.
2026-08-14 03:10:56 +01:00

47 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# Packages an already-exported Outpost.app into a distributable DMG with an
# Applications-folder symlink for drag-to-install.
#
# Usage: scripts/package-dmg.sh /path/to/Outpost.app [output-dir]
#
# Produces: <output-dir>/Outpost-<version>.dmg
# Version/build number are read directly from the app's own Info.plist, so
# this always matches whatever MARKETING_VERSION was set to at archive time.
set -euo pipefail
APP_PATH="${1:?Usage: package-dmg.sh /path/to/Outpost.app [output-dir]}"
OUT_DIR="${2:-$(pwd)/dist}"
if [ ! -d "$APP_PATH" ]; then
echo "error: '$APP_PATH' not found or not a directory" >&2
exit 1
fi
APP_NAME="$(basename "$APP_PATH" .app)"
VERSION="$(defaults read "$APP_PATH/Contents/Info" CFBundleShortVersionString)"
BUILD="$(defaults read "$APP_PATH/Contents/Info" CFBundleVersion)"
mkdir -p "$OUT_DIR"
STAGING_DIR="$(mktemp -d)"
trap 'rm -rf "$STAGING_DIR"' EXIT
echo "Staging '$APP_NAME.app' ($VERSION build $BUILD)..."
cp -R "$APP_PATH" "$STAGING_DIR/"
ln -s /Applications "$STAGING_DIR/Applications"
DMG_NAME="${APP_NAME}-${VERSION}.dmg"
DMG_PATH="$OUT_DIR/$DMG_NAME"
rm -f "$DMG_PATH"
echo "Building $DMG_NAME..."
hdiutil create \
-volname "$APP_NAME $VERSION" \
-srcfolder "$STAGING_DIR" \
-ov \
-format UDZO \
"$DMG_PATH"
echo "Done: $DMG_PATH"