fix: check installer directory write access

This commit is contained in:
2026-08-30 13:31:56 +00:00
parent 646a518e57
commit 9d911ba7af
+4
View File
@@ -56,6 +56,10 @@ if ! [[ $API_PORT =~ ^[0-9]+$ && $WEBDAV_PORT =~ ^[0-9]+$ && $TVBOX_PORT =~ ^[0-
if ! [[ $PG_PORT =~ ^[0-9]+$ && $PG_DB =~ ^[A-Za-z0-9_]+$ && $PG_USER =~ ^[A-Za-z0-9_]+$ && $PG_HOST =~ ^[A-Za-z0-9._-]+$ ]]; then die 'invalid PostgreSQL connection values'; fi
progress '准备安装目录与数据库凭据'
mkdir -p "$INSTALL_DIR" "$INSTALL_DIR"/{data/postgres,data,state,components,releases,secrets,config}
write_probe="$INSTALL_DIR/.xymediavault-write-probe-$$"
if ! (umask 077 && : >"$write_probe" && rm -f "$write_probe"); then
die "安装目录不可写:$INSTALL_DIR;请使用 --install-dir 指定本机可写目录,例如 /opt/xymediavault"
fi
INSTALL_LOG="$INSTALL_DIR/install.log"
: >"$INSTALL_LOG"
chmod 600 "$INSTALL_LOG"