#!/bin/sh
[ -n "$IPKG_INSTROOT" ] || {
	mkdir -p /etc/logrus
	chmod 0700 /etc/logrus

	# 90 wires the fw4 zone, 91 puts the killswitch on top of it, 99 logs
	# in and starts the service. Each is removed once it has run, which is
	# what makes them one-shot; a failure leaves the script in place so the
	# next boot retries it.
	for d in 90-logrus-firewall 91-logrus-killswitch 99-logrus; do
		[ -f "/etc/uci-defaults/$d" ] || continue
		( . "/etc/uci-defaults/$d" ) && rm -f "/etc/uci-defaults/$d"
	done

	/etc/init.d/logrus enable 2>/dev/null
}
exit 0
