mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-27 12:38:11 +00:00
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:
commit
087189b0f9
@ -50,7 +50,6 @@ COPY packages/diagnostics/diagnostics /usr/bin/
|
|||||||
COPY packages/diagnostics/diagnostics-server /usr/bin/
|
COPY packages/diagnostics/diagnostics-server /usr/bin/
|
||||||
COPY packages/diagnostics/etc /etc/
|
COPY packages/diagnostics/etc /etc/
|
||||||
COPY packages/automount/etc /etc/
|
COPY packages/automount/etc /etc/
|
||||||
COPY packages/ntp15m/etc /etc/
|
|
||||||
COPY packages/binfmt_misc/etc /etc/
|
COPY packages/binfmt_misc/etc /etc/
|
||||||
COPY packages/dnsfix/etc /etc/
|
COPY packages/dnsfix/etc /etc/
|
||||||
COPY packages/hostsettings/etc /etc/
|
COPY packages/hostsettings/etc /etc/
|
||||||
@ -84,7 +83,6 @@ RUN \
|
|||||||
rc-update add networking boot && \
|
rc-update add networking boot && \
|
||||||
rc-update add acpid default && \
|
rc-update add acpid default && \
|
||||||
rc-update add chronyd default && \
|
rc-update add chronyd default && \
|
||||||
rc-update add crond default && \
|
|
||||||
rc-update add savecache shutdown && \
|
rc-update add savecache shutdown && \
|
||||||
rc-update add killprocs shutdown && \
|
rc-update add killprocs shutdown && \
|
||||||
rc-update add mount-ro shutdown && \
|
rc-update add mount-ro shutdown && \
|
||||||
|
6
alpine/packages/chronyd/etc/chrony/chrony.conf
Normal file
6
alpine/packages/chronyd/etc/chrony/chrony.conf
Normal 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
|
16
alpine/packages/chronyd/etc/udhcpc/post-bound/chronyd
Executable file
16
alpine/packages/chronyd/etc/udhcpc/post-bound/chronyd
Executable 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
|
@ -3,7 +3,6 @@
|
|||||||
depend()
|
depend()
|
||||||
{
|
{
|
||||||
after transfused
|
after transfused
|
||||||
before chronyd
|
|
||||||
}
|
}
|
||||||
|
|
||||||
start()
|
start()
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
ntpd -n -q -p pool.ntp.org
|
|
Loading…
Reference in New Issue
Block a user