]> &netbirdURL; &netbirdSHA256; &pkgURL; &pkgSHA256; &version;&netbirdFile;> /boot/config/plugins/netbird/.gitignore echo "etc/.cache" >> /boot/config/plugins/netbird/.gitignore # Add wt0 to Unraid's nginx include list so the WebGUI binds to the NetBird IP. NEC=/boot/config/network-extra.cfg if [ -f "$NEC" ] && grep -q '^include_interfaces=' "$NEC" ; then if ! grep -q 'wt0' "$NEC" ; then sed -i 's/^include_interfaces="\(.*\)"/include_interfaces="\1 wt0"/' "$NEC" sed -i 's/include_interfaces=" /include_interfaces="/' "$NEC" echo " added wt0 to existing include_interfaces in $NEC" fi else cat > "$NEC" </dev/null 2>&1; then /etc/rc.d/rc.nginx reload >/dev/null 2>&1 exit 0 fi sleep 2 done ) >/dev/null 2>&1 /dev/null || true # Clean up older versions on flash rm -f $(ls /boot/config/plugins/netbird/unraid-netbird-utils-*.txz 2>/dev/null | grep -v ']]>&version;/dev/null | grep -v ']]>&netbirdFile;/dev/null | grep -q . ; then echo "******************************" echo "* WARNING *" echo "******************************" echo "" echo "The NetBird state directory has been backed up to Unraid Connect via Flash backup." echo "" echo "To remove this backup:" echo " 1. Settings -> Management Access" echo " 2. Under Unraid Connect, deactivate flash backup (delete cloud copy)" echo " 3. Reactivate flash backup" /usr/local/emhttp/webGui/scripts/notify -l '/Settings/ManagementAccess' -i 'alert' -e 'NetBird State' -s 'NetBird state backed up to Unraid Connect.' -d 'The NetBird state directory has been backed up to Unraid Connect. This is a potential security risk. From the Management Settings page, deactivate flash backup and delete cloud backups, then reactivate flash backup.' fi fi echo "" echo "----------------------------------------------------" echo " NetBird ]]>&netbirdVer;&version; /dev/null /usr/local/sbin/netbird down >/dev/null 2>&1 pkill -f '/usr/local/sbin/netbird service run' 2>/dev/null sleep 1 pkill -9 -f '/usr/local/sbin/netbird service run' 2>/dev/null rm -f /var/run/netbird.sock /var/run/netbird.pid # Tear down the WireGuard interface if it's still up ip link delete wt0 2>/dev/null # Remove binary (default path plus any stray copy still on PATH) rm -f /usr/local/sbin/netbird for b in $(command -v netbird 2>/dev/null); do rm -f "$b"; done hash -r 2>/dev/null # Remove plugin package removepkg unraid-netbird-utils 2>/dev/null # Drop persistence symlinks (leaves /boot/config/plugins/netbird intact so # the user can reinstall without losing their NetBird identity) rm -f /etc/netbird rm -f /var/lib/netbird # Strip wt0 from Unraid's nginx include list and reload nginx so it stops # trying to bind to the (now-gone) NetBird interface. NEC=/boot/config/network-extra.cfg if [ -f "$NEC" ] && grep -q 'wt0' "$NEC" ; then sed -i 's/include_interfaces="\([^"]*\)wt0\([^"]*\)"/include_interfaces="\1\2"/' "$NEC" sed -i 's/include_interfaces="[[:space:]]*/include_interfaces="/' "$NEC" sed -i 's/[[:space:]]*"/"/' "$NEC" fi ( sleep 5 ; /etc/rc.d/rc.nginx reload >/dev/null 2>&1 ) >/dev/null 2>&1 /dev/null || true # Remove pages rm -rf /usr/local/emhttp/plugins/netbird # Tarball / package caches on flash rm -f /boot/config/plugins/netbird/*.tar.gz rm -f /boot/config/plugins/netbird/*.txz echo "" echo "----------------------------------------------------" echo " NetBird plugin removed." echo " Configuration preserved at /boot/config/plugins/netbird/" echo " (delete that directory by hand to fully purge.)" echo "----------------------------------------------------" echo "" ]]>