Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v2] Allow a single DHCP configuration via the system configuration submenu
Date: Fri, 2 Jan 2015 16:24:55 +0100	[thread overview]
Message-ID: <20150102162455.0198a79e@free-electrons.com> (raw)
In-Reply-To: <1420211162-9189-1-git-send-email-jeremy.rosen@openwide.fr>

Dear J?r?my Rosen,

On Fri,  2 Jan 2015 16:06:02 +0100, J?r?my Rosen wrote:

> +define SIMPLE_NETWORK
> +	mkdir -p $(TARGET_DIR)/etc/network/
> +
> +	echo "# interface file auto-generated by buildroot" >  $(TARGET_DIR)/etc/network/interfaces
> +	echo                                                >> $(TARGET_DIR)/etc/network/interfaces
> +	echo "auto lo"                                      >> $(TARGET_DIR)/etc/network/interfaces
> +	echo "iface lo inet loopback"                       >> $(TARGET_DIR)/etc/network/interfaces
> +	echo                                                >> $(TARGET_DIR)/etc/network/interfaces
> +
> +	if [ -n "$(BR2_SIMPLE_DHCP)" ] ; then \
> +		echo "auto $(BR2_SIMPLE_DHCP)"              >> $(TARGET_DIR)/etc/network/interfaces ; \
> +		echo "iface $(BR2_SIMPLE_DHCP) inet dhcp"   >> $(TARGET_DIR)/etc/network/interfaces ; \
> +	fi

Can we use make instead of the shell for this condition? Also,
BR_SIMPLE_DHCP has some double quotes, so you probably want to use
qstrip. Something like:

define SET_NETWORK_LOCALHOST
	echo "# interface file auto-generated by buildroot" >  $(TARGET_DIR)/etc/network/interfaces
	echo                                                >> $(TARGET_DIR)/etc/network/interfaces
	echo "auto lo"                                      >> $(TARGET_DIR)/etc/network/interfaces
	echo "iface lo inet loopback"                       >> $(TARGET_DIR)/etc/network/interfaces
	echo                                                >> $(TARGET_DIR)/etc/network/interfaces
endef

NETWORK_DHCP_IFACE = $(call qstrip,$(BR2_SIMPLE_DHCP))

ifneq ($(NETWORK_DHCP_IFACE),)
define SET_NETWORK_DHCP
	echo "auto $(NETWORK_DHCP_IFACE)" >> $(TARGET_DIR)/etc/network/interfaces
	echo "iface $(NETWORK_DHCP_IFACE) inet dhcp" >> $(TARGET_DIR)/etc/network/interfaces
endef
endif

define SET_NETWORK
	mkdir -p $(TARGET_DIR)/etc/network/
	$(SET_NETWORK_LOCALHOST)
	$(SET_NETWORK_DHCP)
endef

TARGET_FINALIZE_HOOKS += SET_NETWORK

It would be good to avoid the repeated redirects to
$(TARGET_DIR)/etc/network/interfaces, but I don't immediately see an
elegant way of doing that.

Thanks,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

      reply	other threads:[~2015-01-02 15:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-02 15:06 [Buildroot] [PATCH v2] Allow a single DHCP configuration via the system configuration submenu Jérémy Rosen
2015-01-02 15:24 ` Thomas Petazzoni [this message]

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=20150102162455.0198a79e@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