#!/bin/bash # PVE Trunks Plugin - Installer # Adds "Trunks" field to VM Network Device editor in Proxmox VE UI # # Usage: bash install.sh set -e PLUGIN_JS="pve-trunks-plugin.js" PVE_JS_DIR="/usr/share/pve-manager/js" INDEX_TPL="/usr/share/pve-manager/index.html.tpl" SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" SCRIPT_TAG='' # Check running as root if [ "$(id -u)" -ne 0 ]; then echo "Error: run as root" exit 1 fi # Check Proxmox if [ ! -d "$PVE_JS_DIR" ]; then echo "Error: Proxmox VE not found ($PVE_JS_DIR missing)" exit 1 fi # Copy plugin JS cp "$SCRIPT_DIR/$PLUGIN_JS" "$PVE_JS_DIR/$PLUGIN_JS" echo "Installed $PVE_JS_DIR/$PLUGIN_JS" # Patch index template if not already patched if ! grep -q "pve-trunks-plugin" "$INDEX_TPL"; then # Insert before closing sed -i "s||${SCRIPT_TAG}\n|" "$INDEX_TPL" echo "Patched $INDEX_TPL" else echo "Index template already patched, skipping" fi # Restart web UI systemctl restart pveproxy echo "Done. Reload the Proxmox web UI (Ctrl+Shift+R)."