release: 1.3.4
This commit is contained in:
@@ -4,7 +4,7 @@ set -Eeuo pipefail
|
||||
# Production entry point for first-admin setup. The installer keeps the
|
||||
# EnvironmentFile root-readable only, so parse simple KEY=VALUE assignments
|
||||
# without sourcing arbitrary shell code.
|
||||
PATH=/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/bin
|
||||
PATH=/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin
|
||||
export PATH
|
||||
umask 077
|
||||
|
||||
@@ -15,6 +15,13 @@ SERVICE_NAME=${TALLYNOTE_SERVICE_NAME:-tallynote.service}
|
||||
|
||||
die() { printf 'tallynote admin-init: %s\n' "$*" >&2; exit 1; }
|
||||
|
||||
node_is_usable() {
|
||||
local candidate=$1 major
|
||||
[[ -n "$candidate" && -x "$candidate" ]] || return 1
|
||||
major=$("$candidate" -p 'process.versions.node.split(".")[0]' 2>/dev/null || true)
|
||||
[[ "$major" =~ ^[0-9]+$ && "$major" -ge 24 ]]
|
||||
}
|
||||
|
||||
load_environment_file() {
|
||||
[[ -e "$CONFIG_FILE" ]] || return 0
|
||||
[[ -f "$CONFIG_FILE" && ! -L "$CONFIG_FILE" ]] || die '环境文件不是安全的普通文件'
|
||||
@@ -105,9 +112,9 @@ main() {
|
||||
[[ "$argument" == "--check" ]] && check_only=1
|
||||
done
|
||||
root=$(resolve_release_root)
|
||||
node="$root/runtime/bin/node"
|
||||
[[ -x "$node" ]] || node=$(command -v node || true)
|
||||
[[ -n "$node" && -x "$node" ]] || die '找不到 Node.js runtime'
|
||||
node=${TALLYNOTE_NODE:-}
|
||||
node_is_usable "$node" || node=$(command -v node || true)
|
||||
node_is_usable "$node" || die '找不到 Node.js 24+'
|
||||
cli="$root/dist/server/cli/admin-init.js"
|
||||
[[ -f "$cli" && ! -L "$cli" ]] || die '管理员初始化程序不存在'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user