Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/ntpsec: add systemd unit file
@ 2022-07-28 11:34 Guillaume W. Bres
  2022-07-29 20:12 ` Yann E. MORIN
  2022-07-29 20:16 ` James Hilliard
  0 siblings, 2 replies; 3+ messages in thread
From: Guillaume W. Bres @ 2022-07-28 11:34 UTC (permalink / raw)
  To: buildroot; +Cc: Peter Seiderer, Guillaume W. Bres, Thomas Petazzoni

Signed-off-by: Guillaume W. Bres <guillaume.bressaix@gmail.com>
---
Use -d to daemonize, use -g to allow a "big leap".
Prior synchronization, system date is usually set to 01/01/1970.
By default, ntpsec does not allow that big of a leap,
and we never obtain synchronization without -g.
Ideally, you want some sort of mechanism to only use
-g on first (ever) boot.
---
 package/ntpsec/ntpd.service | 10 ++++++++++
 package/ntpsec/ntpsec.mk    |  5 +++++
 2 files changed, 15 insertions(+)
 create mode 100644 package/ntpsec/ntpd.service

diff --git a/package/ntpsec/ntpd.service b/package/ntpsec/ntpd.service
new file mode 100644
index 0000000..3987085
--- /dev/null
+++ b/package/ntpsec/ntpd.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=NTPSec
+After=network.target
+Conflicts=systemd-timesyncd.service
+
+[Service]
+ExecStart=/usr/sbin/ntpd -d -g
+
+[Install]
+WantedBy=multi-user.target
diff --git a/package/ntpsec/ntpsec.mk b/package/ntpsec/ntpsec.mk
index a0d0662..a0fc49b 100644
--- a/package/ntpsec/ntpsec.mk
+++ b/package/ntpsec/ntpsec.mk
@@ -62,6 +62,11 @@ define NTPSEC_INSTALL_INIT_SYSV
 	$(INSTALL) -D -m 755 package/ntpsec/S49ntpd $(TARGET_DIR)/etc/init.d/S49ntpd
 endef
 
+define NTPSEC_INSTALL_INIT_SYSTEMD
+	$(INSTALL) -D -m 0644 package/ntpsec/ntpd.service \
+		$(TARGET_DIR)/usr/lib/systemd/system/ntpd.service
+endef
+
 define NTPSEC_USERS
 	ntp -1 ntp -1 * - - - ntpd user
 endef
-- 
1.8.3.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-07-29 20:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-28 11:34 [Buildroot] [PATCH] package/ntpsec: add systemd unit file Guillaume W. Bres
2022-07-29 20:12 ` Yann E. MORIN
2022-07-29 20:16 ` James Hilliard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox