's'
This commit is contained in:
42
d2ypp2/live-platform/scripts/install-core.sh
Normal file
42
d2ypp2/live-platform/scripts/install-core.sh
Normal file
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env bash
|
||||
# 幂等:同步配置中心默认 JSON → /opt/live/config,生成 system-stack.env,安装 Hub(无业务模块)
|
||||
set -euo pipefail
|
||||
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||
REPO="$(cd "$ROOT/.." && pwd)"
|
||||
# shellcheck source=/dev/null
|
||||
source "$ROOT/scripts/lib/common.sh"
|
||||
|
||||
ARCH="$(detect_arch)"
|
||||
echo "[live-platform] install-core arch=$ARCH"
|
||||
|
||||
ensure_live_dirs
|
||||
|
||||
if [[ ! -f /opt/live/config/system.json ]]; then
|
||||
cp -a "$ROOT/config/defaults/system.json" /opt/live/config/system.json
|
||||
fi
|
||||
if [[ ! -f /opt/live/config/network.json ]]; then
|
||||
cp -a "$ROOT/config/defaults/network.json" /opt/live/config/network.json
|
||||
fi
|
||||
if command -v rsync >/dev/null 2>&1; then
|
||||
rsync -a --ignore-existing "$ROOT/config/defaults/services/" /opt/live/config/services/
|
||||
rsync -a --ignore-existing "$ROOT/config/defaults/business/" /opt/live/config/business/
|
||||
else
|
||||
cp -n "$ROOT/config/defaults/services/"*.json /opt/live/config/services/ 2>/dev/null || true
|
||||
cp -n "$ROOT/config/defaults/business/"*.json /opt/live/config/business/ 2>/dev/null || true
|
||||
fi
|
||||
|
||||
export LIVE_CONFIG_ROOT="${LIVE_CONFIG_ROOT:-/opt/live/config}"
|
||||
python3 "$ROOT/tools/render_stack_env.py" /opt/live/generated/system-stack.env
|
||||
|
||||
if [[ -n "${LINK_REPO_CONFIG:-}" ]]; then
|
||||
mkdir -p "$REPO/config"
|
||||
ln -sf /opt/live/generated/system-stack.env "$REPO/config/system-stack.env"
|
||||
fi
|
||||
|
||||
if [[ -x "$REPO/scripts/linux/install_hub.sh" ]]; then
|
||||
bash "$REPO/scripts/linux/install_hub.sh" "$@"
|
||||
else
|
||||
echo "[live-platform] WARN: scripts/linux/install_hub.sh missing, skip hub packages"
|
||||
fi
|
||||
|
||||
echo "[live-platform] install-core done. Env: /opt/live/generated/system-stack.env"
|
||||
Reference in New Issue
Block a user