release: sync public installer asset install.sh

This commit is contained in:
2026-09-02 01:53:02 +00:00
parent 1727ab659c
commit e5b98afbf0
+13 -8
View File
@@ -123,17 +123,22 @@ init_installer_log() {
}
guard_existing_install_tree() {
[[ $INSTALL_DIR = /* && $INSTALL_DIR != / ]] || return 0
INSTALL_PATH="$INSTALL_DIR" python3 - <<'PY' || die '安装目录路径不能包含符号链接'
INSTALL_DIR=$(INSTALL_PATH="$INSTALL_DIR" python3 - <<'PY'
import os, pathlib
p = pathlib.Path(os.environ['INSTALL_PATH'])
cur = pathlib.Path(p.root)
for part in p.parts[1:]:
cur /= part
if cur.exists() and cur.is_symlink(): raise SystemExit(1)
if p.exists():
s = p.stat()
if os.geteuid() == 0 and (s.st_uid != 0 or s.st_mode & 0o022): raise SystemExit(2)
print(p.resolve(strict=False))
PY
) || die '无法规范化安装目录路径'
[[ $INSTALL_DIR != / ]] || die '安装目录不能是根目录'
if [[ -e $INSTALL_DIR ]]; then
[[ -d $INSTALL_DIR && ! -L $INSTALL_DIR ]] || die '安装目录必须是普通目录'
INSTALL_PATH="$INSTALL_DIR" python3 - <<'PY' || die '安装目录权限不安全'
import os, pathlib
p = pathlib.Path(os.environ['INSTALL_PATH'])
s = p.stat()
if os.geteuid() == 0 and (s.st_uid != 0 or s.st_mode & 0o022): raise SystemExit(1)
PY
fi
[[ ! -e "$INSTALL_DIR/.env" || ! -L "$INSTALL_DIR/.env" ]] || die '.env must not be a symlink'
}
progress() {