Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Yann E. MORIN <yann.morin.1998@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] dhcp: add systemd service file
Date: Sun, 21 Sep 2014 22:44:45 +0200	[thread overview]
Message-ID: <20140921204445.GB28325@free.fr> (raw)
In-Reply-To: <1410815083-11776-1-git-send-email-eric.le.bihan.dev@free.fr>

Eric, All,

On 2014-09-15 23:04 +0200, Eric Le Bihan spake thusly:
> Add a systemd service file to start dhcpd.
> 
> The network interfaces to listen on can be set via the variable
> INTERFACES in /etc/default/dhcpd.conf. Example:
> 
>   INTERFACES="eth0 eth1"
> 
> Also install a tmpfiles.d file to create /var/lib/dhcp/dhcpd.leases
> (needed at dhcpd start-up).
> 
> Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
> ---
>  package/dhcp/dhcp.mk       | 15 +++++++++++++++
>  package/dhcp/dhcpd.service | 13 +++++++++++++
>  2 files changed, 28 insertions(+)
>  create mode 100644 package/dhcp/dhcpd.service
> 
> diff --git a/package/dhcp/dhcp.mk b/package/dhcp/dhcp.mk
> index 9251185..1b914a8 100644
> --- a/package/dhcp/dhcp.mk
> +++ b/package/dhcp/dhcp.mk
> @@ -74,6 +74,21 @@ define DHCP_INSTALL_INIT_SYSV
>  		$(TARGET_DIR)/etc/init.d/S80dhcp-relay
>  endef
>  
> +define DHCP_INSTALL_INIT_SYSTEMD
> +	$(INSTALL) -D -m 644 package/dhcp/dhcpd.service \
> +		$(TARGET_DIR)/lib/systemd/system/dhcpd.service
> +
> +	mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
> +
> +	ln -sf ../../../../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

I'm not sure to understand those two. Are they needed on the target?

They suspiciously look like our 'makedev' syntax. Does systemd recognise
this too?

Regards,
Yann E. MORIN.

> +endef
> +
>  define DHCP_INSTALL_TARGET_CMDS
>  	$(DHCP_INSTALL_RELAY)
>  	$(DHCP_INSTALL_SERVER)
> diff --git a/package/dhcp/dhcpd.service b/package/dhcp/dhcpd.service
> new file mode 100644
> index 0000000..7b265cb
> --- /dev/null
> +++ b/package/dhcp/dhcpd.service
> @@ -0,0 +1,13 @@
> +[Unit]
> +Description=DHCP server
> +After=network.target
> +
> +[Service]
> +Type=forking
> +PIDFile=/run/dhcpd.pid
> +ExecStart=/usr/sbin/dhcpd -q -pf /run/dhcpd.pid $INTERFACES
> +KillSignal=SIGINT
> +EnvironmentFile=/etc/default/dhcpd.conf
> +
> +[Install]
> +WantedBy=multi-user.target
> -- 
> 1.9.3
> 
> _______________________________________________
> 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.  |
'------------------------------^-------^------------------^--------------------'

  reply	other threads:[~2014-09-21 20:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-15 21:04 [Buildroot] [PATCH] dhcp: add systemd service file Eric Le Bihan
2014-09-21 20:44 ` Yann E. MORIN [this message]
2014-09-22 10:52   ` Eric Le Bihan
2014-09-22 17:34     ` Yann E. MORIN
2014-10-27 12:04       ` Eric Le Bihan
2014-10-26 21:13 ` Thomas Petazzoni
2014-10-27 17:14   ` Eric Le Bihan
2014-10-29 22:08 ` Thomas Petazzoni
  -- strict thread matches above, loose matches on Subject: below --
2014-09-15 20:38 Eric Le Bihan
2014-09-15 21:08 ` Eric Le Bihan

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=20140921204445.GB28325@free.fr \
    --to=yann.morin.1998@free.fr \
    --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