From patchwork Sun Oct 25 00:59:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Beno=C3=AEt_Th=C3=A9baudeau?= X-Patchwork-Id: 535526 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ozlabs.org (Postfix) with ESMTP id 4028514131D for ; Sun, 25 Oct 2015 12:01:13 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=F5UAUj3v; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 5ACA9319F1; Sun, 25 Oct 2015 01:01:12 +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 Psy9YmOXf7My; Sun, 25 Oct 2015 01:01:06 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id D44DA31A11; Sun, 25 Oct 2015 01:00:27 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id B49081C108E for ; Sun, 25 Oct 2015 01:00:17 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id A3FE3248A1 for ; Sun, 25 Oct 2015 01:00:17 +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 E27N4+CgKNF7 for ; Sun, 25 Oct 2015 01:00:11 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com [209.85.212.173]) by silver.osuosl.org (Postfix) with ESMTPS id 9925131602 for ; Sun, 25 Oct 2015 01:00:00 +0000 (UTC) Received: by wicfv8 with SMTP id fv8so73575236wic.0 for ; Sat, 24 Oct 2015 17:59:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=OPvwIN4/uh0UGyaE0N+McawIzalp/fDXld4+t8iLxcg=; b=F5UAUj3vz98w6uDvhTX+dwooucBJQyX86Y/GMimYVf9B1BwK45BMp/cUe0i+vnC7PL KXAiBPJ7cSuAOV1bcUpPRhaVUZgheNaZkQSAgZhxbl7xDsagzV2L2QlqVAlHFfO8hJgb 1YyMZoUGbGGjLYkozlHf3YkUrdZqB9aToPml+96XSSA3EGg79s7eMseAiBJ9GE2UGv2O TqC6eBPvAK46VEPQmZk8SO8rNfM5WHUPDnh3Y5BwFSn2YIL8vYdxytBr2NArWGHcDfsY ZAWYuv0KZnjLShLw0a1YHi+ZqfcdGkhUqop+jOZD8G9uLdT6qjBrNMwySPlc8HNpO3sh jw8Q== X-Received: by 10.194.173.38 with SMTP id bh6mr2817311wjc.2.1445734799254; Sat, 24 Oct 2015 17:59:59 -0700 (PDT) Received: from localhost.localdomain (vno44-1-88-172-188-148.fbx.proxad.net. [88.172.188.148]) by smtp.gmail.com with ESMTPSA id jd9sm8406757wic.0.2015.10.24.17.59.58 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 24 Oct 2015 17:59:58 -0700 (PDT) From: =?UTF-8?q?Beno=C3=AEt=20Th=C3=A9baudeau?= To: Date: Sun, 25 Oct 2015 02:59:39 +0200 Message-Id: <1445734779-7212-13-git-send-email-benoit.thebaudeau.dev@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1445734779-7212-1-git-send-email-benoit.thebaudeau.dev@gmail.com> References: <1445734779-7212-1-git-send-email-benoit.thebaudeau.dev@gmail.com> MIME-Version: 1.0 Cc: Thomas Petazzoni , =?UTF-8?q?Beno=C3=AEt=20Th=C3=A9baudeau?= Subject: [Buildroot] [PATCH v3 13/13] package/dhcp: systemd: add dhcrelay service file 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: , Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Add a systemd service file to start dhcrelay. The network interfaces to listen on must be set via the variable IFCMD in /etc/default/dhcrelay, e.g.: IFCMD="-i eth0 -i eth1" The "upstream" servers to pass the queries along to must be set via the variable SERVERS in the same file, e.g.: SERVERS="server0 server1" Extra command line options can be set via the variable OPTIONS in the same file. Signed-off-by: Benoît Thébaudeau --- Changes v2 -> v3: new patch. --- package/dhcp/dhcp.mk | 45 ++++++++++++++++++++++++++++--------------- package/dhcp/dhcrelay.service | 13 +++++++++++++ 2 files changed, 42 insertions(+), 16 deletions(-) create mode 100644 package/dhcp/dhcrelay.service diff --git a/package/dhcp/dhcp.mk b/package/dhcp/dhcp.mk index 3aa1577..4ba302b 100644 --- a/package/dhcp/dhcp.mk +++ b/package/dhcp/dhcp.mk @@ -37,6 +37,23 @@ define DHCP_INSTALL_SERVER $(INSTALL) -m 0644 -D package/dhcp/dhcpd.conf \ $(TARGET_DIR)/etc/dhcp/dhcpd.conf endef + +define DHCP_INSTALL_SERVER_INIT_SYSTEMD + $(INSTALL) -D -m 644 package/dhcp/dhcpd.service \ + $(TARGET_DIR)/usr/lib/systemd/system/dhcpd.service + + mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants + + ln -sf ../../../../usr/lib/systemd/system/dhcpd.service \ + $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/dhcpd.service + + echo "d /var/lib/dhcp 0755 - - - -" > \ + $(TARGET_DIR)/usr/lib/tmpfiles.d/dhcpd.conf + echo "f /var/lib/dhcp/dhcpd.leases - - - - -" >> \ + $(TARGET_DIR)/usr/lib/tmpfiles.d/dhcpd.conf + echo "f /var/lib/dhcp/dhcpd6.leases - - - - -" >> \ + $(TARGET_DIR)/usr/lib/tmpfiles.d/dhcpd.conf +endef endif ifeq ($(BR2_PACKAGE_DHCP_RELAY),y) @@ -46,6 +63,16 @@ define DHCP_INSTALL_RELAY $(INSTALL) -m 0755 -D $(DHCP_DIR)/relay/dhcrelay \ $(TARGET_DIR)/usr/sbin/dhcrelay endef + +define DHCP_INSTALL_RELAY_INIT_SYSTEMD + $(INSTALL) -D -m 644 package/dhcp/dhcrelay.service \ + $(TARGET_DIR)/usr/lib/systemd/system/dhcrelay.service + + mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants + + ln -sf ../../../../usr/lib/systemd/system/dhcrelay.service \ + $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/dhcrelay.service +endef endif ifeq ($(BR2_PACKAGE_DHCP_CLIENT),y) @@ -69,24 +96,10 @@ define DHCP_INSTALL_INIT_SYSV $(TARGET_DIR)/etc/init.d/S80dhcp-relay endef -ifeq ($(BR2_PACKAGE_DHCP_SERVER),y) define DHCP_INSTALL_INIT_SYSTEMD - $(INSTALL) -D -m 644 package/dhcp/dhcpd.service \ - $(TARGET_DIR)/usr/lib/systemd/system/dhcpd.service - - mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants - - ln -sf ../../../../usr/lib/systemd/system/dhcpd.service \ - $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/dhcpd.service - - echo "d /var/lib/dhcp 0755 - - - -" > \ - $(TARGET_DIR)/usr/lib/tmpfiles.d/dhcpd.conf - echo "f /var/lib/dhcp/dhcpd.leases - - - - -" >> \ - $(TARGET_DIR)/usr/lib/tmpfiles.d/dhcpd.conf - echo "f /var/lib/dhcp/dhcpd6.leases - - - - -" >> \ - $(TARGET_DIR)/usr/lib/tmpfiles.d/dhcpd.conf + $(DHCP_INSTALL_SERVER_INIT_SYSTEMD) + $(DHCP_INSTALL_RELAY_INIT_SYSTEMD) endef -endif define DHCP_INSTALL_TARGET_CMDS $(DHCP_INSTALL_RELAY) diff --git a/package/dhcp/dhcrelay.service b/package/dhcp/dhcrelay.service new file mode 100644 index 0000000..5a1410e --- /dev/null +++ b/package/dhcp/dhcrelay.service @@ -0,0 +1,13 @@ +[Unit] +Description=DHCP relay +After=network.target + +[Service] +Type=forking +PIDFile=/run/dhcrelay.pid +ExecStart=/usr/sbin/dhcrelay -q -pf /run/dhcrelay.pid $OPTIONS $IFCMD $SERVERS +KillSignal=SIGINT +EnvironmentFile=/etc/default/dhcrelay + +[Install] +WantedBy=multi-user.target