From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] [RFC: PATCH 1/3] systemd: configure DHCP via networkd
Date: Sat, 17 Sep 2016 14:16:48 +0200 [thread overview]
Message-ID: <20160917141648.792a5754@free-electrons.com> (raw)
In-Reply-To: <1474113519-24713-2-git-send-email-eric.le.bihan.dev@free.fr>
Hello,
(Adding in Cc more people interested in systemd)
On Sat, 17 Sep 2016 13:58:37 +0200, Eric Le Bihan wrote:
> If systemd-networkd is enabled and $BR2_SYSTEM_DHCP is set, then create
> a .network file to configure the selected network interface via DHCP.
>
> Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
The idea looks good to me, so unless the people interested in systemd
raise their voice, I'm going to apply something like this. However, I
have one suggestion below.
> ---
> package/systemd/systemd.mk | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk
> index fb07819..5062750 100644
> --- a/package/systemd/systemd.mk
> +++ b/package/systemd/systemd.mk
> @@ -275,6 +275,18 @@ define SYSTEMD_INSTALL_RESOLVCONF_HOOK
> ln -sf ../run/systemd/resolve/resolv.conf \
> $(TARGET_DIR)/etc/resolv.conf
> endef
> +SYSTEMD_NETWORK_DHCP_IFACE = $(call qstrip,$(BR2_SYSTEM_DHCP))
> +ifneq ($(SYSTEMD_NETWORK_DHCP_IFACE),)
> +define SYSTEMD_INSTALL_NETWORK_CONFS
> + ( \
> + echo "[Match]"; \
> + echo "Name=$(SYSTEMD_NETWORK_DHCP_IFACE)"; \
> + echo; \
> + echo "[Network]"; \
> + echo "DHCP=ipv4"; \
> + ) > $(TARGET_DIR)/etc/systemd/network/dhcp.network
> +endef
I find having all those echo lines in the middle of the .mk file not
very pretty. What about instead:
package/systemd/dhcp.network containing:
[Match]
Name=SYSTEMD_NETWORK_DHCP_IFACE
[Network]
DHCP=ipv4
package/systemd/systemd.mk doing:
define SYSTEMD_INSTALL_NETWORK_CONF
sed s/SYSTEMD_NETWORK_DHCP_IFACE/$(SYSTEMD_NETWORK_DHCP_IFACE)/ \
package/systemd/dhcp.network > \
$(TARGET_DIR)/etc/systemd/network/dhcp.network
endef
Thanks,
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
next prev parent reply other threads:[~2016-09-17 12:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-17 11:58 [Buildroot] [RFC: PATCH 0/3] DHCP configuration via networkd Eric Le Bihan
2016-09-17 11:58 ` [Buildroot] [RFC: PATCH 1/3] systemd: configure DHCP " Eric Le Bihan
2016-09-17 12:16 ` Thomas Petazzoni [this message]
2017-02-06 17:49 ` Thomas Petazzoni
2016-09-17 11:58 ` [Buildroot] [RFC: PATCH 2/3] system: allow auto net configuration with networkd Eric Le Bihan
2016-09-17 12:17 ` Thomas Petazzoni
2017-02-06 17:50 ` Thomas Petazzoni
2016-09-17 11:58 ` [Buildroot] [RFC: PATCH 3/3] system: enable predictable net interface names Eric Le Bihan
2016-09-17 12:20 ` Thomas Petazzoni
2017-02-06 20:07 ` Peter Korsgaard
2017-03-10 21:57 ` 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=20160917141648.792a5754@free-electrons.com \
--to=thomas.petazzoni@free-electrons.com \
--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