Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Mayer <code@mmayer.net>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1/2] dhcpcd: add SysV start-up script
Date: Tue, 31 Oct 2017 15:36:58 -0700	[thread overview]
Message-ID: <20171031223659.6831-2-code@mmayer.net> (raw)
In-Reply-To: <20171031223659.6831-1-code@mmayer.net>

From: Markus Mayer <mmayer@broadcom.com>

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

Signed-off-by: Markus Mayer <mmayer@broadcom.com>
---
 package/dhcpcd/S41dhcpcd | 34 ++++++++++++++++++++++++++++++++++
 package/dhcpcd/dhcpcd.mk |  5 +++++
 2 files changed, 39 insertions(+)
 create mode 100755 package/dhcpcd/S41dhcpcd

diff --git a/package/dhcpcd/S41dhcpcd b/package/dhcpcd/S41dhcpcd
new file mode 100755
index 0000000..a2e87ca
--- /dev/null
+++ b/package/dhcpcd/S41dhcpcd
@@ -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
diff --git a/package/dhcpcd/dhcpcd.mk b/package/dhcpcd/dhcpcd.mk
index 1d29cda..cf1da4f 100644
--- a/package/dhcpcd/dhcpcd.mk
+++ b/package/dhcpcd/dhcpcd.mk
@@ -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.
 
-- 
2.7.4

  reply	other threads:[~2017-10-31 22:36 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-31 22:36 [Buildroot] [PATCH 0/2] dhcpcd: start-up scripts Markus Mayer
2017-10-31 22:36 ` Markus Mayer [this message]
2017-11-02 22:06   ` [Buildroot] [PATCH 1/2] dhcpcd: add SysV start-up script Thomas Petazzoni
2017-11-02 22:18     ` Yann E. MORIN
2017-11-02 22:23       ` Thomas Petazzoni
2017-11-03 16:10         ` Yann E. MORIN
2017-11-03 16:17           ` Thomas Petazzoni
2017-11-03 16:31             ` Yann E. MORIN
2017-11-04 19:56         ` Arnout Vandecappelle
2017-11-04 22:03           ` Thomas Petazzoni
2017-11-04 22:07             ` Arnout Vandecappelle
2017-11-04 22:22               ` Thomas Petazzoni
2017-11-05  8:16                 ` Yann E. MORIN
2017-11-05  8:10           ` Yann E. MORIN
2017-11-05 12:18             ` Arnout Vandecappelle
2017-11-05 13:24               ` Thomas Petazzoni
2017-11-05 13:28               ` Yann E. MORIN
2017-11-03 15:59     ` Peter Korsgaard
2017-10-31 22:36 ` [Buildroot] [PATCH 2/2] dhcpcd: add systemd start-up service Markus Mayer
2017-11-02 22:06   ` Thomas Petazzoni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171031223659.6831-2-code@mmayer.net \
    --to=code@mmayer.net \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox