From patchwork Tue Oct 31 22:36:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Mayer X-Patchwork-Id: 832751 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yRR7L5j8Kz9t41 for ; Wed, 1 Nov 2017 09:37:34 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id DB4E489BD1; Tue, 31 Oct 2017 22:37:30 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LtAPWvwV7DQH; Tue, 31 Oct 2017 22:37:29 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id D21058974A; Tue, 31 Oct 2017 22:37:28 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 674CB1BFFC3 for ; Tue, 31 Oct 2017 22:37:27 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 5D66187F54 for ; Tue, 31 Oct 2017 22:37:27 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EQO+meYgQK0E for ; Tue, 31 Oct 2017 22:37:26 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.138]) by whitealder.osuosl.org (Postfix) with ESMTPS id B0B9B87F4D for ; Tue, 31 Oct 2017 22:37:26 +0000 (UTC) Received: from triton.mmayer.net ([96.48.174.102]) by shaw.ca with SMTP id 9f9xesPArDJTW9f9yedQUq; Tue, 31 Oct 2017 16:37:26 -0600 X-Authority-Analysis: v=2.2 cv=B4DJ6KlM c=1 sm=1 tr=0 a=IfKG9KDHjPrX0SZ8gMoyrg==:117 a=IfKG9KDHjPrX0SZ8gMoyrg==:17 a=02M-m0pO-4AA:10 a=Q-fNiiVtAAAA:8 a=cVC18mn8tCFlGxKIg1AA:9 a=Fp8MccfUoT0GBdDC_Lng:22 Received: by triton.mmayer.net (Postfix, from userid 501) id 1D22F200C466BA; Tue, 31 Oct 2017 15:37:25 -0700 (PDT) From: Markus Mayer To: buildroot@busybox.net Date: Tue, 31 Oct 2017 15:36:58 -0700 Message-Id: <20171031223659.6831-2-code@mmayer.net> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171031223659.6831-1-code@mmayer.net> References: <20171031223659.6831-1-code@mmayer.net> X-CMAE-Envelope: MS4wfO2NCzF0jk11bUMUHCyXnI9zxcvlR8q40HDJbQKJuzp95ArroRjbRHH/L8d3bIUYAagtL4fhkh2dZHjcFPPPskq6FTKy2U6dHtfGsrm8chj2B0Doq2q8 eE7aUBRgipN2COEs+R/+3jBDJ5eP/5khWSKoEJmocNduSfER7Lw7d/2yI1zuOMPHvnVia4gVBFbLvT6c5y+lnafI6e35NVLK+Mk= Cc: Markus Mayer Subject: [Buildroot] [PATCH 1/2] dhcpcd: add SysV start-up script X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Markus Mayer Add System V start-up script for dhcpcd that is run after the network has been brought up. Signed-off-by: Markus Mayer --- 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. From patchwork Tue Oct 31 22:36:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Mayer X-Patchwork-Id: 832752 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yRR7b1ZC9z9t41 for ; Wed, 1 Nov 2017 09:37:47 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 2B8292DA31; Tue, 31 Oct 2017 22:37:44 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zjpuqOOs+8Zf; Tue, 31 Oct 2017 22:37:42 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 60F9B2D443; Tue, 31 Oct 2017 22:37:42 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 5914B1BFFC3 for ; Tue, 31 Oct 2017 22:37:40 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 4688187F69 for ; Tue, 31 Oct 2017 22:37:40 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gxYoRm7VxcPN for ; Tue, 31 Oct 2017 22:37:39 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.138]) by whitealder.osuosl.org (Postfix) with ESMTPS id 6DDCD87F54 for ; Tue, 31 Oct 2017 22:37:39 +0000 (UTC) Received: from triton.mmayer.net ([96.48.174.102]) by shaw.ca with SMTP id 9fA8esPDqDJTW9fABedQY4; Tue, 31 Oct 2017 16:37:39 -0600 X-Authority-Analysis: v=2.2 cv=B4DJ6KlM c=1 sm=1 tr=0 a=IfKG9KDHjPrX0SZ8gMoyrg==:117 a=IfKG9KDHjPrX0SZ8gMoyrg==:17 a=02M-m0pO-4AA:10 a=Q-fNiiVtAAAA:8 a=1KMdfeuscoFNYF7VAU8A:9 a=Fp8MccfUoT0GBdDC_Lng:22 Received: by triton.mmayer.net (Postfix, from userid 501) id EA6A2200C466D2; Tue, 31 Oct 2017 15:37:35 -0700 (PDT) From: Markus Mayer To: buildroot@busybox.net Date: Tue, 31 Oct 2017 15:36:59 -0700 Message-Id: <20171031223659.6831-3-code@mmayer.net> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171031223659.6831-1-code@mmayer.net> References: <20171031223659.6831-1-code@mmayer.net> X-CMAE-Envelope: MS4wfDh0qTae3EbYN1Ps1jejzAXAQ5SbyI+8b1TdAlcVc1/zmRzGy6vUqkY7STUwzKnbOrS3ZXXMfNEUakXhaVJ355652oli/cIze6iwdOjUBBCiEZJCBfzC dIpol7ipQFHjiuR3YcWfrAE5jW8UvyQUw0To8U3WZMeFkbepkE9BqOLhMzrDe+4Ufs0sSk2KYUGCoaWc9yE5By78JwZVc3JCD6o= Cc: Markus Mayer Subject: [Buildroot] [PATCH 2/2] dhcpcd: add systemd start-up service X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Markus Mayer Add systemd start-up configuration for dhcpcd that is executed after the network has been brought up. Signed-off-by: Markus Mayer --- package/dhcpcd/dhcpcd.mk | 8 ++++++++ package/dhcpcd/dhcpcd.service | 13 +++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 package/dhcpcd/dhcpcd.service diff --git a/package/dhcpcd/dhcpcd.mk b/package/dhcpcd/dhcpcd.mk index cf1da4f..dc5c69b 100644 --- a/package/dhcpcd/dhcpcd.mk +++ b/package/dhcpcd/dhcpcd.mk @@ -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. diff --git a/package/dhcpcd/dhcpcd.service b/package/dhcpcd/dhcpcd.service new file mode 100644 index 0000000..0552b5c --- /dev/null +++ b/package/dhcpcd/dhcpcd.service @@ -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