33 lines
898 B
Bash
Executable File
33 lines
898 B
Bash
Executable File
#!/bin/bash
|
|
# PVE Trunks Plugin - Uninstaller
|
|
|
|
set -euo pipefail
|
|
|
|
PVE_JS_DIR="/usr/share/pve-manager/js"
|
|
INDEX_TPL="/usr/share/pve-manager/index.html.tpl"
|
|
PLUGIN_JS="pve-trunks-plugin.js"
|
|
STORE_DIR="/usr/local/share/pve-trunks-plugin"
|
|
REAPPLY="/usr/local/sbin/pve-trunks-reapply.sh"
|
|
APT_HOOK="/etc/apt/apt.conf.d/99-pve-trunks-plugin"
|
|
|
|
if [ "$(id -u)" -ne 0 ]; then
|
|
echo "Error: run as root" >&2
|
|
exit 1
|
|
fi
|
|
|
|
# Remove reapply machinery first, so it can't restore the plugin afterwards.
|
|
rm -f "$APT_HOOK" "$REAPPLY"
|
|
rm -rf "$STORE_DIR"
|
|
|
|
# Remove the plugin JS.
|
|
rm -f "$PVE_JS_DIR/$PLUGIN_JS"
|
|
|
|
# Remove the <script> tag line(s) from the index template.
|
|
if grep -q "pve-trunks-plugin" "$INDEX_TPL"; then
|
|
cp -a "$INDEX_TPL" "$INDEX_TPL.pve-trunks-bak"
|
|
sed -i '/pve-trunks-plugin/d' "$INDEX_TPL"
|
|
fi
|
|
|
|
systemctl try-restart pveproxy
|
|
echo "Removed. Reload the Proxmox web UI (Ctrl+Shift+R)."
|