Platform adapter: rename System_Essentials, add Plugin/unraid/adapter.sh, wire call sites

- Rename unRAID_Essentials/ → System_Essentials/ (git detects as rename)
- Add Plugin/unraid/adapter.sh: 13 platform_*() functions providing OS-agnostic API
  for storage health, service management, mover, user scripts, notifications,
  disk temps, and platform command validation
- Update load_config.sh: detect PLATFORM (unraid/truenas/unknown), export SCRIPTS_DIR,
  auto-source Plugin/$PLATFORM/adapter.sh after common.sh
- Wire all call sites: replace direct rc.d, pgrep/pkill, var.ini, dynamix.cfg,
  disks.ini, and validate_unraid_cmd calls with platform_*() functions across
  watchdogs, orchestrators, and System_Essentials scripts
- Update all documentation: rename refs, update webgui escalation logic,
  add platform adapter section to Plugin README, update main README with
  portability vision and corrected self-healing stack description
This commit is contained in:
Gmer4Lfe
2026-06-04 18:14:34 -04:00
parent de50a01ab2
commit 369a9e6c19
73 changed files with 522 additions and 228 deletions
+37 -1
View File
@@ -33,7 +33,8 @@ no separate monitoring stack, no third-party dashboards.
Plugin/
├── dev_install.sh # One-time developer setup: symlinks plugin into web server
├── Icons/ # Source icon assets (1024px master files)
└── unraid/ # The Unraid plugin application
└── unraid/ # The Unraid platform adapter + plugin application
├── adapter.sh # Platform adapter — provides platform_*() API to all scripts
├── Varaverk.page # Main plugin entry point (Tasks menu)
├── VaraverkSettings.page # Unraid Settings → Other Settings entry
├── api/ # PHP API endpoints (called by JS via fetch)
@@ -45,6 +46,10 @@ Plugin/
├── js/ # Frontend JavaScript
├── pages/ # Per-tab page includes (monitor, scheduler, docker, ...)
└── run_job.sh # Script runner invoked by the Scheduler
# Future platform adapters follow the same structure:
# Plugin/truenas/adapter.sh — TrueNAS adapter (future)
# Plugin/ubuntu/adapter.sh — Ubuntu/Debian adapter (future)
```
---
@@ -74,6 +79,37 @@ so behaviour stays consistent without a shell dependency.
---
## ━━━ THE PLATFORM ADAPTER ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
`Plugin/unraid/adapter.sh` is the Unraid platform adapter. It is sourced automatically
by `load_config.sh` whenever `PLATFORM=unraid` is detected (via `/etc/unraid-version`).
Every bash script in the ecosystem calls `platform_*()` functions instead of OS-specific
commands directly. The adapter translates those calls into Unraid-specific implementations.
```
platform_storage_healthy # is the array up and shfs mounted?
platform_is_maintenance_running # parity check or sync in progress?
platform_is_service_running # is a named service process alive?
platform_restart_service # restart via rc.d (Unraid) or systemctl (future)
platform_stop_service # stop a named service
platform_is_mover_running # Unraid mover active?
platform_get_mover_pid # PID of the mover process
platform_stop_user_scripts # kill Unraid user.scripts background jobs
platform_send_os_notification # dynamix notify (Unraid) or equivalent
platform_get_disk_states # reads disks.ini (Unraid) or equivalent
platform_get_temp_thresholds # reads dynamix.cfg (Unraid) or equivalent
platform_is_service_enabled # docker.cfg / domain.cfg enabled check
platform_require_cmd # verify a platform command exists
```
**Adding a new platform:** Create `Plugin/<platform>/adapter.sh` implementing the same
function names. `load_config.sh` detects the OS at runtime and sources the correct adapter.
No other files need changing.
---
## ━━━ UNRAID INTEGRATION POINTS ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
| File | Where it appears in Unraid |