#!/bin/bash set -e # Configuration APP_NAME="Apple Intelligence Server" DMG_NAME="AppleIntelligenceServer" VERSION="1.0.0" # Paths SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" PROJECT_DIR="$(dirname "$SCRIPT_DIR")" DIST_DIR="$PROJECT_DIR/dist" APP_BUNDLE="$DIST_DIR/$APP_NAME.app" DMG_PATH="$DIST_DIR/$DMG_NAME-$VERSION.dmg" TEMP_DMG="$DIST_DIR/temp.dmg" # Check if app bundle exists if [ ! -d "$APP_BUNDLE" ]; then echo "App bundle not found. Running build-app.sh first..." "$SCRIPT_DIR/build-app.sh" fi echo "Creating DMG..." # Remove old DMG if exists rm -f "$DMG_PATH" rm -f "$TEMP_DMG" # Create a temporary directory for DMG contents DMG_TEMP_DIR="$DIST_DIR/dmg-temp" rm -rf "$DMG_TEMP_DIR" mkdir -p "$DMG_TEMP_DIR" # Copy app to temp directory cp -R "$APP_BUNDLE" "$DMG_TEMP_DIR/" # Create symbolic link to Applications folder ln -s /Applications "$DMG_TEMP_DIR/Applications" # Create the DMG hdiutil create -volname "$APP_NAME" \ -srcfolder "$DMG_TEMP_DIR" \ -ov -format UDRW "$TEMP_DMG" # Convert to compressed DMG hdiutil convert "$TEMP_DMG" -format UDZO -o "$DMG_PATH" # Clean up rm -f "$TEMP_DMG" rm -rf "$DMG_TEMP_DIR" echo "" echo "DMG created: $DMG_PATH" echo "" echo "Size: $(du -h "$DMG_PATH" | cut -f1)" echo "" echo "To distribute:" echo "1. Code sign the app (requires Apple Developer account)" echo "2. Notarize the DMG (required for Gatekeeper)" echo "3. Share the DMG file"