fix: isolate installer bootstrap templates
This commit is contained in:
+3
-7
@@ -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
|
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 '准备安装目录与数据库凭据'
|
progress '准备安装目录与数据库凭据'
|
||||||
mkdir -p "$INSTALL_DIR" "$INSTALL_DIR"/{data/postgres,data,state,components,releases,secrets,config}
|
mkdir -p "$INSTALL_DIR" "$INSTALL_DIR"/{data/postgres,data,state,components,releases,secrets,config}
|
||||||
write_probe="$INSTALL_DIR/.xymediavault-write-probe-$$"
|
write_probe="$INSTALL_DIR/xymediavault-write-probe-$$"
|
||||||
if ! (umask 077 && : >"$write_probe" && rm -f "$write_probe"); then
|
if ! touch "$write_probe" || ! rm -f "$write_probe"; then
|
||||||
die "安装目录不可写:$INSTALL_DIR;请使用 --install-dir 指定本机可写目录,例如 /opt/xymediavault"
|
die "安装目录不可写:$INSTALL_DIR;请使用 --install-dir 指定本机可写目录,例如 /opt/xymediavault"
|
||||||
fi
|
fi
|
||||||
INSTALL_LOG="$INSTALL_DIR/install.log"
|
INSTALL_LOG="$INSTALL_DIR/install.log"
|
||||||
@@ -81,11 +81,7 @@ chmod 600 "$PG_PASSWORD_FILE"
|
|||||||
TEMPLATE_DIR="$INSTALL_DIR/bootstrap"
|
TEMPLATE_DIR="$INSTALL_DIR/bootstrap"
|
||||||
mkdir -p "$TEMPLATE_DIR"
|
mkdir -p "$TEMPLATE_DIR"
|
||||||
template_file() {
|
template_file() {
|
||||||
local name=$1 local_file="$SCRIPT_DIR/$1" downloaded="$TEMPLATE_DIR/$1"
|
local name=$1 downloaded="$TEMPLATE_DIR/$1"
|
||||||
if [[ -f $local_file ]]; then
|
|
||||||
printf '%s\n' "$local_file"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
curl --fail --silent --show-error --location --proto '=https' --tlsv1.2 "$RELEASE_BASE/$name" -o "$downloaded"
|
curl --fail --silent --show-error --location --proto '=https' --tlsv1.2 "$RELEASE_BASE/$name" -o "$downloaded"
|
||||||
printf '%s\n' "$downloaded"
|
printf '%s\n' "$downloaded"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user