#!/bin/sh
#
# Copyright (C) 2015 devolo AG
#

# if basic NTP configuration was already applied, exit
[ "$(uci -q get delos.uci_defaults.ntp)" = "" ] || exit 0

if [ -f /lib/ar71xx.sh ]; then
        PLATFORM=ar71xx
        . /lib/ar71xx.sh
elif [ -f /lib/ipq806x.sh ]; then
        PLATFORM=ipq806x
        . /lib/ipq806x.sh
fi

. /lib/functions.sh

board=$(${PLATFORM}_board_name)

case "$board" in
dlan*|dvl-*|ew7479cap|ap-dk07.1-c1)
	uci delete system.ntp.server
	uci add_list system.ntp.server='europe.pool.ntp.org'
	uci commit system

	# set basic NTP config done flag
	uci set delos.uci_defaults.ntp=1
	uci commit delos
	;;
esac

exit 0