#!/bin/sh

macaddr=$(cat /sys/class/net/eth0/address)
macaddr=${macaddr//:/}

# hostname
uci -q get system.@system[0].hostname > /dev/null 2>&1 || exit 1
uci -q set system.@system[0].hostname="OctoWrt${macaddr}"

# log size, protected console
uci -q set system.@system[0].ttylogin='1'
uci -q set system.@system[0].log_size='256'

# ntp servers
uci -q get system.ntp > /dev/null 2>&1 || exit 1

uci -q del system.ntp.server
uci -q add_list system.ntp.server='octogate.online'
uci -q add_list system.ntp.server='171.25.225.71'
uci -q add_list system.ntp.server='0.pool.ntp.org'
uci -q add_list system.ntp.server='1.pool.ntp.org'
uci -q add_list system.ntp.server='2.pool.ntp.org'
uci -q add_list system.ntp.server='3.pool.ntp.org'

exit 0
