install.sh → v0.4.0

This commit is contained in:
wangd 2026-09-08 16:58:30 +08:00
parent 81fb963e60
commit ec54fd4be5

View file

@ -1,5 +1,5 @@
#!/bin/sh
# Agent for Science —— 内网安装macOS不经浏览器不弹 Gatekeeper
# ScienceMate —— 内网安装macOS不经浏览器不弹 Gatekeeper
#
# curl -fsSL <发布目录>/install.sh | sh
#
@ -24,11 +24,11 @@ set -eu
# 下面两行由打包器整行替换(占位符只能出现在这里,别处不许提它 —— 第一版把占位符
# 也写进了 case 的模式里,替换后要么语法错、要么把正确的地址当成"没填"拒掉)。
DEFAULT_URL="https://desktop-9el2944.taile9f15e.ts.net/wangd/agent-for-science/releases/download/v0.3.0"
DEFAULT_DMG="Agent-for-Science-0.3.0-arm64.dmg"
DEFAULT_URL="https://desktop-9el2944.taile9f15e.ts.net/wangd/sciencemate/releases/download/v0.4.0"
DEFAULT_DMG="ScienceMate-0.4.0-arm64.dmg"
BASE="${AFS_RELEASE_URL:-$DEFAULT_URL}"
DMG="$DEFAULT_DMG"
APP="Agent for Science.app"
APP="ScienceMate.app"
DEST="${AFS_INSTALL_DIR:-/Applications}"
DRY="${AFS_DRY_RUN:-}"
# 私有 Forgejo 仓库的 release 资产要登录才下得到AFS_AUTH="user:token"(只读 token 即可)。
@ -72,9 +72,9 @@ if [ -z "$DRY" ] && [ ! -w "$DEST" ]; then
DEST="$HOME/Applications"; mkdir -p "$DEST"
say " /Applications 写不了,改装到 $DEST"
fi
if [ -z "$DRY" ] && pgrep -x AgentForScience >/dev/null 2>&1; then
if [ -z "$DRY" ] && pgrep -x ScienceMate >/dev/null 2>&1; then
say " 应用正在运行,先退出它"
osascript -e 'tell application "Agent for Science" to quit' >/dev/null 2>&1 || true
osascript -e 'tell application "ScienceMate" to quit' >/dev/null 2>&1 || true
sleep 2
fi
run hdiutil attach "$WORK/$DMG" -nobrowse -readonly -quiet -mountpoint "$WORK/mnt"