#!/bin/sh

uci_write_config() {
	uci -q batch <<-EOF >/dev/null
		set oled.@oled[0].showmenu="1"
		set oled.@oled[0].enable="1"
		set oled.@oled[0].path="$1"
		set oled.@oled[0].rotate="$2"
		set oled.@oled[0].netspeed="$3"
		set oled.@oled[0].netsource="$4"
		commit oled
EOF
}

. /lib/functions/system.sh

case "$(board_name)" in
hinlink,opc-h69k)
	uci_write_config '/dev/i2c-5' 1 1 eth0
	;;
esac

sed -e "/\/etc\/init\.d\/oled/d" -i /etc/crontabs/root && /etc/init.d/cron reload
rm -rf /tmp/luci-*
exit 0
