Merge pull request #185 from ijc25/ntp-against-host

Point chronyd at gateway when ntp=gateway is given on the kernel cmdl…
This commit is contained in:
Justin Cormack 2016-06-08 13:36:22 +01:00
commit 087189b0f9
5 changed files with 22 additions and 6 deletions

View File

@ -50,7 +50,6 @@ COPY packages/diagnostics/diagnostics /usr/bin/
COPY packages/diagnostics/diagnostics-server /usr/bin/
COPY packages/diagnostics/etc /etc/
COPY packages/automount/etc /etc/
COPY packages/ntp15m/etc /etc/
COPY packages/binfmt_misc/etc /etc/
COPY packages/dnsfix/etc /etc/
COPY packages/hostsettings/etc /etc/
@ -84,7 +83,6 @@ RUN \
rc-update add networking boot && \
rc-update add acpid default && \
rc-update add chronyd default && \
rc-update add crond default && \
rc-update add savecache shutdown && \
rc-update add killprocs shutdown && \
rc-update add mount-ro shutdown && \

View File

@ -0,0 +1,6 @@
# default config
server pool.ntp.org iburst minpoll 2
makestep 0.5 -1
keyfile /etc/chrony/chrony.keys
driftfile /var/lib/chrony/chrony.drift

View File

@ -0,0 +1,16 @@
#!/bin/sh
if [ "x$interface" != "xeth0" ] ; then exit 0 ; fi
if cat /proc/cmdline | grep -q '\bntp=gateway\b' ; then
server=$(ip -4 route list type unicast dev eth0 exact 0/0 | awk '/^default/ { print $3 }')
server="$server trust"
else
# TODO: consult $router
exit 0
fi
sed -i -e "s/^server [^ ]\+/server $server/g" /etc/chrony/chrony.conf
logger -t udhcpc "Restarting chronyd with server $server"
service -q chronyd conditionalrestart

View File

@ -3,7 +3,6 @@
depend()
{
after transfused
before chronyd
}
start()

View File

@ -1,3 +0,0 @@
#!/bin/sh
ntpd -n -q -p pool.ntp.org