Complete the header template across Partnership, Kernel, Deployment and Plugin

Finishes the pass: every script now documents its safeguards, and the deliberate absences
in the sourced libraries are recorded so they are not "corrected" later.
This commit is contained in:
Gmer4Lfe
2026-08-01 22:44:23 -04:00
parent 5c4f8db497
commit c377ddfcca
24 changed files with 1237 additions and 32 deletions
+45
View File
@@ -24,6 +24,21 @@
# varaverk.cron rebuilt via PHP (job paths regenerated for new SCRIPTS_DIR)
#
# ==============================================================================================
# OPERATIONAL MODEL
# ==============================================================================================
#
# 1. Determine current mode from varaverk.cfg SCRIPTS_DIR, and the requested target mode
# Already in the target mode → exit cleanly, nothing to do
# 2. rsync -a --delete SRC → DST, then carry .git across so history survives the move
# 3. Rewrite the pointers, in this order:
# varaverk.cfg SCRIPTS_DIR
# master.conf TARGET_DIR
# host*.conf HOST*_STORAGE_MODE_INTERNAL
# 4. Rebuild varaverk.cron via PHP so every job path points at the new SCRIPTS_DIR
# 5. Flash mode only: sync Plugin/ back to /boot so the webUI keeps serving current PHP
# 6. Remove the old location once the new one is confirmed in place
#
# ==============================================================================================
# DESIGN PRINCIPLES
# ==============================================================================================
#
@@ -47,6 +62,31 @@
# --to= required — refuses to run without an explicit target mode
#
# ==============================================================================================
# CONFIGURATION
# ==============================================================================================
#
# This script WRITES these rather than reading them — they are the migration's output:
#
# varaverk.cfg
# SCRIPTS_DIR the authoritative install path. Everything else in the
# ecosystem derives from it, which is why it is written
# first and the cron is rebuilt from it afterwards.
#
# master.conf
# TARGET_DIR kept in step with SCRIPTS_DIR
#
# host*.conf
# HOST*_STORAGE_MODE_INTERNAL true = /boot/config/plugins/varaverk
# false = /mnt/user/appdata/Varaverk
#
# Load-bearing: STATE_DIR, DATA_DIR, PERSISTENT_CONF_CACHE and the orchestrator job paths are
# all built from SCRIPTS_DIR. Changing storage mode moves every one of them, which is why the
# cron is regenerated rather than edited.
#
# In flash mode the array must be started before Varaverk can function at all — appdata is
# not mounted before that.
#
# ==============================================================================================
# RUNTIME MODES
# ==============================================================================================
#
@@ -68,6 +108,11 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/../../../load_config.sh"
parse_args "$@"
# Relocates the entire Varaverk installation with rsync --delete and rm -rf, and rewrites
# varaverk.cfg, master.conf and host*.conf. Everything here needs root.
[[ "$EUID" -ne 0 ]] && { error "Must be run as root"; exit 1; }
acquire_lock
detect_hosts