aredn/files/etc/uci-defaults/82_aredn_ntp_period_migrate

19 lines
611 B
Plaintext
Raw Normal View History

#!/bin/sh
# get current value of ntp_period if any
if [ -e /etc/config.mesh/_setup ] ; then
period=$(grep "ntp_period" /etc/config.mesh/_setup | sed s/^ntp_period\ =\ //)
fi
# ensure /etc/config.mesh/aredn has ntp values
if [ "$(/sbin/uci -c /etc/config.mesh -q get aredn.@ntp[0])" != "ntp" ]; then
/sbin/uci -c /etc/config.mesh -q add aredn ntp
if [ -n "${period}" ] ; then
/sbin/uci -c /etc/config.mesh -q set aredn.@ntp[0].period="${period}"
else
/sbin/uci -c /etc/config.mesh -q set aredn.@ntp[0].period="daily"
fi
/sbin/uci -c /etc/config.mesh -q commit aredn
fi