s
This commit is contained in:
45
d2ypp2/scripts/linux/install_all.sh
Normal file
45
d2ypp2/scripts/linux/install_all.sh
Normal file
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
SELF_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
INSTALL_TAG="all"
|
||||
. "$SELF_DIR/lib/common.sh"
|
||||
|
||||
ensure_root "$@"
|
||||
load_env
|
||||
|
||||
ensure_live_user
|
||||
normalize_repo_root
|
||||
ensure_runtime_dirs_owned_by_live
|
||||
install_base_packages
|
||||
install_media_packages
|
||||
configure_adb_udev
|
||||
install_nodejs
|
||||
install_docker_stack
|
||||
install_android_panel
|
||||
prepare_python_runtime
|
||||
prepare_web_console
|
||||
install_live_console_service
|
||||
configure_sudoers
|
||||
configure_mdns
|
||||
configure_wifi_profile
|
||||
install_shellcrash
|
||||
install_browser_stack
|
||||
install_neko_browser
|
||||
install_redroid
|
||||
prepare_mitmproxy
|
||||
prepare_vscode_server
|
||||
prepare_uptime_kuma
|
||||
prepare_openclaw
|
||||
install_pulseaudio_service
|
||||
install_kmscube_service
|
||||
install_webtty
|
||||
install_cockpit
|
||||
install_netdata
|
||||
prepare_homepage
|
||||
prepare_filebrowser
|
||||
prepare_srs
|
||||
run_hardware_probe
|
||||
install_live_edge_proxy
|
||||
ensure_runtime_dirs_owned_by_live
|
||||
print_summary "all"
|
||||
@@ -12,8 +12,7 @@ case "$PROFILE" in
|
||||
exec bash "$ROOT_DIR/scripts/linux/install_business.sh" "${@:2}"
|
||||
;;
|
||||
all|full)
|
||||
bash "$ROOT_DIR/scripts/linux/install_hub.sh" "${@:2}"
|
||||
bash "$ROOT_DIR/scripts/linux/install_business.sh" "${@:2}"
|
||||
exec bash "$ROOT_DIR/scripts/linux/install_all.sh" "${@:2}"
|
||||
;;
|
||||
*)
|
||||
cat <<USAGE
|
||||
|
||||
@@ -701,31 +701,48 @@ install_docker_stack() {
|
||||
prepare_python_runtime() {
|
||||
log "Preparing Python virtual environment"
|
||||
chown -R live:live "$ROOT_DIR"
|
||||
rm -rf "$ROOT_DIR/.venv"
|
||||
as_live "python3 -m venv .venv" || {
|
||||
log "venv create failed; retry once with --clear"
|
||||
local req_hash req_stamp
|
||||
req_stamp="$ROOT_DIR/.venv/.requirements.sha256"
|
||||
req_hash="$(sha256sum "$ROOT_DIR/requirements.txt" "$ROOT_DIR/pyproject.toml" 2>/dev/null | sha256sum | awk '{print $1}')"
|
||||
if ! as_live "test -x .venv/bin/python && .venv/bin/python -V >/dev/null 2>&1"; then
|
||||
rm -rf "$ROOT_DIR/.venv"
|
||||
if ! as_live "python3 -m venv .venv"; then
|
||||
log "WARN: venv still failed; using a shim over the system Python"
|
||||
as_live "python3 -m venv .venv" || {
|
||||
log "venv create failed; retry once with --clear"
|
||||
rm -rf "$ROOT_DIR/.venv"
|
||||
create_python_venv_shim "$ROOT_DIR/.venv"
|
||||
fi
|
||||
}
|
||||
if ! as_live ". .venv/bin/activate && pip install --upgrade pip && pip install -r requirements.txt"; then
|
||||
log "pip install failed; retry with --no-cache-dir"
|
||||
as_live ". .venv/bin/activate && pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt" || \
|
||||
log "WARN: Python deps incomplete; control plane may fail until fixed manually"
|
||||
if ! as_live "python3 -m venv .venv"; then
|
||||
log "WARN: venv still failed; using a shim over the system Python"
|
||||
rm -rf "$ROOT_DIR/.venv"
|
||||
create_python_venv_shim "$ROOT_DIR/.venv"
|
||||
fi
|
||||
}
|
||||
else
|
||||
log "Reusing existing Python virtual environment"
|
||||
fi
|
||||
if [ -f "$req_stamp" ] && [ "$(cat "$req_stamp" 2>/dev/null)" = "$req_hash" ]; then
|
||||
log "Python requirements unchanged; skipping pip install"
|
||||
return 0
|
||||
fi
|
||||
if ! as_live ". .venv/bin/activate && python -m pip install --upgrade pip && python -m pip install -r requirements.txt"; then
|
||||
log "pip install failed; retry with --no-cache-dir"
|
||||
if ! as_live ". .venv/bin/activate && python -m pip install --upgrade pip && python -m pip install --no-cache-dir -r requirements.txt"; then
|
||||
log "WARN: Python deps incomplete; control plane may fail until fixed manually"
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
printf '%s\n' "$req_hash" >"$req_stamp"
|
||||
chown live:live "$req_stamp" 2>/dev/null || true
|
||||
}
|
||||
|
||||
prepare_web_console() {
|
||||
log "Building web console"
|
||||
if as_live "cd web-console && if [ -f package-lock.json ]; then npm ci; else npm install; fi && npm run build"; then
|
||||
if as_live ". .venv/bin/activate && python scripts/launch.py --build-only --no-env-check"; then
|
||||
return 0
|
||||
fi
|
||||
log "web console build failed; cleaning node_modules and retrying"
|
||||
as_live "cd web-console && rm -rf node_modules .next && npm install && npm run build" || \
|
||||
log "web console build failed; cleaning artifacts and retrying"
|
||||
as_live "cd web-console && rm -rf node_modules .next out" || true
|
||||
if ! as_live ". .venv/bin/activate && python scripts/launch.py --build-only --no-env-check"; then
|
||||
log "WARN: web console build still failed — service may serve stale assets until rebuilt"
|
||||
fi
|
||||
}
|
||||
|
||||
install_live_console_service() {
|
||||
@@ -736,6 +753,8 @@ install_live_console_service() {
|
||||
Description=Live Super Hub Control Plane
|
||||
After=network-online.target docker.service
|
||||
Wants=network-online.target
|
||||
# 避免构建/依赖短暂失败时触发 systemd 默认「5 次/10s」后永久停跑(表现为 live-edge 502、:8001 无监听)
|
||||
StartLimitIntervalSec=0
|
||||
|
||||
[Service]
|
||||
User=live
|
||||
@@ -747,8 +766,6 @@ LimitNOFILE=$LIVE_NOFILE_SOFT
|
||||
ExecStart=$ROOT_DIR/start.sh
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
# 避免构建/依赖短暂失败时触发 systemd 默认「5 次/10s」后永久停跑(表现为 live-edge 502、:8001 无监听)
|
||||
StartLimitIntervalSec=0
|
||||
# 首次 npm build / 冷启动较慢;过小会导致主进程在 listen 前被 SIGTERM
|
||||
TimeoutStartSec=300
|
||||
TimeoutStopSec=30
|
||||
@@ -1338,14 +1355,27 @@ else:
|
||||
path.write_text(text, encoding="utf-8")
|
||||
PY
|
||||
chown -R live:live "$ANDROID_PANEL_DIR"
|
||||
rm -rf "$ANDROID_PANEL_DIR/.venv"
|
||||
if ! runuser -u live -- bash -lc "python3 -m venv '$ANDROID_PANEL_DIR/.venv'"; then
|
||||
log "WARN: Android panel venv failed; using a shim over the system Python"
|
||||
local panel_req_hash panel_req_stamp
|
||||
panel_req_stamp="$ANDROID_PANEL_DIR/.venv/.requirements.sha256"
|
||||
panel_req_hash="$(sha256sum "$ANDROID_PANEL_DIR/requirements.txt" 2>/dev/null | awk '{print $1}')"
|
||||
if ! runuser -u live -- bash -lc "test -x '$ANDROID_PANEL_DIR/.venv/bin/python' && '$ANDROID_PANEL_DIR/.venv/bin/python' -V >/dev/null 2>&1"; then
|
||||
rm -rf "$ANDROID_PANEL_DIR/.venv"
|
||||
create_python_venv_shim "$ANDROID_PANEL_DIR/.venv"
|
||||
chown -R live:live "$ANDROID_PANEL_DIR/.venv"
|
||||
if ! runuser -u live -- bash -lc "python3 -m venv '$ANDROID_PANEL_DIR/.venv'"; then
|
||||
log "WARN: Android panel venv failed; using a shim over the system Python"
|
||||
rm -rf "$ANDROID_PANEL_DIR/.venv"
|
||||
create_python_venv_shim "$ANDROID_PANEL_DIR/.venv"
|
||||
chown -R live:live "$ANDROID_PANEL_DIR/.venv"
|
||||
fi
|
||||
else
|
||||
log "Reusing Android panel virtual environment"
|
||||
fi
|
||||
if [ ! -f "$panel_req_stamp" ] || [ "$(cat "$panel_req_stamp" 2>/dev/null)" != "$panel_req_hash" ]; then
|
||||
runuser -u live -- bash -lc ". '$ANDROID_PANEL_DIR/.venv/bin/activate' && python -m pip install --upgrade pip && python -m pip install -r '$ANDROID_PANEL_DIR/requirements.txt'"
|
||||
printf '%s\n' "$panel_req_hash" >"$panel_req_stamp"
|
||||
chown live:live "$panel_req_stamp" 2>/dev/null || true
|
||||
else
|
||||
log "Android panel requirements unchanged; skipping pip install"
|
||||
fi
|
||||
runuser -u live -- bash -lc ". '$ANDROID_PANEL_DIR/.venv/bin/activate' && pip install --upgrade pip && pip install -r '$ANDROID_PANEL_DIR/requirements.txt'"
|
||||
allow_tcp_port_if_firewall_active "$ANDROID_PANEL_PORT"
|
||||
|
||||
cat >/etc/systemd/system/live-android-panel.service <<UNIT
|
||||
|
||||
Reference in New Issue
Block a user