#!/bin/bash # LiorUI macOS One-line Installer & Unquarantine Helper # Usage: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/blue-idea/liorui/main/scripts/install-mac.sh)" set -e echo "========================================================" echo " LiorUI macOS Automated Installer" echo " LiorUI macOS 一键自动化安装与授权脚本" echo "========================================================" echo "" APP_DIR="/Applications" TARGET_APP="${APP_DIR}/LiorUI.app" TMP_DIR="$(mktemp -d)" cleanup() { rm -rf "$TMP_DIR" } trap cleanup EXIT echo "🔍 Fetching latest LiorUI release from GitHub..." RELEASE_JSON=$(curl -s https://api.github.com/repos/blue-idea/liorui/releases/latest) DMG_URL=$(echo "$RELEASE_JSON" | grep -o 'https://[^"]*LiorUI\.dmg' | head -n 1) if [ -z "$DMG_URL" ]; then echo "❌ Failed to locate the LiorUI release artifact from GitHub Releases." exit 1 fi DMG_PATH="${TMP_DIR}/LiorUI.dmg" echo "⬇️ Downloading the LiorUI release artifact..." curl -L -o "$DMG_PATH" "$DMG_URL" MOUNT_DIR="${TMP_DIR}/mount" mkdir -p "$MOUNT_DIR" echo "💿 Mounting DMG..." hdiutil attach "$DMG_PATH" -mountpoint "$MOUNT_DIR" -nobrowse -quiet if [ -d "$TARGET_APP" ]; then echo "🗑️ Removing the existing LiorUI app in /Applications..." rm -rf "$TARGET_APP" 2>/dev/null || sudo rm -rf "$TARGET_APP" fi echo "📦 Installing the LiorUI app to /Applications..." cp -R "${MOUNT_DIR}/LiorUI.app" "$TARGET_APP" 2>/dev/null || sudo cp -R "${MOUNT_DIR}/LiorUI.app" "$TARGET_APP" echo "💿 Unmounting DMG..." hdiutil detach "$MOUNT_DIR" -quiet echo "🔓 Clearing quarantine attributes (Gatekeeper fix)..." xattr -dr com.apple.quarantine "$TARGET_APP" 2>/dev/null || sudo xattr -dr com.apple.quarantine "$TARGET_APP" echo "" echo "========================================================" echo "✅ Installation Success / 安装成功!" echo "You can now launch LiorUI from your Applications folder." echo "你现在可以在【应用程序】中直接运行并使用 LiorUI。" echo "========================================================"