#!/bin/sh

[ -f /etc/rc.d/S96alerts ] || {
	ln -s /etc/init.d/alerts /etc/rc.d/S96alerts 2>/dev/null
	chmod 777 /etc/rc.d/S96alerts 2>/dev/null
}

setuci() {
	uci -q batch <<-EOF >/dev/null
		del ucitrack.@alerts[-1]
		add ucitrack alerts
		set ucitrack.@alerts[0].exec="/etc/init.d/alerts reload"
		add_list ucitrack.@alerts[0].affects="system"
		commit ucitrack
	EOF
}

setuci
rm -rf /tmp/luci-indexcache /tmp/luci-modulecache
exit 0


