#!/usr/bin/env bash # build-mac.sh — 打包 Arcrun RAG 托盤 app(daemon-beta t7/t8,真機執行)。 # # leo 07-24 裁決:**選單列托盤 icon 是唯一指示器,不佔 Dock**—— # fyne 預設 bundle 會出現 Dock icon,打包後把 LSUIElement=true 寫進 Info.plist 即隱。 # # 用法(真機、需 Xcode CLT): # cd collector/cmd/arcrun-tray && bash build-mac.sh # 產物:Arcrun RAG.app(含同綑 arcrun-collector)。簽章/公證另行(見 README)。 set -euo pipefail cd "$(dirname "$0")" echo "① 編 collector(同綑執行檔)" ( cd ../.. && go build -o "cmd/arcrun-tray/arcrun-collector" . ) echo "② fyne package" go run fyne.io/fyne/v2/cmd/fyne@latest package -os darwin -icon icon.png -name "Arcrun RAG" -appID dev.arcrun.rag.tray APP="Arcrun RAG.app" PLIST="$APP/Contents/Info.plist" echo "③ LSUIElement=true(托盤唯一指示器,隱 Dock icon——leo 07-24 裁決)" /usr/libexec/PlistBuddy -c "Add :LSUIElement bool true" "$PLIST" 2>/dev/null \ || /usr/libexec/PlistBuddy -c "Set :LSUIElement true" "$PLIST" echo "④ 同綑 collector 進 app bundle(托盤 collectorBinPath 找同層)" cp arcrun-collector "$APP/Contents/MacOS/arcrun-collector" echo "⑤ ad-hoc 重簽(Apple Silicon:改過 plist/塞過檔必重簽,否則 launchd 拒開 error 162——07-24 真機實撞)" codesign --force --deep -s - "$APP" echo "✅ 完成:$APP" echo "驗法:open '$APP' → 選單列出現 icon、Dock **不出現** icon → 選單列出資料夾清單"