#!/bin/bash # HereIAm DMG Creation Script # Creates a distributable DMG file with the app set -e echo "๐Ÿ“ฆ Creating DMG for HereIAm..." echo "==============================" # Colors RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' BLUE='\033[0;34m' NC='\033[0m' # Get script directory SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" cd "$SCRIPT_DIR" # Configuration APP_NAME="HereIAm" VERSION="1.0.0" DMG_NAME="${APP_NAME}-${VERSION}" APP_PATH="dist/${APP_NAME}.app" DMG_DIR="dmg_temp" FINAL_DMG="dist/${DMG_NAME}.dmg" # Check if app exists if [ ! -d "$APP_PATH" ]; then echo -e "${RED}โŒ Error: $APP_PATH not found!${NC}" echo "Please run './build_app.sh' first to build the app." exit 1 fi # Clean up any existing DMG files echo -e "${BLUE}๐Ÿงน Cleaning up previous DMG files...${NC}" rm -f "$FINAL_DMG" rm -rf "$DMG_DIR" # Create temporary DMG directory echo -e "${BLUE}๐Ÿ“ Creating DMG structure...${NC}" mkdir -p "$DMG_DIR" # Copy app to DMG directory echo -e "${BLUE}๐Ÿ“‹ Copying app to DMG...${NC}" cp -R "$APP_PATH" "$DMG_DIR/" # Create Applications symlink for easy installation echo -e "${BLUE}๐Ÿ”— Creating Applications symlink...${NC}" ln -sf /Applications "$DMG_DIR/Applications" # Create a README for the DMG cat > "$DMG_DIR/README.txt" << EOF HereIAm - Mouse Movement Monitor for macOS Version $VERSION Installation: 1. Drag HereIAm.app to the Applications folder 2. Launch HereIAm from Applications or Spotlight 3. Grant accessibility permissions when prompted The app will appear in your menu bar. Right-click to access controls. For support: jerico@tekop.net EOF # Calculate size needed for DMG echo -e "${BLUE}๐Ÿ“ Calculating DMG size...${NC}" SIZE=$(du -sk "$DMG_DIR" | cut -f1) SIZE=$((SIZE + 1000)) # Add some padding # Create the DMG echo -e "${BLUE}๐Ÿ’ฟ Creating DMG file...${NC}" hdiutil create -srcfolder "$DMG_DIR" -volname "$APP_NAME" -fs HFS+ \ -fsargs "-c c=64,a=16,e=16" -format UDZO -imagekey zlib-level=9 "$FINAL_DMG" # Clean up echo -e "${BLUE}๐Ÿงน Cleaning up temporary files...${NC}" rm -rf "$DMG_DIR" # Verify final DMG if [ -f "$FINAL_DMG" ]; then dmg_size=$(du -sh "$FINAL_DMG" | cut -f1) echo "" echo -e "${GREEN}๐ŸŽ‰ DMG created successfully!${NC}" echo -e "${GREEN}๐Ÿ“ฆ File: $FINAL_DMG${NC}" echo -e "${GREEN}๐Ÿ“ Size: $dmg_size${NC}" echo "" echo -e "${YELLOW}๐Ÿ“ Next steps for distribution:${NC}" echo "1. Test the DMG: open \"$FINAL_DMG\"" echo "2. For wider distribution, consider notarization:" echo " xcrun notarytool submit \"$FINAL_DMG\" --keychain-profile \"AC_PASSWORD\"" echo "3. Upload to your website or distribution platform" echo "" else echo -e "${RED}โŒ DMG creation failed!${NC}" exit 1 fi