From b4340dcd0fa4a4d502636d3aa0d9e7cd77e1921d Mon Sep 17 00:00:00 2001 From: admin Date: Sun, 30 Aug 2026 13:54:35 +0000 Subject: [PATCH] fix: isolate installer bootstrap templates --- install.sh | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/install.sh b/install.sh index 26fcc20..51960c9 100644 --- a/install.sh +++ b/install.sh @@ -56,8 +56,8 @@ 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 +write_probe="$INSTALL_DIR/xymediavault-write-probe-$$" +if ! touch "$write_probe" || ! rm -f "$write_probe"; then die "安装目录不可写:$INSTALL_DIR;请使用 --install-dir 指定本机可写目录,例如 /opt/xymediavault" fi INSTALL_LOG="$INSTALL_DIR/install.log" @@ -81,11 +81,7 @@ chmod 600 "$PG_PASSWORD_FILE" TEMPLATE_DIR="$INSTALL_DIR/bootstrap" mkdir -p "$TEMPLATE_DIR" template_file() { - local name=$1 local_file="$SCRIPT_DIR/$1" downloaded="$TEMPLATE_DIR/$1" - if [[ -f $local_file ]]; then - printf '%s\n' "$local_file" - return 0 - fi + local name=$1 downloaded="$TEMPLATE_DIR/$1" curl --fail --silent --show-error --location --proto '=https' --tlsv1.2 "$RELEASE_BASE/$name" -o "$downloaded" printf '%s\n' "$downloaded" }