diff --git a/install.sh b/install.sh index aac9de1..7bcc4d8 100644 --- a/install.sh +++ b/install.sh @@ -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"