#!/bin/bash # MarkBaseFS FSKit Bundle 更新脚本 # Date: 2026-09-21 # Purpose: 更新 FSKit Module Bundle 配置 set -e echo "========================================" echo "MarkBaseFS FSKit Bundle 更新" echo "========================================" echo "" SOURCE_PLIST="/Users/accusys/markbase/markbase-fskit/Info.plist" TARGET_BUNDLE="/Library/Filesystems/markbasefs.fs" BACKUP_DIR="/tmp/markbasefs_backup_$(date +%Y%m%d_%H%M%S)" echo "Phase 1: 备份当前配置" echo "----------------------------------------" # 创建备份 sudo mkdir -p "$BACKUP_DIR" sudo cp -R "$TARGET_BUNDLE/Contents" "$BACKUP_DIR/" echo "✅ 备份已保存到: $BACKUP_DIR" echo "" echo "Phase 2: 更新 Info.plist" echo "----------------------------------------" # 复制新的 Info.plist sudo cp "$SOURCE_PLIST" "$TARGET_BUNDLE/Contents/Info.plist" echo "✅ Info.plist 已更新" # 显示新配置 echo "" echo "新配置内容:" cat "$TARGET_BUNDLE/Contents/Info.plist" echo "" echo "Phase 3: 验证配置" echo "----------------------------------------" # 检查关键配置 if grep -q "FSKitPersonalities" "$TARGET_BUNDLE/Contents/Info.plist"; then echo "✅ FSKitPersonalities 已添加" else echo "❌ FSKitPersonalities 缺失" exit 1 fi if grep -q "FSKitMountOptions" "$TARGET_BUNDLE/Contents/Info.plist"; then echo "✅ FSKitMountOptions 已添加" else echo "❌ FSKitMountOptions 缺失" exit 1 fi if grep -q "markbasefs" "$TARGET_BUNDLE/Contents/Info.plist"; then echo "✅ URL scheme 已配置" else echo "❌ URL scheme 缺失" exit 1 fi echo "" echo "Phase 4: 重启 FSKit 服务" echo "----------------------------------------" echo "重启 FSKit Agent..." sudo pkill -HUP fskit_agent || echo " ⚠️ fskit_agent 未运行" echo "重启 FSKit Helper..." sudo pkill -HUP fskit_helper || echo " ⚠️ fskit_helper 未运行" echo "✅ FSKit 服务已重启" echo "" echo "Phase 5: 验证服务" echo "----------------------------------------" sleep 2 # 检查服务状态 echo "FSKit 服务状态:" ps aux | grep -E "fskitd|fskit_agent|fskit_helper" | grep -v grep || echo " ⚠️ 服务未运行" echo "" echo "========================================" echo "✅ 更新完成" echo "========================================" echo "" echo "下一步测试:" echo " 1. 测试 Finder \"Connect to Server\"" echo " URL: markbasefs://localhost?user=accusys&db=/Users/accusys/markbase/data/users/accusys.sqlite" echo "" echo " 2. 测试 Rust Binary" echo " ./target/release/markbase_fs test " echo "" echo " 3. 检查系统日志" echo " log show --predicate 'subsystem == \"com.apple.fskit\"' --last 1m"