Skip to contentSkip to conversation

dhcpcd: start-up scripts

PATCH New Markus Mayer 5 participants 20 messages Oct 31, 2017 – Nov 5, 2017

lore
Share & tools
lore
#0 lore raw

cover dhcpcd: start-up scripts

From: Markus Mayer <[email protected]>

System V and systemd start-up scripts for dhcpcd.

Other daemons come with start-up scripts, whereas dhcpcd did not include them.

Markus Mayer (2):
dhcpcd: add SysV start-up script
dhcpcd: add systemd start-up service

 package/dhcpcd/S41dhcpcd      | 34 ++++++++++++++++++++++++++++++++++
 package/dhcpcd/dhcpcd.mk      | 13 +++++++++++++
 package/dhcpcd/dhcpcd.service | 13 +++++++++++++
 3 files changed, 60 insertions(+)
 create mode 100755 package/dhcpcd/S41dhcpcd
 create mode 100644 package/dhcpcd/dhcpcd.service
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/2 dhcpcd: add SysV start-up script

From: Markus Mayer <[email protected]>

Add System V start-up script for dhcpcd that is run after the network has been brought up.

---
 package/dhcpcd/S41dhcpcd | 34 ++++++++++++++++++++++++++++++++++
 package/dhcpcd/dhcpcd.mk |  5 +++++
 2 files changed, 39 insertions(+)
 create mode 100755 package/dhcpcd/S41dhcpcd
package/dhcpcd/S41dhcpcd new file +34 -0
new file mode 100755
index 0000000..a2e87ca
@@ -0,0 +1,34 @@
+#!/bin/sh
+#
+# Start/stop dhcpcd
+#
+
+DAEMON=/sbin/dhcpcd
+CONFIG=/etc/dhcpcd.conf
+PIDFILE=/var/run/dhcpcd.pid
+
+[ -x $DAEMON ] || exit 0
+[ -f $CONFIG ] || exit 0
+
+case "$1" in
+  start)
+	echo "Starting dhcpcd..."
+	start-stop-daemon -S -x "$DAEMON" -p "$PIDFILE" -- -f "$CONFIG"
+	;;
+  stop)
+	echo "Stopping dhcpcd..."
+	start-stop-daemon -K -x "$DAEMON" -p "$PIDFILE" -o
+	;;
+  reload|force-reload)
+	echo "Reloading dhcpcd configuration..."
+	"$DAEMON" -s reload
+	;;
+  restart)
+	"$0" stop
+	sleep 1 # Prevent race condition: ensure dhcpcd stops before start.
+	"$0" start
+	;;
+  *)
+	echo "Usage: $0 {start|stop|restart|reload|force-reload}"
+	exit 1
+esac
package/dhcpcd/dhcpcd.mk +5 -0
index 1d29cda..cf1da4f 100644
@@ -36,6 +36,11 @@ define DHCPCD_INSTALL_TARGET_CMDS
 	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) install DESTDIR=$(TARGET_DIR)
 endef
 
+define DHCPCD_INSTALL_INIT_SYSV
+	$(INSTALL) -m 755 -D package/dhcpcd/S41dhcpcd \
+		$(TARGET_DIR)/etc/init.d/S41dhcpcd
+endef
+
 # NOTE: Even though this package has a configure script, it is not generated
 # using the autotools, so we have to use the generic package infrastructure.
 
Signature · 1 line
2.7.4
#18 lore raw

PATCH 2/2 dhcpcd: add systemd start-up service

In reply to Markus Mayer

From: Markus Mayer <[email protected]>

Add systemd start-up configuration for dhcpcd that is executed after the network has been brought up.

---
 package/dhcpcd/dhcpcd.mk      |  8 ++++++++
 package/dhcpcd/dhcpcd.service | 13 +++++++++++++
 2 files changed, 21 insertions(+)
 create mode 100644 package/dhcpcd/dhcpcd.service
package/dhcpcd/dhcpcd.mk +8 -0
index cf1da4f..dc5c69b 100644
@@ -41,6 +41,14 @@ define DHCPCD_INSTALL_INIT_SYSV
 		$(TARGET_DIR)/etc/init.d/S41dhcpcd
 endef
 
