Skip to contentSkip to conversation

openntpd: add SysV initscript and user

PATCH New Gustavo Zacarias 4 participants 7 messages Jun 11, 2014 – Jul 8, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 openntpd: add SysV initscript and user

Add the _ntp user that the daemon requires to work in any way. Add a SysV-style initscript as well, but not with '-s' (set time immediately after startup) because it can make the boot process stall for a few seconds if there's no proper network connectivity/dns setup. Make ntp and openntpd mutually exclusive since they overstep each other.

---
 package/openntpd/Config.in   |  4 ++--
 package/openntpd/S49ntp      | 25 +++++++++++++++++++++++++
 package/openntpd/openntpd.mk |  9 +++++++++
 3 files changed, 36 insertions(+), 2 deletions(-)
 create mode 100755 package/openntpd/S49ntp
package/openntpd/Config.in +2 -2
index 4dd9a29..a8ef807 100644
@@ -1,7 +1,7 @@
 config BR2_PACKAGE_OPENNTPD
 	bool "openntpd"
-	# fork()
-	depends on BR2_USE_MMU
+	depends on BR2_USE_MMU # fork ()
+	depends on !BR2_PACKAGE_NTP # conflicting binaries
 	help
 	  OpenNTPD is an easy to use implementation of the Network Time
 	  Protocol. It provides the ability to sync the local clock
package/openntpd/S49ntp new file +25 -0
new file mode 100755
index 0000000..99e0f68
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+[ -x /usr/sbin/ntpd ] || exit 0
+[ -f /etc/ntpd.conf ] || exit 0
+
+case "$1" in
+	start)
+		echo -n "Starting openntpd: "
+		start-stop-daemon -S -x /usr/sbin/ntpd
+		[ $? == 0 ] && echo "OK" || echo "FAIL"
+		;;
+	stop)
+		echo -n "Stopping openntpd: "
+		start-stop-daemon -K -x /usr/sbin/ntpd
+		[ $? == 0 ] && echo "OK" || echo "FAIL"
+		;;
+	restart)
+		"$0" stop
+		sleep 1
+		"$0" start
+		;;
+	*)
+		echo "Usage: $0 {start|stop|restart}"
+		;;
+esac
package/openntpd/openntpd.mk +9 -0
index f0e4f19..0fe6179 100644
@@ -10,4 +10,13 @@ OPENNTPD_CONF_OPT = --with-builtin-arc4random --disable-strip
 OPENNTPD_LICENSE = MIT-like, BSD-2c, BSD-3c
 OPENNTPD_LICENSE_FILES = LICENCE
 
+define OPENNTPD_INSTALL_INIT_SYSV
+	$(INSTALL) -m 0755 -D package/openntpd/S49ntp \
+		$(TARGET_DIR)/etc/init.d/S49ntp
+endef
+
+define OPENNTPD_USERS
+_ntp -1 _ntp -1 * - - - Network Time Protocol daemon
+endef
+
 $(eval $(autotools-package))
Signature · 1 line
1.8.5.5
#1 lore raw

PATCH 1/1 openntpd: add SysV initscript and user

Gustavo, All

On 2014-06-11 08:33 -0300, Gustavo Zacarias spake thusly:

Quoted 7 lines

Add the _ntp user that the daemon requires to work in any way. Add a SysV-style initscript as well, but not with '-s' (set time immediately after startup) because it can make the boot process stall for a few seconds if there's no proper network connectivity/dns setup. Make ntp and openntpd mutually exclusive since they overstep each other.

[--SNIP--]

Quoted 5 lines
package/openntpd/openntpd.mk +0 -0
index f0e4f19..0fe6179 100644

package/openntpd/openntpd.mk OPENNTPD_CONF_OPT = --with-builtin-arc4random --disable-strip · line 19

Quoted 10 lines
package/openntpd/openntpd.mk +7 -0
@@ -10,4 +10,13 @@ OPENNTPD_CONF_OPT = --with-builtin-arc4random --disable-strip
 OPENNTPD_LICENSE = MIT-like, BSD-2c, BSD-3c
 OPENNTPD_LICENSE_FILES = LICENCE
 
+define OPENNTPD_INSTALL_INIT_SYSV
+	$(INSTALL) -m 0755 -D package/openntpd/S49ntp \
+		$(TARGET_DIR)/etc/init.d/S49ntp
+endef
+
+define OPENNTPD_USERS
+_ntp -1 _ntp -1 * - - - Network Time Protocol daemon

Any reason why you name the user and group with a leading '_' ?

Regards,
Yann E. MORIN.

Quoted 10 lines
package/openntpd/openntpd.mk +2 -0
+endef
+
 $(eval $(autotools-package))
Signature · 6 lines
1.8.5.5

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#2 lore raw

PATCH 1/1 openntpd: add SysV initscript and user

Quoted 1 line · Yann E. MORIN

Any reason why you name the user and group with a leading '_' ?

Because the code says so, and it's not configurable. The group just to keep consistency.
Regards.

#3 lore raw

PATCH 1/1 openntpd: add SysV initscript and user

Gustavo, All,

On 2014-06-22 19:32 -0300, Gustavo Zacarias spake thusly:

Quoted 6 lines · Yann E. MORIN
Quoted 2 lines

Any reason why you name the user and group with a leading '_' ?

Because the code says so, and it's not configurable. The group just to keep consistency.

Ok, that should be noted as a comment above the user definition, I guess.

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#4 lore raw

PATCH 1/1 openntpd: add SysV initscript and user

Quoted 7 lines · Yann E. MORIN
Quoted 4 lines
Quoted 1 line

Any reason why you name the user and group with a leading '_' ?

Because the code says so, and it's not configurable. The group just to keep consistency.

Ok, that should be noted as a comment above the user definition, I guess.

Why?
We don't document these details for systemd or other packages, why should we here?
I think the _USERS variable is explicit enough as documentation. Regards.

#5 lore raw

PATCH 1/1 openntpd: add SysV initscript and user

Quoted 7 lines · Gustavo Zacarias
Quoted 5 lines · Yann E. MORIN
Quoted 4 lines
Quoted 1 line

Any reason why you name the user and group with a leading '_' ?

Because the code says so, and it's not configurable. The group just to keep consistency.

Quoted 7 lines
Quoted 2 lines

Ok, that should be noted as a comment above the user definition, I guess.

Why?
We don't document these details for systemd or other packages, why should we here?
I think the _USERS variable is explicit enough as documentation.

Also, it is explicit in the commit message. So I agree that the patch is OK as
is. Well, putting a comment wouldn't hurt of course.

So anyway:

Regards,
Arnout

Quoted 7 lines

Regards.

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#6 lore raw

PATCH 1/1 openntpd: add SysV initscript and user

In reply to Gustavo Zacarias
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Gustavo" == Gustavo Zacarias <[email protected]> writes:

Add the _ntp user that the daemon requires to work in any way. Add a SysV-style initscript as well, but not with '-s' (set time immediately after startup) because it can make the boot process stall for a few seconds if there's no proper network connectivity/dns setup. Make ntp and openntpd mutually exclusive since they overstep each other.

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard