Files
Varaverk/Plugin/dev_install.sh
T
Gmer4Lfe fb051b60c1 Varaverk: FallBack + Watchdog tabs; plugin path restructure to Plugin/unraid/
- FallBack tab: per-node tier inventory + active fallback card with duration, tier, handback strikes, running container status
- Watchdog tab: live system health (RAM bar + thresholds, load, uptime, daemon), docker watchdog strikes + skip list + restart history, stability strikes + reboot log, resource pressure alert card, config inventory (mem limits, required, pause/stop lists)
- Swapped partnership/arrs tab order; FallBack between partnership and watchdog
- Plugin source tree moved from Plugin/usr/local/emhttp/plugins/varaverk/ to Plugin/unraid/
- Deployment/ conf templates added
2026-05-28 22:24:50 -04:00

72 lines
2.5 KiB
Bash
Executable File

#!/bin/bash
# dev_install.sh — symlinks the OS-appropriate plugin into the web server for local development.
# Run once after cloning. Re-run if the repo is moved.
# Safe to re-run: removes stale symlink before recreating.
#
# Plugin layout:
# Plugin/unraid/ ← Unraid plugin (PHP, served by emhttp at /usr/local/emhttp/plugins/)
# Plugin/debian/ ← future
# Plugin/<os>/ ← future
#
# Adding a new OS:
# 1. Create Plugin/<os>/ with the OS-appropriate web app files
# 2. Add detection + TARGET path below
set -euo pipefail
PLUGIN_NAME="varaverk"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# ── Detect OS ────────────────────────────────────────────────────────────────
detect_os() {
if [[ -f /etc/unraid-version ]]; then echo "unraid"
elif [[ -f /etc/debian_version ]]; then echo "debian"
elif [[ -f /etc/arch-release ]]; then echo "arch"
else echo "unknown"; fi
}
OS="${1:-$(detect_os)}" # accept override: ./dev_install.sh unraid
# ── OS-specific install target ────────────────────────────────────────────────
case "$OS" in
unraid)
SOURCE="$SCRIPT_DIR/unraid"
TARGET="/usr/local/emhttp/plugins/$PLUGIN_NAME"
;;
debian|arch)
echo "OS '$OS' detected but plugin target path not yet defined."
echo "Add the TARGET= line for this OS in dev_install.sh."
exit 1
;;
unknown|*)
echo "Unsupported OS — could not detect from /etc/*-version markers."
echo "Usage: $0 <os> (e.g. $0 unraid)"
exit 1
;;
esac
# ── Install ───────────────────────────────────────────────────────────────────
if [[ ! -d "$SOURCE" ]]; then
echo "ERROR: Plugin source not found: $SOURCE"
exit 1
fi
if [[ -L "$TARGET" ]]; then
echo "Removing existing symlink: $TARGET"
rm "$TARGET"
elif [[ -d "$TARGET" ]]; then
echo "ERROR: $TARGET exists as a real directory — remove it manually first."
exit 1
fi
ln -s "$SOURCE" "$TARGET"
echo ""
echo "OS: $OS"
echo "Source: $SOURCE"
echo "Target: $TARGET"
echo ""
echo "Plugin linked. Changes in Plugin/$OS/ take effect immediately."