Point the WebGUI symlink at the actual install, and report this host's identity rather than HOST1's

The .plg hardcoded the flash path and runs every boot, so an appdata node served a stale copy that never receives pulls — fixes appeared to do nothing, indefinitely.
This commit is contained in:
Gmer4Lfe
2026-08-17 11:52:33 -04:00
parent 620d7eb6f1
commit 7ae510ed28
3 changed files with 47 additions and 3 deletions
+18
View File
@@ -395,6 +395,24 @@ else
fi
fi
# ── Repoint the WebGUI at the new location ────────────────────────────────────
# The .plg rebuilds this symlink on every boot and now follows SCRIPTS_DIR, but a migration is
# not a boot. Without this the WebGUI keeps serving the old copy until the next restart, so a
# migration appears to work while every page, endpoint and pull-target is still the old tree.
WEB_DIR="/usr/local/emhttp/plugins/varaverk"
if [[ "$DRY_RUN" == true ]]; then
warn "DRY RUN — would repoint $WEB_DIR$DST/Plugin/unraid"
elif [[ -d "$DST/Plugin/unraid" ]]; then
ln -sfn "$DST/Plugin/unraid" "$WEB_DIR"
if [[ "$(readlink -f "$WEB_DIR")" == "$(readlink -f "$DST/Plugin/unraid")" ]]; then
echo "WebGUI repointed → $DST/Plugin/unraid ✅"
else
warn "Could not repoint $WEB_DIR — the WebGUI will keep serving the old tree until reboot"
fi
else
warn "$DST/Plugin/unraid missing — WebGUI left pointing at the old tree"
fi
# ──────────────────────────────────────────────────────────────────────────────
echo ""
echo "━━━━━ $ICON_DONE Migration complete ━━━━━"
+13 -2
View File
@@ -91,11 +91,22 @@ $items = [];
// ── Identity ──────────────────────────────────────────────────────────────────
preg_match('/^\s*HOST1\s*=\s*"([^"]*)"/m', $master, $m1);
$host1 = trim($m1[1] ?? '');
// "Server identity" is this server's, not HOST1's. It was hardcoded to read master.conf's HOST1
// and print "HOST1: <name>", so on the mirror the row that answers "which host am I" confidently
// named the other machine — and reported ok purely because the owner's slot was filled in, which
// says nothing about whether this host resolved to a slot at all.
$myName = '';
if ($hostId !== 'unknown') {
preg_match('/^\s*' . preg_quote($hostIdUp, '/') . '\s*=\s*"([^"]*)"/m', $master, $mSelf);
$myName = trim($mSelf[1] ?? '');
}
$items[] = [
'id' => 'identity',
'label' => 'Server identity',
'ok' => !empty($host1),
'detail' => $host1 ? "HOST1: $host1" : 'HOST1 blank in master.conf',
'ok' => $hostId !== 'unknown' && !empty($myName),
'detail' => ($hostId !== 'unknown' && $myName)
? "$hostIdUp: $myName"
: 'This host does not match any HOST* entry in master.conf',
];
// ── Host conf ─────────────────────────────────────────────────────────────────
+16 -1
View File
@@ -52,7 +52,22 @@
<![CDATA[
#!/bin/bash
WEB_DIR="/usr/local/emhttp/plugins/varaverk"
SRC="/boot/config/plugins/varaverk/Plugin/unraid"
# SRC follows the install, it is not assumed. This was hardcoded to the flash path while this
# block runs on EVERY boot, so an appdata-mode node had its WebGUI pointed back at the flash copy
# every time it started — a copy that stops receiving pulls the moment SCRIPTS_DIR moves. The
# result is a host where git pull reports success, the files on disk are current, and the pages
# served are whatever the flash copy last had. Fixes appear to do nothing, indefinitely.
#
# varaverk.cfg stays on flash regardless of layout, which is what makes it readable this early.
SRC=""
if [[ -f /boot/config/plugins/varaverk/varaverk.cfg ]]; then
_sd=$( . /boot/config/plugins/varaverk/varaverk.cfg >/dev/null 2>&1 || true
printf '%s' "${SCRIPTS_DIR:-}" )
[[ -n "$_sd" && -d "$_sd/Plugin/unraid" ]] && SRC="$_sd/Plugin/unraid"
fi
[[ -z "$SRC" ]] && SRC="/boot/config/plugins/varaverk/Plugin/unraid"
[[ -L "$WEB_DIR" ]] && rm -f "$WEB_DIR"
[[ -d "$WEB_DIR" ]] && rm -rf "$WEB_DIR"
ln -sf "$SRC" "$WEB_DIR"