install.sh: auto-download from backend, InstallGuide component for frontend dialogs

This commit is contained in:
cynfo3000
2026-03-03 23:13:32 +01:00
parent 7f9fbd257f
commit 5f37e28046
4 changed files with 258 additions and 186 deletions
+30 -10
View File
@@ -2,12 +2,13 @@
#
# RMM Agent Plugin Installer fuer OPNsense
#
# Usage:
# scp install.sh rmm-agent root@opnsense:/tmp/
# ssh root@opnsense '/bin/sh /tmp/install.sh'
# Usage (automatischer Download):
# fetch -o /tmp/install.sh "https://git.cynfo.net/christian/rmm/raw/branch/main/opnsense-plugin/install.sh"
# sh /tmp/install.sh
#
# Oder remote:
# cat install.sh | ssh root@opnsense '/bin/sh'
# Oder mit lokalen Binaries:
# scp install.sh rmm-agent rmm-updater-freebsd root@opnsense:/tmp/
# ssh root@opnsense '/bin/sh /tmp/install.sh'
#
set -e
@@ -15,17 +16,36 @@ set -e
BASEDIR="/tmp"
BINARY="${BASEDIR}/rmm-agent"
UPDATER_BINARY="${BASEDIR}/rmm-updater"
BACKEND_URL="https://192.168.85.13:8443"
API_KEY="01532e5a7c9e70bf2757df77a2f5b9b9"
echo "========================================"
echo " RMM Agent Plugin Installer"
echo "========================================"
# Pruefen ob Binary vorhanden
# Binaries herunterladen wenn nicht lokal vorhanden
if [ ! -f "${BINARY}" ]; then
echo "FEHLER: ${BINARY} nicht gefunden."
echo "Bitte vorher das Binary kopieren:"
echo " scp rmm-agent root@opnsense:/tmp/"
exit 1
echo "[*] Binaries nicht lokal gefunden — lade vom Backend..."
/usr/local/bin/fetch --no-verify-peer -o "${BASEDIR}/rmm-bundle.zip" \
"${BACKEND_URL}/api/v1/firmware/download?platform=freebsd&api_key=${API_KEY}"
if [ ! -f "${BASEDIR}/rmm-bundle.zip" ]; then
echo "FEHLER: Download fehlgeschlagen."
echo "Pruefe Backend-Erreichbarkeit: ${BACKEND_URL}"
exit 1
fi
cd "${BASEDIR}"
unzip -o rmm-bundle.zip 2>/dev/null || true
# ZIP enthaelt rmm-agent und rmm-updater-freebsd
if [ -f "${BASEDIR}/rmm-updater-freebsd" ] && [ ! -f "${UPDATER_BINARY}" ]; then
mv "${BASEDIR}/rmm-updater-freebsd" "${UPDATER_BINARY}"
fi
rm -f rmm-bundle.zip
echo " Download OK"
if [ ! -f "${BINARY}" ]; then
echo "FEHLER: ${BINARY} nach Download nicht vorhanden."
echo "Firmware-ZIP muss 'rmm-agent' enthalten."
exit 1
fi
fi
# Alten Agent stoppen falls vorhanden