[Buildroot] [PATCH v4 1/2] package/iwd: add basic configuration file

Thomas Petazzoni thomas.petazzoni at bootlin.com
Wed Jun 17 19:59:33 UTC 2020


On Tue, 16 Jun 2020 08:34:30 +0200
Peter Seiderer <ps.report at gmx.net> wrote:

> Add basic /etc/iwd/main.conf configuration file to enable
> network configuration (use built-in dhcp client).
> 
> For the non systemd-resolved case select the openresolv package
> to fulfill the iwd resolvconf requirement (and adjust the
> configuration file accordingly).
> 
> Signed-off-by: Peter Seiderer <ps.report at gmx.net>

I've applied, but I found things a bit too complicated, so I did some
simplifications.

> +define IWD_INSTALL_CONFIG_FILE
> +	mkdir -p $(TARGET_DIR)/etc/iwd

This is not needed if you use the -D option in $(INSTALL)

> +	$(INSTALL) -m 644 package/iwd/main.conf $(TARGET_DIR)/etc/iwd/main.conf
> +endef
> +
> +ifeq ($(BR2_PACKAGE_SYSTEMD_RESOLVED),y)
> +define IWD_CONFIG_FILE_NAME_RESOLV_SERVICE
> +	printf "[Network]\nNameResolvingService=systemd\n" \
> +		>> $(TARGET_DIR)/etc/iwd/main.conf
> +endef
> +else
> +define IWD_CONFIG_FILE_NAME_RESOLV_SERVICE
> +	printf "[Network]\nNameResolvingService=resolvconf\n" \
> +		>> $(TARGET_DIR)/etc/iwd/main.conf
> +endef
> +endif
> +
> +IWD_POST_INSTALL_TARGET_HOOKS += \
> +	IWD_INSTALL_CONFIG_FILE \
> +	IWD_CONFIG_FILE_NAME_RESOLV_SERVICE

This felt too complicated. I simplified like this:

ifeq ($(BR2_PACKAGE_SYSTEMD_RESOLVED),y)
IWD_RESOLV_SERVICE = systemd
else
IWD_RESOLV_SERVICE = resolvconf
endif

define IWD_INSTALL_CONFIG_FILE
	$(INSTALL) -D -m 644 package/iwd/main.conf $(TARGET_DIR)/etc/iwd/main.conf
	$(SED) 's,__RESOLV_SERVICE__,$(IWD_RESOLV_SERVICE),' $(TARGET_DIR)/etc/iwd/main.conf
endef

IWD_POST_INSTALL_TARGET_HOOKS += IWD_INSTALL_CONFIG_FILE

with of course main.conf containing:

# use built-in dhcp client
[General]
EnableNetworkConfiguration=true
[Network]
NameResolvingService=__RESOLV_SERVICE__

Applied with those changes. Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com



More information about the buildroot mailing list