dustin
/
jenkinsagent
Archived
1
0
Fork 0

initramfs: sync time with NTP

Using the Busybox NTP client, we can set the system clock in early
userspace.  This will ensure the system clock is correct before
anything, even systemd, is started from the real rootfs.

Obviously, this requires the DHCP server to specify NTP server addresses
in the client lease.
master
Dustin 2022-03-15 14:08:24 -05:00
parent 711a8aa948
commit ca71b88227
2 changed files with 8 additions and 2 deletions

View File

@ -1,7 +1,7 @@
# #
# Automatically generated make config: don't edit # Automatically generated make config: don't edit
# Busybox version: 1.35.0 # Busybox version: 1.35.0
# Tue Mar 8 23:49:30 2022 # Tue Mar 15 14:06:30 2022
# #
CONFIG_HAVE_DOT_CONFIG=y CONFIG_HAVE_DOT_CONFIG=y
@ -928,7 +928,7 @@ CONFIG_FEATURE_IP_ROUTE_DIR="/etc/iproute2"
# CONFIG_NSLOOKUP is not set # CONFIG_NSLOOKUP is not set
# CONFIG_FEATURE_NSLOOKUP_BIG is not set # CONFIG_FEATURE_NSLOOKUP_BIG is not set
# CONFIG_FEATURE_NSLOOKUP_LONG_OPTIONS is not set # CONFIG_FEATURE_NSLOOKUP_LONG_OPTIONS is not set
# CONFIG_NTPD is not set CONFIG_NTPD=y
# CONFIG_FEATURE_NTPD_SERVER is not set # CONFIG_FEATURE_NTPD_SERVER is not set
# CONFIG_FEATURE_NTPD_CONF is not set # CONFIG_FEATURE_NTPD_CONF is not set
# CONFIG_FEATURE_NTP_AUTH is not set # CONFIG_FEATURE_NTP_AUTH is not set

View File

@ -29,5 +29,11 @@ renew|bound)
printf 'nameserver %s\n' "${ns}" >> /etc/resolv.conf printf 'nameserver %s\n' "${ns}" >> /etc/resolv.conf
done done
fi fi
if [ -n "${ntpsrv}" ] && [ -x /usr/sbin/ntpd ]; then
for ts in ${ntpsrv}; do
/usr/sbin/ntpd -n -q -p "${ts}" || continue
break
done
fi
;; ;;
esac esac