0de6fe4064
- csproj 静态链接 Skia/HarfBuzz/ANGLE(CoreUtils.*.Static),AOT 产出真单文件 - 发布后清理 .dll/.lib/.pdb,只留 notify.exe - bin/notify.cmd 与 notify.sh:首次运行从 Release 下载 notify.exe 原子下载(临时文件+改名)+ mkdir 锁,并发不重复下载,带陈旧锁恢复 - 修复 cmd 引导脚本管道 stdin 丢失:避免调 exe 前向前 goto,改用 call 子程序 - hooks.json 指向 notify.cmd,超时放宽以容纳首次下载 - .gitignore 放行两个脚本但忽略 notify.exe;.gitattributes 固定脚本换行符
39 lines
1.4 KiB
Bash
39 lines
1.4 KiB
Bash
#!/bin/sh
|
|
# ============================================================
|
|
# 下载地址(首次运行从这里拉取 notify.exe)—— 按需修改
|
|
DOWNLOAD_URL="https://github.com/OWNER/REPO/releases/latest/download/notify.exe"
|
|
# ============================================================
|
|
|
|
DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
EXE="$DIR/notify.exe"
|
|
LOCK="$DIR/notify.download.lock"
|
|
|
|
if [ ! -f "$EXE" ]; then
|
|
# mkdir 是原子操作,用作锁:成功=本进程负责下载,失败=已有进程在下
|
|
if mkdir "$LOCK" 2>/dev/null; then
|
|
# 双重检查,避免刚好别人下完
|
|
if [ ! -f "$EXE" ]; then
|
|
TMP="$DIR/notify.exe.$$.tmp"
|
|
if curl -fsSL "$DOWNLOAD_URL" -o "$TMP"; then
|
|
mv -f "$TMP" "$EXE" # 原子改名,避免半截 exe
|
|
chmod +x "$EXE" 2>/dev/null
|
|
else
|
|
rm -f "$TMP"
|
|
fi
|
|
fi
|
|
rmdir "$LOCK" 2>/dev/null
|
|
else
|
|
# 没抢到锁:等 exe 出现(最多约 60 秒)
|
|
i=0
|
|
while [ ! -f "$EXE" ] && [ "$i" -lt 120 ]; do
|
|
sleep 0.5
|
|
i=$((i + 1))
|
|
done
|
|
# 超时仍没下好:可能上次下载被杀留下陈旧锁,清掉让下次重下
|
|
[ ! -f "$EXE" ] && rmdir "$LOCK" 2>/dev/null
|
|
fi
|
|
fi
|
|
|
|
# 转发全部参数与 stdin 给真正的 exe
|
|
[ -f "$EXE" ] && exec "$EXE" "$@"
|