Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] openntpd: add SysV initscript and user
@ 2014-06-11 11:33 Gustavo Zacarias
  2014-06-22 17:23 ` Yann E. MORIN
  2014-07-08 12:18 ` Peter Korsgaard
  0 siblings, 2 replies; 7+ messages in thread
From: Gustavo Zacarias @ 2014-06-11 11:33 UTC (permalink / raw)
  To: buildroot

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.

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
---
 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

diff --git a/package/openntpd/Config.in b/package/openntpd/Config.in
index 4dd9a29..a8ef807 100644
--- a/package/openntpd/Config.in
+++ b/package/openntpd/Config.in
@@ -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
diff --git a/package/openntpd/S49ntp b/package/openntpd/S49ntp
new file mode 100755
index 0000000..99e0f68
--- /dev/null
+++ b/package/openntpd/S49ntp
@@ -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
diff --git a/package/openntpd/openntpd.mk b/package/openntpd/openntpd.mk
index f0e4f19..0fe6179 100644
--- a/package/openntpd/openntpd.mk
+++ b/package/openntpd/openntpd.mk
@@ -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))
-- 
1.8.5.5

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

* [Buildroot] [PATCH] openntpd: add SysV initscript and user
  2014-06-11 11:33 [Buildroot] [PATCH] openntpd: add SysV initscript and user Gustavo Zacarias
@ 2014-06-22 17:23 ` Yann E. MORIN
  2014-06-22 22:32   ` Gustavo Zacarias
  2014-07-08 12:18 ` Peter Korsgaard
  1 sibling, 1 reply; 7+ messages in thread
From: Yann E. MORIN @ 2014-06-22 17:23 UTC (permalink / raw)
  To: buildroot

Gustavo, All

On 2014-06-11 08:33 -0300, Gustavo Zacarias spake thusly:
> 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.
> 
> Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
[--SNIP--]
> diff --git a/package/openntpd/openntpd.mk b/package/openntpd/openntpd.mk
> index f0e4f19..0fe6179 100644
> --- a/package/openntpd/openntpd.mk
> +++ b/package/openntpd/openntpd.mk
> @@ -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.

> +endef
> +
>  $(eval $(autotools-package))
> -- 
> 1.8.5.5
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH] openntpd: add SysV initscript and user
  2014-06-22 17:23 ` Yann E. MORIN
@ 2014-06-22 22:32   ` Gustavo Zacarias
  2014-06-22 22:37     ` Yann E. MORIN
  0 siblings, 1 reply; 7+ messages in thread
From: Gustavo Zacarias @ 2014-06-22 22:32 UTC (permalink / raw)
  To: buildroot

On 06/22/2014 02:23 PM, Yann E. MORIN wrote:

> 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.

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

* [Buildroot] [PATCH] openntpd: add SysV initscript and user
  2014-06-22 22:32   ` Gustavo Zacarias
@ 2014-06-22 22:37     ` Yann E. MORIN
  2014-06-22 22:43       ` Gustavo Zacarias
  0 siblings, 1 reply; 7+ messages in thread
From: Yann E. MORIN @ 2014-06-22 22:37 UTC (permalink / raw)
  To: buildroot

Gustavo, All,

On 2014-06-22 19:32 -0300, Gustavo Zacarias spake thusly:
> On 06/22/2014 02:23 PM, Yann E. MORIN wrote:
> 
> > 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.

-- 
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH] openntpd: add SysV initscript and user
  2014-06-22 22:37     ` Yann E. MORIN
@ 2014-06-22 22:43       ` Gustavo Zacarias
  2014-06-23 16:38         ` Arnout Vandecappelle
  0 siblings, 1 reply; 7+ messages in thread
From: Gustavo Zacarias @ 2014-06-22 22:43 UTC (permalink / raw)
  To: buildroot

On 06/22/2014 07:37 PM, Yann E. MORIN wrote:

>>> 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.

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

* [Buildroot] [PATCH] openntpd: add SysV initscript and user
  2014-06-22 22:43       ` Gustavo Zacarias
@ 2014-06-23 16:38         ` Arnout Vandecappelle
  0 siblings, 0 replies; 7+ messages in thread
From: Arnout Vandecappelle @ 2014-06-23 16:38 UTC (permalink / raw)
  To: buildroot

On 23/06/14 00:43, Gustavo Zacarias wrote:
> On 06/22/2014 07:37 PM, Yann E. MORIN wrote:
> 
>>>> 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.

 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:

Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>


 Regards,
 Arnout

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


-- 
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

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

* [Buildroot] [PATCH] openntpd: add SysV initscript and user
  2014-06-11 11:33 [Buildroot] [PATCH] openntpd: add SysV initscript and user Gustavo Zacarias
  2014-06-22 17:23 ` Yann E. MORIN
@ 2014-07-08 12:18 ` Peter Korsgaard
  1 sibling, 0 replies; 7+ messages in thread
From: Peter Korsgaard @ 2014-07-08 12:18 UTC (permalink / raw)
  To: buildroot

>>>>> "Gustavo" == Gustavo Zacarias <gustavo@zacarias.com.ar> 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.

 > Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>

Committed, thanks.

-- 
Bye, Peter Korsgaard

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

end of thread, other threads:[~2014-07-08 12:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-11 11:33 [Buildroot] [PATCH] openntpd: add SysV initscript and user Gustavo Zacarias
2014-06-22 17:23 ` Yann E. MORIN
2014-06-22 22:32   ` Gustavo Zacarias
2014-06-22 22:37     ` Yann E. MORIN
2014-06-22 22:43       ` Gustavo Zacarias
2014-06-23 16:38         ` Arnout Vandecappelle
2014-07-08 12:18 ` Peter Korsgaard

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