#!/bin/sh
[ -n "$IPKG_INSTROOT" ] || {
	uci -q delete firewall.logrus_killswitch
	uci -q delete firewall.logrus_fwd
	uci -q delete firewall.logrus_zone
	uci -q commit firewall
	uci -q delete network.logrus
	uci -q commit network

	/etc/init.d/firewall reload >/dev/null 2>&1

	# Hand the routing table back to netifd. The client owns the default
	# route while the tunnel is up and does not always put it back — a
	# crash leaves the router with no way out — so re-running the wan
	# interface is what makes removal actually restore the box rather
	# than merely delete files.
	ifup wan >/dev/null 2>&1 || /etc/init.d/network reload >/dev/null 2>&1

	rm -f /tmp/dnsmasq.d/logrus.conf
	/etc/init.d/dnsmasq restart >/dev/null 2>&1
}
exit 0
