#!/bin/bash # Momentry Studio v0.1.0 Installation Script # Usage: ./install.sh set -e echo "=========================================" echo " Momentry Studio v0.1.0 Installation " echo "=========================================" echo "" # 检查操作系统 if [[ "$(uname)" != "Darwin" ]]; then echo "❌ Error: This script only supports macOS" exit 1 fi # 检查架构 ARCH=$(uname -m) if [[ "$ARCH" != "arm64" ]]; then echo "⚠️ Warning: This build is optimized for Apple Silicon (arm64)" echo " Current architecture: $ARCH" echo " Some features may not work correctly." fi # 设置安装目录 INSTALL_DIR="${INSTALL_DIR:-/Applications}" BIN_DIR="${BIN_DIR:-/usr/local/bin}" echo "📋 Installation Settings:" echo " App Location: $INSTALL_DIR/Momentry Studio.app" echo " Binary Location: $BIN_DIR" echo "" # 询问确认 read -p "Continue with installation? (y/n) " -n 1 -r echo if [[ ! $REPLY =~ ^[Yy]$ ]]; then echo "Installation cancelled." exit 1 fi # 检查 .app 是否存在 if [[ ! -d "Momentry Studio.app" ]]; then echo "❌ Error: Momentry Studio.app not found in current directory" echo " Please run this script from the release directory" exit 1 fi # 安装 .app echo "" echo "📦 Installing Momentry Studio.app..." cp -r "Momentry Studio.app" "$INSTALL_DIR/" echo "✅ App installed to $INSTALL_DIR/Momentry Studio.app" # 安装 binary(可选) if [[ -f "momentry-core" ]] && [[ -f "momentry-proxy" ]]; then echo "" read -p "Install backend binaries to $BIN_DIR? (y/n) " -n 1 -r echo if [[ $REPLY =~ ^[Yy]$ ]]; then echo "📦 Installing binaries..." sudo cp momentry-core "$BIN_DIR/" sudo cp momentry-proxy "$BIN_DIR/" sudo chmod +x "$BIN_DIR/momentry-core" sudo chmod +x "$BIN_DIR/momentry-proxy" echo "✅ Binaries installed to $BIN_DIR" fi fi # 创建配置示例 echo "" echo "📝 Creating example configuration..." mkdir -p ~/.momentry cat > ~/.momentry/momentry.toml << 'TOML' # Momentry Studio Configuration Example [server] host = "0.0.0.0" port = 3002 [database] url = "postgres://user:password@localhost:5432/momentry" [face_settings] min_confidence = 0.5 min_bbox_size = 80 TOML echo "✅ Configuration example created at ~/.momentry/momentry.toml" # 完成 echo "" echo "=========================================" echo " ✅ Installation Complete! " echo "=========================================" echo "" echo "🚀 Next Steps:" echo " 1. Configure database connection in ~/.momentry/momentry.toml" echo " 2. Set environment variable: export MOMENTRY_API_KEY=your_key" echo " 3. Start Core API: momentry-core server" echo " 4. Launch Studio: open \"$INSTALL_DIR/Momentry Studio.app\"" echo "" echo "📖 Documentation: See RELEASE_NOTES.md" echo "📞 Support: tech@momentry.ai" echo ""