release: sync public installer asset install.sh
This commit is contained in:
+13
-8
@@ -123,17 +123,22 @@ init_installer_log() {
|
|||||||
}
|
}
|
||||||
guard_existing_install_tree() {
|
guard_existing_install_tree() {
|
||||||
[[ $INSTALL_DIR = /* && $INSTALL_DIR != / ]] || return 0
|
[[ $INSTALL_DIR = /* && $INSTALL_DIR != / ]] || return 0
|
||||||
INSTALL_PATH="$INSTALL_DIR" python3 - <<'PY' || die '安装目录路径不能包含符号链接'
|
INSTALL_DIR=$(INSTALL_PATH="$INSTALL_DIR" python3 - <<'PY'
|
||||||
import os, pathlib
|
import os, pathlib
|
||||||
p = pathlib.Path(os.environ['INSTALL_PATH'])
|
p = pathlib.Path(os.environ['INSTALL_PATH'])
|
||||||
cur = pathlib.Path(p.root)
|
print(p.resolve(strict=False))
|
||||||
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)
|
|
||||||
PY
|
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'
|
[[ ! -e "$INSTALL_DIR/.env" || ! -L "$INSTALL_DIR/.env" ]] || die '.env must not be a symlink'
|
||||||
}
|
}
|
||||||
progress() {
|
progress() {
|
||||||
|
|||||||
Reference in New Issue
Block a user