+define DHCPCD_INSTALL_INIT_SYSTEMD
+	$(INSTALL) -D -m 0644 package/dhcpcd/dhcpcd.service \
+		$(TARGET_DIR)/usr/lib/systemd/system/dhcpcd.service
+	mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
+	ln -sf ../../../../usr/lib/systemd/system/dhcpcd.service \
+		$(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/dhcpcd.service
+endef
+
 # NOTE: Even though this package has a configure script, it is not generated
 # using the autotools, so we have to use the generic package infrastructure.
 
package/dhcpcd/dhcpcd.service new file +13 -0
new file mode 100644
index 0000000..0552b5c
@@ -0,0 +1,13 @@
+[Unit]
+Description=DHCP client
+After=network.target
+
+[Service]
+Type=forking
+EnvironmentFile=-/etc/default/dhcpcd
+PIDFile=/var/run/dhcpcd.pid
+ExecStart=/sbin/dhcpcd $DAEMON_ARGS
+Restart=always
+
+[Install]
+WantedBy=multi-user.target
Signature · 1 line
2.7.4
#2 lore raw

PATCH 1/2 dhcpcd: add SysV start-up script

In reply to Markus Mayer

Hello,

Quoted 6 lines · Markus Mayer

From: Markus Mayer <[email protected]>

Add System V start-up script for dhcpcd that is run after the network has been brought up.

I've applied, just two comments.

package/dhcpcd/S41dhcpcd line 11

Quoted 6 lines
package/dhcpcd/S41dhcpcd new file +6 -0
+DAEMON=/sbin/dhcpcd
+CONFIG=/etc/dhcpcd.conf
+PIDFILE=/var/run/dhcpcd.pid
+
+[ -x $DAEMON ] || exit 0
+[ -f $CONFIG ] || exit 0

We have these in a lot of init scripts, so I kept them. But I find those tests pretty silly in fact:

- The daemon should definitely be there, as it's installed by the same package. And if it turns out not to be there, I'd prefer a loud failure than an init script that silently ignores the problem.

- Same for the configuration file: I prefer a loud error than an init script that ignores the problem.

Yann, Peter, Arnout, can we agree that such tests should be removed entirely, and we let the init script fail if the daemon does not exist, and the daemon fail if its configuration file does not exist ?

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#19 lore raw

PATCH 2/2 dhcpcd: add systemd start-up service

In reply to Markus Mayer

Hello,

Quoted 11 lines · Markus Mayer

From: Markus Mayer <[email protected]>

Add systemd start-up configuration for dhcpcd that is executed after the network has been brought up.

---
 package/dhcpcd/dhcpcd.mk      |  8 ++++++++
 package/dhcpcd/dhcpcd.service | 13 +++++++++++++
 2 files changed, 21 insertions(+)
 create mode 100644 package/dhcpcd/dhcpcd.service

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#3 lore raw

PATCH 1/2 dhcpcd: add SysV start-up script

In reply to Thomas Petazzoni

Thomas, All,

On 2017-11-02 23:06 +0100, Thomas Petazzoni spake thusly:

Quoted 20 lines · Markus Mayer
Quoted 6 lines

From: Markus Mayer <[email protected]>

Add System V start-up script for dhcpcd that is run after the network has been brought up.

I've applied, just two comments.

package/dhcpcd/S41dhcpcd line 11

Quoted 6 lines
package/dhcpcd/S41dhcpcd new file +6 -0
+DAEMON=/sbin/dhcpcd
+CONFIG=/etc/dhcpcd.conf
+PIDFILE=/var/run/dhcpcd.pid
+
+[ -x $DAEMON ] || exit 0
+[ -f $CONFIG ] || exit 0

We have these in a lot of init scripts, so I kept them. But I find those tests pretty silly in fact:

Quoted 3 lines

- The daemon should definitely be there, as it's installed by the same package. And if it turns out not to be there, I'd prefer a loud failure than an init script that silently ignores the problem.

Agreed.

Quoted 2 lines

- Same for the configuration file: I prefer a loud error than an init script that ignores the problem.

Agreed, too.

However:

- if the config file is mandatory, then this should be a failure.

- if the config file is optional, then it missing should be silently ignored and the service started nonetheless.

Quoted 3 lines

Yann, Peter, Arnout, can we agree that such tests should be removed entirely, and we let the init script fail if the daemon does not exist, and the daemon fail if its configuration file does not exist ?

Yes, except for the above.

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/2 dhcpcd: add SysV start-up script

Hello,

Quoted 11 lines · Yann E. MORIN
Quoted 2 lines

- Same for the configuration file: I prefer a loud error than an init script that ignores the problem.

Agreed, too.

However:

- if the config file is mandatory, then this should be a failure.

- if the config file is optional, then it missing should be silently ignored and the service started nonetheless.

So you want explicitly handling for the "missing configuration file" situation in the init script?

I wanted to avoid explicit handling, and just let the daemon whine (or not) if its config file is missing.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#17 lore raw

PATCH 1/2 dhcpcd: add SysV start-up script

In reply to Thomas Petazzoni
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Hi,

Quoted 10 lines
Quoted 2 lines
+[ -x $DAEMON ] || exit 0
+[ -f $CONFIG ] || exit 0

We have these in a lot of init scripts, so I kept them. But I find those tests pretty silly in fact:

- The daemon should definitely be there, as it's installed by the same package. And if it turns out not to be there, I'd prefer a loud failure than an init script that silently ignores the problem.

Quoted 6 lines

- Same for the configuration file: I prefer a loud error than an init script that ignores the problem.

Yann, Peter, Arnout, can we agree that such tests should be removed entirely, and we let the init script fail if the daemon does not exist, and the daemon fail if its configuration file does not exist ?

Sounds sensible to me.

Signature · 1 line
Bye, Peter Korsgaard
#5 lore raw

PATCH 1/2 dhcpcd: add SysV start-up script

In reply to Thomas Petazzoni

Thomas, All,

On 2017-11-02 23:23 +0100, Thomas Petazzoni spake thusly:

Quoted 10 lines · Yann E. MORIN
Quoted 9 lines
Quoted 2 lines

- Same for the configuration file: I prefer a loud error than an init script that ignores the problem.

Agreed, too.

However:

- if the config file is mandatory, then this should be a failure.

Quoted 8 lines
Quoted 2 lines

- if the config file is optional, then it missing should be silently ignored and the service started nonetheless.

So you want explicitly handling for the "missing configuration file" situation in the init script?

I wanted to avoid explicit handling, and just let the daemon whine (or not) if its config file is missing.

The idea is that the script contains sensible defaults, but scans an optional file (e.g. /etc/default.d/my-daemon.conf) that a user can provide to override the defaults.

IIRC, that's what was discussed and concluded a while ago (2 years?).

I would like that users can change the behaviour of a service without having to sed/replace the init script.

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.  |
'------------------------------^-------^------------------^--------------------'
#6 lore raw

PATCH 1/2 dhcpcd: add SysV start-up script

Hello,

Quoted 6 lines · Yann E. MORIN
Quoted 5 lines

So you want explicitly handling for the "missing configuration file" situation in the init script?

I wanted to avoid explicit handling, and just let the daemon whine (or not) if its config file is missing.

Quoted 8 lines

The idea is that the script contains sensible defaults, but scans an optional file (e.g. /etc/default.d/my-daemon.conf) that a user can provide to override the defaults.

IIRC, that's what was discussed and concluded a while ago (2 years?).

I would like that users can change the behaviour of a service without having to sed/replace the init script.

I think we're not talking about the same thing. I'm not talking about /etc/default/foobar containing additional shell variables to tweak the init script behavior.

I'm talking about the configuration file read by the daemon itself (/etc/lighttpd/lighttpd.conf for example).

For inadyn, we have:

CONFIG=/etc/inadyn.conf
[ ! -f $CONFIG ] && ( echo "The config file "$CONFIG" is missing...exiting now." && exit 2 )

So here we error out.

And for squid, we have:

[ -f /etc/squid.conf ] || exit 0

So we silently exit if there's no configuration file.

I'd like to have a consistent solution for this, and my proposal is to do nothing in the init script, i.e start the daemon, and let it explode/blow up/complain/whine if its configuration file is missing.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#7 lore raw

PATCH 1/2 dhcpcd: add SysV start-up script

Thomas, All,

On 2017-11-03 17:17 +0100, Thomas Petazzoni spake thusly:

Quoted 17 lines · Yann E. MORIN
Quoted 7 lines
Quoted 6 lines

So you want explicitly handling for the "missing configuration file" situation in the init script?

I wanted to avoid explicit handling, and just let the daemon whine (or not) if its config file is missing.

Quoted 8 lines

The idea is that the script contains sensible defaults, but scans an optional file (e.g. /etc/default.d/my-daemon.conf) that a user can provide to override the defaults.

IIRC, that's what was discussed and concluded a while ago (2 years?).

I would like that users can change the behaviour of a service without having to sed/replace the init script.

Quoted 6 lines

I think we're not talking about the same thing. I'm not talking about /etc/default/foobar containing additional shell variables to tweak the init script behavior.

I'm talking about the configuration file read by the daemon itself (/etc/lighttpd/lighttpd.conf for example).

Ah, I see, yes. In that case, the .mk should have installed a default one, so we should not check.

So yes, the rule is that whatever should be installed by the .mk should not be checked for by the initscript.

/me hands a lighted match to Thomas...
Kill it with fire!

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.  |
'------------------------------^-------^------------------^--------------------'
#8 lore raw

PATCH 1/2 dhcpcd: add SysV start-up script

In reply to Thomas Petazzoni
Quoted 13 lines · Thomas Petazzoni

Hello,

Quoted 9 lines · Yann E. MORIN
Quoted 2 lines

- Same for the configuration file: I prefer a loud error than an init script that ignores the problem.

Agreed, too.

However:

- if the config file is mandatory, then this should be a failure.

Quoted 8 lines
Quoted 2 lines

- if the config file is optional, then it missing should be silently ignored and the service started nonetheless.

So you want explicitly handling for the "missing configuration file" situation in the init script?

I wanted to avoid explicit handling, and just let the daemon whine (or not) if its config file is missing.

I vaguely remember a recently added package where the daemon would silently
fail to start if the config file is missing, and which doesn't even have a default config file. So I think checking for existence of the config file in the init script (if the config file is mandatory) makes sense.

Regards,
Arnout

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:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#9 lore raw

PATCH 1/2 dhcpcd: add SysV start-up script

Hello,

Quoted 4 lines · Arnout Vandecappelle

I vaguely remember a recently added package where the daemon would silently
fail to start if the config file is missing, and which doesn't even have a default config file. So I think checking for existence of the config file in the init script (if the config file is mandatory) makes sense.

So I suppose your suggestion is that the init script should abort with a failure if the configuration file doesn't exist. Correct?

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#10 lore raw

PATCH 1/2 dhcpcd: add SysV start-up script

Quoted 11 lines · Thomas Petazzoni

Hello,

Quoted 4 lines · Arnout Vandecappelle

I vaguely remember a recently added package where the daemon would silently
fail to start if the config file is missing, and which doesn't even have a default config file. So I think checking for existence of the config file in the init script (if the config file is mandatory) makes sense.

So I suppose your suggestion is that the init script should abort with a failure if the configuration file doesn't exist. Correct?

Exactly. "Failure" anyway just means an error message on the console, not that
the system fails to boot.

Regards,
Arnout

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:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#11 lore raw

PATCH 1/2 dhcpcd: add SysV start-up script

Hello,

Quoted 2 lines · Arnout Vandecappelle

Exactly. "Failure" anyway just means an error message on the console, not that
the system fails to boot.

Sure, but some scripts currently just "exit 0" with no error message whatsoever when the configuration file is missing.

So, let's summarize our policy:

* Never check if the daemon executable is present, because that's silly, Buildroot guarantees it's there.

* If the daemon needs a configuration file, always check if it exists, and if not, bail out with an error message.

But... wait, if Buildroot guarantees that it installs a configuration file for this daemon, having the init script check its presence is pretty much as silly as checking the presence of the daemon executable itself.

So?

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#13 lore raw

PATCH 1/2 dhcpcd: add SysV start-up script

In reply to Arnout Vandecappelle

Arnout, All,

On 2017-11-04 20:56 +0100, Arnout Vandecappelle spake thusly:

Quoted 20 lines · Thomas Petazzoni
Quoted 19 lines

Hello,

Quoted 11 lines · Yann E. MORIN
Quoted 2 lines

- Same for the configuration file: I prefer a loud error than an init script that ignores the problem.

Agreed, too.

However:

- if the config file is mandatory, then this should be a failure.

- if the config file is optional, then it missing should be silently ignored and the service started nonetheless.

So you want explicitly handling for the "missing configuration file" situation in the init script?

Quoted 7 lines
Quoted 2 lines

I wanted to avoid explicit handling, and just let the daemon whine (or not) if its config file is missing.

I vaguely remember a recently added package where the daemon would silently
fail to start if the config file is missing, and which doesn't even have a default config file. So I think checking for existence of the config file in the init script (if the config file is mandatory) makes sense.

Then it is the responsibility of the package.mk to install one if it is mandatory. Otherwise,that means the packaging is incomplete because it does not allow the package to work as expected.

And in that case, I side with Thomas' initial suggestion: we should not check from the init scripts, because we expect the .mk files to be correct.

Regards,
Yann E. MORIN.

Quoted 15 lines

Regards,
Arnout

Signature · 10 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:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
_______________________________________________
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.  |
'------------------------------^-------^------------------^--------------------'
#12 lore raw

PATCH 1/2 dhcpcd: add SysV start-up script

In reply to Thomas Petazzoni

Thomas, Arnout, All,

On 2017-11-04 23:22 +0100, Thomas Petazzoni spake thusly:

Quoted 15 lines · Arnout Vandecappelle
Quoted 2 lines

Exactly. "Failure" anyway just means an error message on the console, not that
the system fails to boot.

Sure, but some scripts currently just "exit 0" with no error message whatsoever when the configuration file is missing.

So, let's summarize our policy:

* Never check if the daemon executable is present, because that's silly, Buildroot guarantees it's there.

* If the daemon needs a configuration file, always check if it exists, and if not, bail out with an error message.

Quoted 6 lines

But... wait, if Buildroot guarantees that it installs a configuration file for this daemon, having the init script check its presence is pretty much as silly as checking the presence of the daemon executable itself.

So?

* Never check if the daemon executable is present, because that's

    silly: Buildroot guarantees it's there;

* Never check for the daemon configuration file, because that's silly:

    Buildroot guarantees it's there;

* Check if there is a startup-script override configuration file in /etc/default/<foo>, and source it if present.

The /etc/default/<foo> config file is here to override the options pased to the daemoin, for example to add more options, or to entorely replace them. Its format is daemon-dependent (we don't want to enforce one, at least).

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.  |
'------------------------------^-------^------------------^--------------------'
#14 lore raw

PATCH 1/2 dhcpcd: add SysV start-up script

In reply to Yann E. MORIN
Quoted 26 lines · Yann E. MORIN

Arnout, All,

On 2017-11-04 20:56 +0100, Arnout Vandecappelle spake thusly:

Quoted 23 lines · Thomas Petazzoni
Quoted 21 lines

Hello,

Quoted 11 lines · Yann E. MORIN
Quoted 2 lines

- Same for the configuration file: I prefer a loud error than an init script that ignores the problem.

Agreed, too.

However:

- if the config file is mandatory, then this should be a failure.

- if the config file is optional, then it missing should be silently ignored and the service started nonetheless.

So you want explicitly handling for the "missing configuration file" situation in the init script?

I wanted to avoid explicit handling, and just let the daemon whine (or not) if its config file is missing.

Quoted 8 lines
Quoted 4 lines

I vaguely remember a recently added package where the daemon would silently
fail to start if the config file is missing, and which doesn't even have a default config file. So I think checking for existence of the config file in the init script (if the config file is mandatory) makes sense.

Then it is the responsibility of the package.mk to install one if it is mandatory. Otherwise,that means the packaging is incomplete because it does not allow the package to work as expected.

So you mean all packages should do like inadyn: install an example
configuration file even if that is guaranteed not to work.

Regards,
Arnout

Quoted 24 lines

And in that case, I side with Thomas' initial suggestion: we should not check from the init scripts, because we expect the .mk files to be correct.

Regards,
Yann E. MORIN.

Quoted 15 lines

Regards,
Arnout

Signature · 10 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:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
_______________________________________________
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:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#15 lore raw

PATCH 1/2 dhcpcd: add SysV start-up script

Hello,

Quoted 6 lines · Arnout Vandecappelle
Quoted 3 lines

Then it is the responsibility of the package.mk to install one if it is mandatory. Otherwise,that means the packaging is incomplete because it does not allow the package to work as expected.

So you mean all packages should do like inadyn: install an example
configuration file even if that is guaranteed not to work.

Yes, I think it's a good idea if packages install a least some example/template configuration file, even if indeed it may not work out of the box in cases such as inadyn.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#16 lore raw

PATCH 1/2 dhcpcd: add SysV start-up script

In reply to Arnout Vandecappelle

Arnout, All,

On 2017-11-05 13:18 +0100, Arnout Vandecappelle spake thusly:

Quoted 6 lines · Yann E. MORIN
Quoted 3 lines

Then it is the responsibility of the package.mk to install one if it is mandatory. Otherwise,that means the packaging is incomplete because it does not allow the package to work as expected.

So you mean all packages should do like inadyn: install an example
configuration file even if that is guaranteed not to work.

Yes, if at least because it serves as a base for the user to write their own or fill-in the blanks.

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