.gitignore:
Excludes Configurations/host*.conf + master.conf (personal credentials)
and Configurations/*.bak, data/, *.log, *.lock.
Templates remain tracked. Files stay on disk — only untracked from git.
Plugin/varaverk.plg:
Version: 2026.05.28 → 2026.05.30
<CHANGES>: proper changelog entries for both releases covering
wizard, setup flow, Partnership highlights, HOST2 paths,
onboard Step 9, pre-onboard graceful state, GitHub links.
Remove script: stops fallback.sh cleanly (--stop), kills watchdog
orchestrator, removes cron file + calls update_cron, removes web
symlink and plugin flash dir. Preserves appdata with clear message.
224 lines
9.1 KiB
XML
224 lines
9.1 KiB
XML
<?xml version='1.0' standalone='yes'?>
|
|
<!DOCTYPE PLUGIN [
|
|
<!ENTITY name "varaverk">
|
|
<!ENTITY author "gmer4lfe">
|
|
<!ENTITY version "2026.05.30">
|
|
<!ENTITY launch "varaverk/monitor">
|
|
<!ENTITY github "https://github.com/FailedProxy/Varaverk">
|
|
<!ENTITY branch "main">
|
|
<!ENTITY cfgdir "/boot/config/plugins/varaverk">
|
|
<!ENTITY plugdir "/usr/local/emhttp/plugins/varaverk">
|
|
]>
|
|
<PLUGIN name="&name;" author="&author;" version="&version;" launch="&launch;"
|
|
support="https://github.com/FailedProxy/Varaverk/issues"
|
|
icon="/plugins/varaverk/icons/varaverk.png">
|
|
|
|
<CHANGES>
|
|
###2026.05.30
|
|
- First-run setup wizard: auto-detects hostname, creates master.conf + host conf from templates
|
|
- Scheduler setup mode: after wizard, master.conf and host conf open sequentially with forced save flow
|
|
- Partnership tab: Onboard button highlighted on arrival from wizard; disabled until partner is configured
|
|
- HOST2 install paths: state-file pull, master.conf push detection, conf-only flow
|
|
- Onboard Step 9: master.conf automatically pushed to all listed hosts on onboard completion
|
|
- Graceful pre-onboard state: neutral banners instead of error warnings before SSH is configured
|
|
- GitHub link in tab bar and Settings page; Community Apps support URL
|
|
|
|
###2026.05.28
|
|
- Initial release: Monitor, Scheduler, Docker, Watchdog, Partnership, Fallback, Arrs tabs
|
|
- Mutual container fallback with tiered escalation and strike-confirmed handback
|
|
- Partnership lifecycle: onboard, offboard, transfer
|
|
- Rsync profile system with per-share container stops and writeback
|
|
- Watchdog: Tier 1 (explicit) + Tier 2 (global scan) container monitoring
|
|
- master.conf push-on-save to all configured partners via SSH
|
|
</CHANGES>
|
|
|
|
<!--
|
|
── Install / Update ────────────────────────────────────────────────────────────
|
|
Runs on first install and on every plugin update.
|
|
Clones the repo on fresh install; pulls latest on update.
|
|
Array must be started — appdata must be available.
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
-->
|
|
<FILE Name="&cfgdir;/install.sh" Run="/bin/bash" Method="install update">
|
|
<INLINE>
|
|
<![CDATA[
|
|
#!/bin/bash
|
|
PLUGIN="varaverk"
|
|
GITHUB="https://github.com/FailedProxy/Varaverk"
|
|
BRANCH="main"
|
|
CFG_DIR="/boot/config/plugins/$PLUGIN"
|
|
CFG_FILE="$CFG_DIR/varaverk.cfg"
|
|
WEB_DIR="/usr/local/emhttp/plugins/$PLUGIN"
|
|
LOG="$CFG_DIR/install.log"
|
|
|
|
mkdir -p "$CFG_DIR"
|
|
|
|
log() { echo "[$(date '+%H:%M:%S')] $*" | tee -a "$LOG"; }
|
|
|
|
log "=== Varaverk install/update ==="
|
|
|
|
# Unraid only
|
|
if [[ ! -f /etc/unraid-version ]]; then
|
|
log "ERROR: not running on Unraid — aborting"
|
|
exit 1
|
|
fi
|
|
|
|
# Read SCRIPTS_DIR from cfg if present
|
|
if [[ -f "$CFG_FILE" ]]; then
|
|
_sd=$(grep -oP '(?<=SCRIPTS_DIR=")[^"]+' "$CFG_FILE" 2>/dev/null)
|
|
[[ -n "$_sd" ]] && SCRIPTS_DIR="$_sd"
|
|
fi
|
|
SCRIPTS_DIR="${SCRIPTS_DIR:-/mnt/user/appdata/Varaverk}"
|
|
CONF_DIR="$SCRIPTS_DIR/Configurations"
|
|
|
|
# Array must be started — appdata must be available
|
|
if ! df --output=fstype /mnt/user 2>/dev/null | grep -q 'shfs'; then
|
|
log "Array not started — cannot install to appdata"
|
|
log "Start the array then reinstall, or wait for next boot"
|
|
exit 0
|
|
fi
|
|
|
|
# Clone or update repo
|
|
if [[ ! -d "$SCRIPTS_DIR/.git" ]]; then
|
|
log "Cloning $GITHUB ($BRANCH) → $SCRIPTS_DIR"
|
|
if ! git clone --branch "$BRANCH" "$GITHUB" "$SCRIPTS_DIR" >> "$LOG" 2>&1; then
|
|
log "ERROR: git clone failed — check internet access and GitHub URL"
|
|
exit 1
|
|
fi
|
|
log "Clone complete"
|
|
else
|
|
log "Updating repo in $SCRIPTS_DIR"
|
|
git -C "$SCRIPTS_DIR" pull --ff-only origin "$BRANCH" >> "$LOG" 2>&1 \
|
|
&& log "Pull complete" \
|
|
|| log "WARNING: git pull failed — repo may have local modifications"
|
|
fi
|
|
|
|
# Sanity check — Plugin/unraid must exist after clone
|
|
if [[ ! -d "$SCRIPTS_DIR/Plugin/unraid" ]]; then
|
|
log "ERROR: Plugin/unraid not found in cloned repo — unexpected repo structure"
|
|
exit 1
|
|
fi
|
|
|
|
# Symlink web files
|
|
if [[ -L "$WEB_DIR" ]]; then
|
|
rm "$WEB_DIR"
|
|
elif [[ -d "$WEB_DIR" ]]; then
|
|
log "WARNING: $WEB_DIR is a real directory — not replacing (remove manually if needed)"
|
|
fi
|
|
if [[ ! -e "$WEB_DIR" ]]; then
|
|
ln -s "$SCRIPTS_DIR/Plugin/unraid" "$WEB_DIR"
|
|
log "Symlinked: $WEB_DIR → $SCRIPTS_DIR/Plugin/unraid"
|
|
fi
|
|
|
|
# Write varaverk.cfg if not present
|
|
if [[ ! -f "$CFG_FILE" ]]; then
|
|
printf 'SCRIPTS_DIR="%s"\n' "$SCRIPTS_DIR" > "$CFG_FILE"
|
|
log "Created varaverk.cfg (SCRIPTS_DIR=$SCRIPTS_DIR)"
|
|
fi
|
|
|
|
# Create Configurations dir if git clone didn't
|
|
mkdir -p "$CONF_DIR"
|
|
|
|
# Bootstrap master.conf from template on first install
|
|
if [[ ! -f "$CONF_DIR/master.conf" ]]; then
|
|
if [[ -f "$SCRIPTS_DIR/Configurations/master.conf.template" ]]; then
|
|
cp "$SCRIPTS_DIR/Configurations/master.conf.template" "$CONF_DIR/master.conf"
|
|
log "Created master.conf from template — fill in HOST1 and HOST2 to continue"
|
|
else
|
|
log "WARNING: master.conf.template not found — master.conf not created"
|
|
fi
|
|
fi
|
|
|
|
log "Install complete — open Varaverk in Unraid to complete setup"
|
|
log "→ Plugins → Varaverk (or navigate to Settings → Utilities → Varaverk)"
|
|
]]>
|
|
</INLINE>
|
|
</FILE>
|
|
|
|
<!--
|
|
── Boot (every boot) ───────────────────────────────────────────────────────────
|
|
Fast idempotent check — recreates the web symlink if it disappeared.
|
|
No git operations. Safe to run before the array is fully started.
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
-->
|
|
<FILE Name="&cfgdir;/boot.sh" Run="/bin/bash">
|
|
<INLINE>
|
|
<![CDATA[
|
|
#!/bin/bash
|
|
PLUGIN="varaverk"
|
|
CFG_FILE="/boot/config/plugins/$PLUGIN/varaverk.cfg"
|
|
WEB_DIR="/usr/local/emhttp/plugins/$PLUGIN"
|
|
|
|
# Read SCRIPTS_DIR
|
|
if [[ -f "$CFG_FILE" ]]; then
|
|
_sd=$(grep -oP '(?<=SCRIPTS_DIR=")[^"]+' "$CFG_FILE" 2>/dev/null)
|
|
fi
|
|
SCRIPTS_DIR="${_sd:-/mnt/user/appdata/Varaverk}"
|
|
|
|
# Only act if source exists (array started) and symlink is missing
|
|
if [[ -d "$SCRIPTS_DIR/Plugin/unraid" ]] && [[ ! -e "$WEB_DIR" ]]; then
|
|
[[ -L "$WEB_DIR" ]] && rm "$WEB_DIR"
|
|
ln -s "$SCRIPTS_DIR/Plugin/unraid" "$WEB_DIR"
|
|
fi
|
|
]]>
|
|
</INLINE>
|
|
</FILE>
|
|
|
|
<!--
|
|
── Remove ──────────────────────────────────────────────────────────────────────
|
|
Removes the web symlink. Scripts and conf in appdata are left intact.
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
-->
|
|
<FILE Name="&cfgdir;/remove.sh" Run="/bin/bash" Method="remove">
|
|
<INLINE>
|
|
<![CDATA[
|
|
#!/bin/bash
|
|
PLUGIN="varaverk"
|
|
CFG_DIR="/boot/config/plugins/$PLUGIN"
|
|
CFG_FILE="$CFG_DIR/varaverk.cfg"
|
|
CRON_FILE="$CFG_DIR/varaverk.cron"
|
|
WEB_DIR="/usr/local/emhttp/plugins/$PLUGIN"
|
|
|
|
log() { echo "[Varaverk remove] $*"; }
|
|
|
|
# Read SCRIPTS_DIR so we can locate running scripts
|
|
if [[ -f "$CFG_FILE" ]]; then
|
|
_sd=$(grep -oP '(?<=SCRIPTS_DIR=")[^"]+' "$CFG_FILE" 2>/dev/null)
|
|
fi
|
|
SCRIPTS_DIR="${_sd:-/mnt/user/appdata/Varaverk}"
|
|
|
|
# ── Stop continuous background scripts ───────────────────────────────────────
|
|
# fallback.sh manages its own lock — use --stop for clean shutdown
|
|
if [[ -f "$SCRIPTS_DIR/Fallback/fallback.sh" ]]; then
|
|
bash "$SCRIPTS_DIR/Fallback/fallback.sh" --stop 2>/dev/null && \
|
|
log "fallback.sh stopped" || true
|
|
fi
|
|
|
|
# Kill any remaining Varaverk background processes (watchdog orchestrator, etc.)
|
|
pkill -f "run_job.sh" 2>/dev/null || true
|
|
pkill -f "watchdog_orchestrator.sh" 2>/dev/null || true
|
|
|
|
# ── Remove cron entries ───────────────────────────────────────────────────────
|
|
if [[ -f "$CRON_FILE" ]]; then
|
|
rm -f "$CRON_FILE"
|
|
/usr/local/sbin/update_cron 2>/dev/null || true
|
|
log "Cron entries removed"
|
|
fi
|
|
# Remove legacy direct cron file if it exists
|
|
rm -f /etc/cron.d/varaverk
|
|
|
|
# ── Remove web symlink ────────────────────────────────────────────────────────
|
|
[[ -L "$WEB_DIR" ]] && rm -f "$WEB_DIR" && log "Web symlink removed"
|
|
|
|
# ── Remove plugin config from flash ──────────────────────────────────────────
|
|
rm -rf "$CFG_DIR"
|
|
log "Plugin config removed from flash"
|
|
|
|
log "Done. Scripts and conf in $SCRIPTS_DIR are preserved."
|
|
log "To fully remove: delete $SCRIPTS_DIR manually."
|
|
]]>
|
|
</INLINE>
|
|
</FILE>
|
|
|
|
</PLUGIN>
|