MUA: Echte Unraid-Plugin-Struktur

- plugin/mua.plg: <!DOCTYPE PLUGIN> XML mit <FILE Run> + <INLINE>
- plugin/plugin.json: Metadaten
- scripts/rc.mua: SysVinit-Service (statt systemd)
- scripts/plugin.php: WebGUI-Tab (Settings > MUA)
- README.md: Aktualisiert
- Alte Dateien entfernt (MUA.plg, mua.service, install/update/remove.sh)
This commit is contained in:
Mikei386
2026-08-18 06:36:57 +02:00
parent f4e66ea5a1
commit 1f1e67a3ab
10 changed files with 443 additions and 338 deletions
+147
View File
@@ -0,0 +1,147 @@
<?xml version='1.0' standalone='yes'?>
<!DOCTYPE PLUGIN>
<PLUGIN
name="mua"
author="Michael"
version="1.0.0"
pluginURL="http://192.168.1.2:4000/michael/MUA-Mikes-Unraid-Agent/raw/branch/main/plugin/mua.plg"
launch="Settings/MUA"
support="http://192.168.1.2:4000/michael/MUA-Mikes-Unraid-Agent"
min="7.0.0"
>
<CHANGES>
<![CDATA[
###1.0.0###
Initial release: 21 Docker, network, and system tools as MCP server over HTTP (Streamable HTTP, port 3002).
]]>
</CHANGES>
<!--
Install script.
Klon das Git-Repo und installiert alle Dateien.
-->
<FILE Run="/bin/bash">
<INLINE>
set -e
PLUGIN_DIR="/usr/local/emhttp/plugins/mua"
CONFIG_DIR="/boot/config/plugins/mua"
GIT_REPO="git@192.168.1.2:33/michael/MUA-Mikes-Unraid-Agent.git"
TMP_DIR="/tmp/mua-install-$$"
echo ""
echo "===================================================="
echo " MUA - Mikes Unraid Agent"
echo " Installation"
echo "===================================================="
echo ""
# 1. Verzeichnisse
mkdir -p "$PLUGIN_DIR/mcp"
mkdir -p "$PLUGIN_DIR/scripts"
mkdir -p "$CONFIG_DIR"
# 2. Git-Repo klonen
echo " Kloniere Repo..."
git clone --depth 1 "$GIT_REPO" "$TMP_DIR" 2>&1 | sed 's/^/ /'
# 3. PHP-Dateien installieren
echo " Installiere MCP-Server..."
cp "$TMP_DIR/mcp/server.php" "$PLUGIN_DIR/mcp/"
cp "$TMP_DIR/mcp/helpers.php" "$PLUGIN_DIR/mcp/"
cp "$TMP_DIR/mcp/tools.php" "$PLUGIN_DIR/mcp/"
cp "$TMP_DIR/mcp/selftest.php" "$PLUGIN_DIR/mcp/"
chmod 644 "$PLUGIN_DIR/mcp/"*.php
# 4. PHP-Helper (Write-Operationen)
echo " Installiere PHP-Helper..."
cp "$TMP_DIR/scripts/unraid-docker-mcp-helper.php" /usr/local/bin/
chmod 755 /usr/local/bin/unraid-docker-mcp-helper.php
# 5. WebGUI-Tab
echo " Installiere WebGUI-Tab..."
cp "$TMP_DIR/scripts/plugin.php" "$PLUGIN_DIR/plugin.php"
chmod 644 "$PLUGIN_DIR/plugin.php"
# 6. SysVinit-Service
echo " Installiere Service..."
cp "$TMP_DIR/scripts/rc.mua" /etc/rc.d/rc.mua
chmod 755 /etc/rc.d/rc.mua
# 7. Log-Verzeichnis
mkdir -p /var/log/plugins
touch /var/log/plugins/mua.log
# 8. Selftest
echo " Führe Selftest aus..."
php "$PLUGIN_DIR/mcp/selftest.php" 2>&1 | sed 's/^/ /'
# 9. Service starten
echo " Starte MCP-Server..."
/etc/rc.d/rc.mua start
# 10. Health-Check
sleep 2
if curl -sf "http://127.0.0.1:3002/health" > /dev/null 2>&1; then
echo ""
echo " Health-Check: OK"
echo ""
echo "===================================================="
echo " MUA installiert und läuft auf Port 3002"
echo " Endpunkt: http://$(hostname -I | awk '{print $1}'):3002/mcp"
echo " WebGUI: Settings > MUA"
echo "===================================================="
else
echo ""
echo " WARNUNG: Health-Check fehlgeschlagen"
echo " Logs: tail -f /var/log/plugins/mua.log"
echo "===================================================="
fi
# 11. Cleanup
rm -rf "$TMP_DIR"
</INLINE>
</FILE>
<!--
Remove script.
-->
<FILE Run="/bin/bash" Method="remove">
<INLINE>
echo ""
echo "===================================================="
echo " MUA - Mikes Unraid Agent"
echo " Deinstallation"
echo "===================================================="
echo ""
# 1. Service stoppen
/etc/rc.d/rc.mua stop 2>/dev/null || true
# 2. Service-Datei entfernen
rm -f /etc/rc.d/rc.mua
# 3. PHP-Helper entfernen
rm -f /usr/local/bin/unraid-docker-mcp-helper.php
# 4. Plugin-Verzeichnis entfernen
rm -rf /usr/local/emhttp/plugins/mua
# 5. Config entfernen
rm -rf /boot/config/plugins/mua
# 6. Logs entfernen
rm -f /var/log/plugins/mua.log
rm -f /var/run/mua.pid
echo ""
echo " MUA wurde deinstalliert."
echo "===================================================="
</INLINE>
</FILE>
</PLUGIN>