1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2006-2015 OpenWrt.org
7 CONFIGFILE=/var/etc/chrony.conf
8 INCLUDEFILE=/etc/chrony/chrony.conf
11 local cfg=$1 sourcetype=$2 hostname minpoll maxpoll iburst
13 hostname=$NTP_SOURCE_HOSTNAME
14 [ -z "$hostname" ] && config_get hostname "$cfg" hostname
15 [ -z "$hostname" ] && return
16 config_get minpoll "$cfg" minpoll
17 config_get maxpoll "$cfg" maxpoll
18 config_get_bool iburst "$cfg" iburst 0
20 echo $sourcetype $hostname
21 [ -n "$minpoll" ] && echo minpoll $minpoll
22 [ -n "$maxpoll" ] && echo maxpoll $maxpoll
23 [ "$iburst" = "1" ] && echo iburst
28 local cfg=$1 iface wan_iface wan6_iface subnet subnets subnets6
30 network_find_wan wan_iface true
31 network_find_wan6 wan6_iface true
32 config_get iface "$cfg" interface
34 if [ "$wan_iface" = "$iface" ]; then
36 elif [ "$wan6_iface" = "$iface" ]; then
39 network_get_subnets subnets $iface || \
40 network_get_subnets subnets6 $iface || continue
41 for subnet in $subnets $subnets6; do
48 local cfg=$1 threshold limit
50 config_get threshold "$cfg" threshold
51 config_get limit "$cfg" limit
52 [ -z "$threshold" -o -z "$limit" ] && return
53 echo makestep $threshold $limit
57 . /lib/functions/network.sh
60 procd_set_param command $PROG -n -f $CONFIGFILE
61 procd_set_param file $CONFIGFILE
62 procd_set_param file $INCLUDEFILE
66 mkdir -p $(dirname $CONFIGFILE)
69 echo include $INCLUDEFILE
70 config_foreach handle_source server server
71 config_foreach handle_source pool pool
72 config_foreach handle_source peer peer
73 config_foreach handle_allow allow
74 config_foreach handle_makestep makestep