coreos-base/oem-azure: Add chrony to sysext

Along with configuration, tmpfiles setup and service dependencies. The
files are added through normal ebuild mechanisms. The config file is
based on what Ubuntu ships on Azure.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
This commit is contained in:
Jeremi Piotrowski 2024-03-25 13:18:13 +00:00
parent 3c0283f74a
commit 9d065d1cf5
5 changed files with 84 additions and 2 deletions

View File

@ -0,0 +1,65 @@
# CLOUD_IMG: This file was created/modified by the Cloud Image build process
# Welcome to the chrony configuration file. See chrony.conf(5) for more
# information about usable directives.
# Include configuration files found in /etc/chrony/conf.d.
confdir /etc/chrony/conf.d
# This will use (up to):
# - 2 sources from 2.ubuntu.pool.ntp.org which is ipv6 enabled as well
# - 1 source from [013].ubuntu.pool.ntp.org each (ipv4 only atm)
# This means by default, up to 2 dual-stack and up to 3 additional IPv4-only
# sources will be used.
# At the same time it retains some protection against one of the entries being
# down (compare to just using one of the lines).
#
# See http://www.pool.ntp.org/join.html for more information.
#pool 0.flatcar.pool.ntp.org iburst maxsources 1
#pool 1.flatcar.pool.ntp.org iburst maxsources 1
#pool 2.flatcar.pool.ntp.org iburst maxsources 2
#pool 3.flatcar.pool.ntp.org iburst maxsources 1
# Use time sources from DHCP.
sourcedir /run/chrony-dhcp
# Use NTP sources found in /etc/chrony/sources.d.
sourcedir /etc/chrony/sources.d
# This directive specify the location of the file containing ID/key pairs for
# NTP authentication.
#keyfile /etc/chrony/chrony.keys
# This directive specify the file into which chronyd will store the rate
# information.
driftfile /var/lib/chrony/chrony.drift
# Save NTS keys and cookies.
ntsdumpdir /var/lib/chrony
# Uncomment the following line to turn logging on.
#log tracking measurements statistics
# Log files location.
#logdir /var/log/chrony
# Stop bad estimates upsetting machine clock.
maxupdateskew 100.0
# This directive enables kernel synchronisation (every 11 minutes) of the
# real-time clock. Note that it can't be used along with the 'rtcfile' directive.
rtcsync
# Step the system clock instead of slewing it if the adjustment is larger than
# one second, but only in the first three clock updates.
makestep 1.0 -1
# Get TAI-UTC offset and leap seconds from the system tz database.
# This directive must be commented out when using time sources serving
# leap-smeared time.
leapsectz right/UTC
# Azure hosts are synchronized to internal Microsoft time servers
# that take their time from Microsoft-owned Stratum 1 devices.
# The Hyper-V drivers surface this time source as a PTP-based
# time source in the guest. This configures chrony to use it.
refclock PHC /dev/ptp_hyperv poll 3 dpoll -2 offset 0 stratum 2

View File

@ -0,0 +1,3 @@
d /etc/chrony 0755 root root - -
d /etc/chrony/conf.d 0755 root root - -
L /etc/chrony/chrony.conf - - - - ../../usr/share/oem-azure/chrony.conf

View File

@ -18,5 +18,5 @@ ln -sf /usr/bin/true "${rootfs}/usr/bin/eject"
# At runtime we need the agent to write systemd.service to /etc but during # At runtime we need the agent to write systemd.service to /etc but during
# package creation it needs to be /usr/lib. waagent uses the same function in # package creation it needs to be /usr/lib. waagent uses the same function in
# both cases, so mangle manually. # both cases, so mangle manually.
mkdir -p "${rootfs}"/usr/lib/systemd mkdir -p "${rootfs}"/usr/lib/systemd/system
mv "${rootfs}"/{etc,usr/lib}/systemd/system cp -a "${rootfs}"/{etc,usr/lib}/systemd/system/.

View File

@ -0,0 +1 @@
d /var/lib/chrony 0770 ntp ntp - -

View File

@ -3,6 +3,8 @@
EAPI=8 EAPI=8
inherit systemd tmpfiles
DESCRIPTION="OEM suite for Azure" DESCRIPTION="OEM suite for Azure"
HOMEPAGE="https://azure.microsoft.com/" HOMEPAGE="https://azure.microsoft.com/"
SRC_URI="" SRC_URI=""
@ -14,7 +16,18 @@ IUSE=""
RDEPEND=" RDEPEND="
~app-emulation/wa-linux-agent-${PV} ~app-emulation/wa-linux-agent-${PV}
net-misc/chrony
" "
# for coreos-base/common-oem-files # for coreos-base/common-oem-files
OEM_NAME="Microsoft Azure" OEM_NAME="Microsoft Azure"
S="${WORKDIR}"
src_install() {
systemd_enable_service multi-user.target chronyd.service
dotmpfiles "${FILESDIR}"/var-chrony.conf
dotmpfiles "${FILESDIR}"/etc-chrony.conf
insinto /usr/share/${PN}
doins "${FILESDIR}"/chrony.conf
}