Skip to content

Commit 2257d54

Browse files
johannbgharaldh
authored andcommitted
feat(systemd-timesyncd): introducing the systemd-timesyncd module
Introducing the systemd-timesyncd module
1 parent 49b6149 commit 2257d54

File tree

3 files changed

+66
-0
lines changed

3 files changed

+66
-0
lines changed

dracut.spec

+1
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/
329329
%{dracutlibdir}/modules.d/01systemd-repart
330330
%{dracutlibdir}/modules.d/01systemd-sysctl
331331
%{dracutlibdir}/modules.d/01systemd-sysusers
332+
%{dracutlibdir}/modules.d/01systemd-timesyncd
332333
%{dracutlibdir}/modules.d/03modsign
333334
%{dracutlibdir}/modules.d/03rescue
334335
%{dracutlibdir}/modules.d/04watchdog
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/bin/bash
2+
# This file is part of dracut.
3+
# SPDX-License-Identifier: GPL-2.0-or-later
4+
5+
# Prerequisite check(s) for module.
6+
check() {
7+
8+
# If the binary(s) requirements are not fulfilled the module can't be installed
9+
require_binaries "$systemdutildir"/systemd-timesyncd || return 1
10+
require_binaries "$systemdutildir"/systemd-time-wait-sync || return 1
11+
12+
# Return 255 to only include the module, if another module requires it.
13+
return 255
14+
15+
}
16+
17+
# Module dependency requirements.
18+
depends() {
19+
20+
# This module has external dependency on other module(s).
21+
echo dbus systemd-timedated
22+
# Return 0 to include the dependent module(s) in the initramfs.
23+
return 0
24+
25+
}
26+
27+
# Install the required file(s) and directories for the module in the initramfs.
28+
install() {
29+
30+
# Enable this if networkd ( not the module ) is disabled at build time and you want to use timesyncd
31+
# inst_simple "$moddir/timesyncd-tmpfile-dracut.conf" "$tmpfilesdir/timesyncd-tmpfile-dracut.conf"
32+
33+
inst_multiple -o \
34+
"$dbussystem"/org.freedesktop.timesync1.conf \
35+
"$dbussystemservices"/org.freedesktop.timesync1.service \
36+
"$systemdutildir/ntp-units.d/*.list" \
37+
"$systemdutildir"/systemd-timesyncd \
38+
"$systemdutildir"/systemd-time-wait-sync \
39+
"$systemdutildir/timesyncd.conf.d/*.conf" \
40+
"$systemdsystemunitdir"/systemd-timesyncd.service \
41+
"$systemdsystemunitdir/systemd-timesyncd.service.d/*.conf" \
42+
"$systemdsystemunitdir"/systemd-time-wait-sync.service \
43+
"$systemdsystemunitdir/systemd-time-wait-sync.service.d/*.conf"
44+
45+
# Enable systemd type unit(s)
46+
for i in \
47+
systemd-timesyncd.service \
48+
systemd-time-wait-sync.service; do
49+
$SYSTEMCTL -q --root "$initdir" enable "$i"
50+
done
51+
52+
# Install the hosts local user configurations if enabled.
53+
if [[ $hostonly ]]; then
54+
inst_multiple -H -o \
55+
"$systemdutilconfdir/ntp-units.d/*.list" \
56+
"$systemdutilconfdir"/timesyncd.conf \
57+
"$systemdutilconfdir/timesyncd.conf.d/*.conf" \
58+
"$systemdsystemconfdir"/systemd-timesyncd.service \
59+
"$systemdsystemconfdir/systemd-timesyncd.service.d/*.conf" \
60+
"$systemdsystemunitdir"/systemd-time-wait-sync.service \
61+
"$systemdsystemunitdir/systemd-time-wait-sync.service.d/*.conf"
62+
fi
63+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# This file is part of dracut systemd-timesyncd module.
2+
d /run/systemd/netif/links 0755 root root -

0 commit comments

Comments
 (0)