Skip to contentSkip to conversation

package/iwd: needs dbus (runtime)

PATCH New Peter Seiderer 3 participants 18 messages Jun 12, 2020 – Jul 13, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 package/iwd: needs dbus (runtime)

Fixes (on startup):

  $ usr/libexec/iwd
  Wireless daemon version 1.7
  Failed to initialize D-Bus

---
Note:
- for an alternative iwd without dbus demand take a lookt at
https://github.com/dylanaraps/eiwd

---
 package/iwd/Config.in | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
package/iwd/Config.in +6 -2
index eff24a8599..4501017630 100644
@@ -1,16 +1,20 @@
 config BR2_PACKAGE_IWD
 	bool "iwd"
+	depends on BR2_TOOLCHAIN_HAS_THREADS # dbus
+	depends on BR2_USE_MMU # dbus
 	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # ell
 	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_12 # ell
 	depends on !BR2_STATIC_LIBS # ell
 	depends on BR2_USE_WCHAR # ell
+	select BR2_PACKAGE_DBUS # runtime
 	select BR2_PACKAGE_ELL
 	help
 	  iNet Wireless daemon (iwd)
 
 	  https://iwd.wiki.kernel.org/
 
-comment "iwd needs a toolchain w/ dynamic library, wchar, headers >= 4.12"
+comment "iwd needs a toolchain w/ threads, dynamic library, wchar, headers >= 4.12"
+	depends on BR2_USE_MMU # dbus
 	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # ell
-	depends on BR2_STATIC_LIBS || !BR2_USE_WCHAR || \
+	depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS || !BR2_USE_WCHAR || \
 		!BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_12
Signature · 1 line
2.26.2
#1 lore raw

PATCH 2/3 package/iwd: add basic configuration file

Add basic /etc/iwd/main.conf configuration file to enable network configuration (use built-in dhcp client).

For the non systemd case select the openresolv package to fulfill the iwd resolvconf requirement.

---
 package/iwd/Config.in |  1 +
 package/iwd/iwd.mk    | 19 +++++++++++++++++++
 package/iwd/main.conf |  3 +++
 3 files changed, 23 insertions(+)
 create mode 100644 package/iwd/main.conf
package/iwd/Config.in +1 -0
index 4501017630..6d42cac35c 100644
@@ -8,6 +8,7 @@ config BR2_PACKAGE_IWD
 	depends on BR2_USE_WCHAR # ell
 	select BR2_PACKAGE_DBUS # runtime
 	select BR2_PACKAGE_ELL
+	select BR2_PACKAGE_OPENRESOLV if !BR2_INIT_SYSTEMD
 	help
 	  iNet Wireless daemon (iwd)
 
package/iwd/iwd.mk +19 -0
index 32ff175933..d105d3b128 100644
@@ -46,4 +46,23 @@ else
 IWD_CONF_OPTS += --disable-systemd-service
 endif
 
+define IWD_INSTALL_CONFIG_FILE
+	mkdir -p $(TARGET_DIR)/etc/iwd
+	$(INSTALL) -m 644 package/iwd/main.conf $(TARGET_DIR)/etc/iwd/main.conf
+endef
+
+ifeq ($(BR2_INIT_SYSTEMD),y)
+define IWD_CONFIG_FILE_NAME_RESOLV_SERVICE
+	echo -e "[Network]\nNameResolvingService=systemd" >> $(TARGET_DIR)/etc/iwd/main.conf
+endef
+else
+define IWD_CONFIG_FILE_NAME_RESOLV_SERVICE
+	echo -e "[Network]\nNameResolvingService=resolvconf" >> $(TARGET_DIR)/etc/iwd/main.conf
+endef
+endif
+
+IWD_POST_INSTALL_TARGET_HOOKS += \
+	IWD_INSTALL_CONFIG_FILE \
+	IWD_CONFIG_FILE_NAME_RESOLV_SERVICE
+
 $(eval $(autotools-package))
package/iwd/main.conf new file +3 -0
new file mode 100644
index 0000000000..c26a50d302
@@ -0,0 +1,3 @@
+# use built-in dhcp client
+[General]
+EnableNetworkConfiguration=true
Signature · 1 line
2.26.2
#2 lore raw

PATCH 2/3 package/iwd: add basic configuration file

Peter, All,

On 2020-06-13 01:24 +0200, Peter Seiderer spake thusly:

Quoted 19 lines

Add basic /etc/iwd/main.conf configuration file to enable network configuration (use built-in dhcp client).

For the non systemd case select the openresolv package to fulfill the iwd resolvconf requirement.

---
 package/iwd/Config.in |  1 +
 package/iwd/iwd.mk    | 19 +++++++++++++++++++
 package/iwd/main.conf |  3 +++
 3 files changed, 23 insertions(+)
 create mode 100644 package/iwd/main.conf
package/iwd/Config.in +0 -0
index 4501017630..6d42cac35c 100644

package/iwd/Config.in config BR2_PACKAGE_IWD · line 11

Quoted 4 lines
package/iwd/Config.in +1 -0
@@ -8,6 +8,7 @@ config BR2_PACKAGE_IWD
 	depends on BR2_USE_WCHAR # ell
 	select BR2_PACKAGE_DBUS # runtime
 	select BR2_PACKAGE_ELL
+	select BR2_PACKAGE_OPENRESOLV if !BR2_INIT_SYSTEMD

I think this is preferable to use BR2_PACKAGE_SYSTEMD as the dependency, rather than BR2_INIT_SYSTEMD, even if the two are currently tightly intertwinned.

Quoted 9 lines
package/iwd/Config.in +0 -0
 	help
 	  iNet Wireless daemon (iwd)
 
package/iwd/iwd.mk +0 -0
index 32ff175933..d105d3b128 100644
@@ -46,4 +46,23 @@ else
 IWD_CONF_OPTS += --disable-systemd-service

package/iwd/iwd.mk else · line 56

Quoted 10 lines
package/iwd/iwd.mk +8 -0
 endif
 
+define IWD_INSTALL_CONFIG_FILE
+	mkdir -p $(TARGET_DIR)/etc/iwd
+	$(INSTALL) -m 644 package/iwd/main.conf $(TARGET_DIR)/etc/iwd/main.conf
+endef
+
+ifeq ($(BR2_INIT_SYSTEMD),y)
+define IWD_CONFIG_FILE_NAME_RESOLV_SERVICE
+	echo -e "[Network]\nNameResolvingService=systemd" >> $(TARGET_DIR)/etc/iwd/main.conf

Do not use 'echo -e' but use printf. Also the line is too long:

    printf '[Network]\nNameResolvingService=systemd\n' \
        >>$(TARGET_DIR)/etc/iwd/main.conf

However, this will not be working nicely on rebuilds, as it will keep appending this to the file. See below for a better approach (I think):

Also, the condiotion on BR2_INIT_SYSTEMD is already handled by the infra, by using the appropriate INIT_INSTALL hooks:

    define IWD_INSTALL_INIT_SYSV
        sed -r -e '$s/$/\n[Network]\nNameResolvingService=resolvconf/' \
            $(IWD_PKGDIR)main.conf \
            >$(TARGET_DIR)/etc/iwd/main.conf
    endef

    define IWD_INSTALL_INIT_SYSTEMD
        sed -r -e '$s/$/\n[Network]\nNameResolvingService=systemd/' \
            $(IWD_PKGDIR)main.conf \
            >$(TARGET_DIR)/etc/iwd/main.conf
    endef

package/iwd/iwd.mk else · line 66

Quoted 10 lines
package/iwd/iwd.mk +10 -0
+endef
+else
+define IWD_CONFIG_FILE_NAME_RESOLV_SERVICE
+	echo -e "[Network]\nNameResolvingService=resolvconf" >> $(TARGET_DIR)/etc/iwd/main.conf
+endef
+endif
+
+IWD_POST_INSTALL_TARGET_HOOKS += \
+	IWD_INSTALL_CONFIG_FILE \
+	IWD_CONFIG_FILE_NAME_RESOLV_SERVICE

And thus those post-install hooks are not longer required.

Regards,
Yann E. MORIN.

Quoted 17 lines
package/iwd/iwd.mk +0 -0
 $(eval $(autotools-package))
package/iwd/main.conf new file +3 -0
new file mode 100644
index 0000000000..c26a50d302
@@ -0,0 +1,3 @@
+# use built-in dhcp client
+[General]
+EnableNetworkConfiguration=true
Signature · 6 lines
2.26.2

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#3 lore raw

PATCH 2/3 package/iwd: add basic configuration file

Hello Yann,

Quoted 17 lines · Yann E. MORIN

Peter, All,

On 2020-06-13 01:24 +0200, Peter Seiderer spake thusly:

Quoted 14 lines

Add basic /etc/iwd/main.conf configuration file to enable network configuration (use built-in dhcp client).

For the non systemd case select the openresolv package to fulfill the iwd resolvconf requirement.

---
 package/iwd/Config.in |  1 +
 package/iwd/iwd.mk    | 19 +++++++++++++++++++
 package/iwd/main.conf |  3 +++
 3 files changed, 23 insertions(+)
 create mode 100644 package/iwd/main.conf
Quoted 13 lines

package/iwd/Config.in config BR2_PACKAGE_IWD · line 11

Quoted 9 lines
package/iwd/Config.in +1 -0
index 4501017630..6d42cac35c 100644
@@ -8,6 +8,7 @@ config BR2_PACKAGE_IWD
 	depends on BR2_USE_WCHAR # ell
 	select BR2_PACKAGE_DBUS # runtime
 	select BR2_PACKAGE_ELL
+	select BR2_PACKAGE_OPENRESOLV if !BR2_INIT_SYSTEMD

I think this is preferable to use BR2_PACKAGE_SYSTEMD as the dependency, rather than BR2_INIT_SYSTEMD, even if the two are currently tightly intertwinned.

I would prefer the !BR2_INIT_SYSTEMD as I believe iwd needs an service of the running systemd (or an alternative implementation) and not a feature/library of the systemd package (only runtime not a compile time dependency)...

Quoted 23 lines
Quoted 10 lines
package/iwd/Config.in +0 -0
 	help
 	  iNet Wireless daemon (iwd)
 
package/iwd/iwd.mk +0 -0
index 32ff175933..d105d3b128 100644
@@ -46,4 +46,23 @@ else
 IWD_CONF_OPTS += --disable-systemd-service

package/iwd/iwd.mk else · line 56

Quoted 10 lines
package/iwd/iwd.mk +8 -0
 endif
 
+define IWD_INSTALL_CONFIG_FILE
+	mkdir -p $(TARGET_DIR)/etc/iwd
+	$(INSTALL) -m 644 package/iwd/main.conf $(TARGET_DIR)/etc/iwd/main.conf
+endef
+
+ifeq ($(BR2_INIT_SYSTEMD),y)
+define IWD_CONFIG_FILE_NAME_RESOLV_SERVICE
+	echo -e "[Network]\nNameResolvingService=systemd" >> $(TARGET_DIR)/etc/iwd/main.conf

Do not use 'echo -e' but use printf. Also the line is too long:

Quoted 5 lines
    printf '[Network]\nNameResolvingService=systemd\n' \
        >>$(TARGET_DIR)/etc/iwd/main.conf

However, this will not be working nicely on rebuilds, as it will keep appending this to the file. See below for a better approach (I think):

On re-builds the common IWD_INSTALL_CONFIG_FILE (copy plain main.conf will be executed first, so no problem...

Quoted 9 lines

Also, the condiotion on BR2_INIT_SYSTEMD is already handled by the infra, by using the appropriate INIT_INSTALL hooks:

    define IWD_INSTALL_INIT_SYSV
        sed -r -e '$s/$/\n[Network]\nNameResolvingService=resolvconf/' \
            $(IWD_PKGDIR)main.conf \
            >$(TARGET_DIR)/etc/iwd/main.conf
    endef

Does not work, gives:

sed: -e expression #1, char 46: missing command

And did not figure out what would be the right sed exprecssion (the leading $ seems to be wrong, but without another error occures)...

Quoted 6 lines
    define IWD_INSTALL_INIT_SYSTEMD
        sed -r -e '$s/$/\n[Network]\nNameResolvingService=systemd/' \
            $(IWD_PKGDIR)main.conf \
            >$(TARGET_DIR)/etc/iwd/main.conf
    endef

Nice shortcut, but misses the enable-the-one-option-for-systemd and enable-the-other-option-for-all-other-init-systems...

Quoted 13 lines

package/iwd/iwd.mk else · line 66

Quoted 11 lines
package/iwd/iwd.mk +10 -0
+endef
+else
+define IWD_CONFIG_FILE_NAME_RESOLV_SERVICE
+	echo -e "[Network]\nNameResolvingService=resolvconf" >> $(TARGET_DIR)/etc/iwd/main.conf
+endef
+endif
+
+IWD_POST_INSTALL_TARGET_HOOKS += \
+	IWD_INSTALL_CONFIG_FILE \
+	IWD_CONFIG_FILE_NAME_RESOLV_SERVICE

And thus those post-install hooks are not longer required.

Nice, but see downside above...

Thanks for review,
Peter

Quoted 22 lines

Regards,
Yann E. MORIN.

Quoted 17 lines
package/iwd/iwd.mk +0 -0
 $(eval $(autotools-package))
package/iwd/main.conf new file +3 -1
new file mode 100644
index 0000000000..c26a50d302
@@ -0,0 +1,3 @@
+# use built-in dhcp client
+[General]
+EnableNetworkConfiguration=true
--

2.26.2

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#4 lore raw

PATCH 2/3 package/iwd: add basic configuration file

On 2020-06-14 21:07 +0200, Peter Seiderer spake thusly:

Quoted 2 lines · Yann E. MORIN
Quoted 1 line

On 2020-06-13 01:24 +0200, Peter Seiderer spake thusly:

[--SNIP--]

Quoted 8 lines
Quoted 4 lines

package/iwd/Config.in config BR2_PACKAGE_IWD · line 11

Quoted 1 line
package/iwd/Config.in +1 -0
+	select BR2_PACKAGE_OPENRESOLV if !BR2_INIT_SYSTEMD

I think this is preferable to use BR2_PACKAGE_SYSTEMD as the dependency, rather than BR2_INIT_SYSTEMD, even if the two are currently tightly intertwinned.

I would prefer the !BR2_INIT_SYSTEMD as I believe iwd needs an service of the running systemd (or an alternative implementation) and not a feature/library of the systemd package (only runtime not a compile time dependency)...

I'm still not convinced...

What if one has:

BR2_INIT_SYSTEMD=y
# BR2_PACKAGE_SYSTEMD_RESOLVED is not set

Does systemd still provides resolv.conf?

I guess not. So in fact the dependency is really not about the init system. but about a package that provides resolv.conf. In which case it should be changed to:

select BR2_PACKAGE_OPENRESOLV if !BR2_PACKAGE_SYSTEMD_RESOLVED

Or did I miss something else?

[--SNIP--]

Quoted 3 lines
Quoted 3 lines

package/iwd/iwd.mk else · line 56

Quoted 3 lines
package/iwd/iwd.mk +3 -0
+ifeq ($(BR2_INIT_SYSTEMD),y)
+define IWD_CONFIG_FILE_NAME_RESOLV_SERVICE
+	echo -e "[Network]\nNameResolvingService=systemd" >> $(TARGET_DIR)/etc/iwd/main.conf

[--SNIP--]

Quoted 4 lines
Quoted 2 lines

However, this will not be working nicely on rebuilds, as it will keep appending this to the file. See below for a better approach (I think):

On re-builds the common IWD_INSTALL_CONFIG_FILE (copy plain main.conf will be executed first, so no problem...

Indeed, but still that's not obvious, as it splits the install of that one file in two places: a generic one, and a per-init-system one.

Quoted 9 lines
Quoted 8 lines

Also, the condiotion on BR2_INIT_SYSTEMD is already handled by the infra, by using the appropriate INIT_INSTALL hooks:

    define IWD_INSTALL_INIT_SYSV
        sed -r -e '$s/$/\n[Network]\nNameResolvingService=resolvconf/' \
            $(IWD_PKGDIR)main.conf \
            >$(TARGET_DIR)/etc/iwd/main.conf
    endef
Quoted 3 lines

Does not work, gives:

sed: -e expression #1, char 46: missing command

This is Makefile, I forgot to duplicate the $ signs when copy-pasting from my shell experiment...

Quoted 2 lines

And did not figure out what would be the right sed exprecssion (the leading $ seems to be wrong, but without another error occures)...

The leading $ means 'on the last line', so the replacement is only attemped on the last line.

Quoted 7 lines
Quoted 5 lines
    define IWD_INSTALL_INIT_SYSTEMD
        sed -r -e '$s/$/\n[Network]\nNameResolvingService=systemd/' \
            $(IWD_PKGDIR)main.conf \
            >$(TARGET_DIR)/etc/iwd/main.conf
    endef

Nice shortcut, but misses the enable-the-one-option-for-systemd and enable-the-other-option-for-all-other-init-systems...

Sorry, I don't follow you.

For systemd, only the IWD_INSTALL_INIT_SYSTEMD hook is run, and for the others, only the IWD_INSTALL_INIT_SYSV hook is run. And each does append a different NameResolvingService key, systemd in the first case, resolvconf in the second case.

Ah, there is *one* case where the file would not be copied and expanded with my proposal, when the user uses BR2_INIT_NONE. But this really is the user's reponsibility to catter for the requirements of their init system...

[--SNIP--]

Quoted 5 lines
Quoted 4 lines

package/iwd/iwd.mk else · line 66

Quoted 3 lines
package/iwd/iwd.mk +3 -0
+IWD_POST_INSTALL_TARGET_HOOKS += \
+	IWD_INSTALL_CONFIG_FILE \
+	IWD_CONFIG_FILE_NAME_RESOLV_SERVICE

And thus those post-install hooks are not longer required.

Nice, but see downside above...

Except for BR2_INIT_NONE, I don't see the problem...

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#5 lore raw

PATCH 2/3 package/iwd: add basic configuration file

Hello Yann,

Quoted 20 lines · Yann E. MORIN

On 2020-06-14 21:07 +0200, Peter Seiderer spake thusly:

Quoted 2 lines · Yann E. MORIN
Quoted 1 line

On 2020-06-13 01:24 +0200, Peter Seiderer spake thusly:

[--SNIP--]

Quoted 8 lines
Quoted 4 lines

package/iwd/Config.in config BR2_PACKAGE_IWD · line 11

Quoted 1 line
package/iwd/Config.in +1 -0
+	select BR2_PACKAGE_OPENRESOLV if !BR2_INIT_SYSTEMD

I think this is preferable to use BR2_PACKAGE_SYSTEMD as the dependency, rather than BR2_INIT_SYSTEMD, even if the two are currently tightly intertwinned.

I would prefer the !BR2_INIT_SYSTEMD as I believe iwd needs an service of the running systemd (or an alternative implementation) and not a feature/library of the systemd package (only runtime not a compile time dependency)...

I'm still not convinced...

What if one has:

BR2_INIT_SYSTEMD=y
# BR2_PACKAGE_SYSTEMD_RESOLVED is not set

Quoted 7 lines

Does systemd still provides resolv.conf?

I guess not. So in fact the dependency is really not about the init system. but about a package that provides resolv.conf. In which case it should be changed to:

select BR2_PACKAGE_OPENRESOLV if !BR2_PACKAGE_SYSTEMD_RESOLVED

Or:
select BR2_PACKAGE_OPENRESOLV if !BR2_INIT_SYSTEMD select BR2_PACKAGE_SYSTEMD_RESOLVED if BR2_PACKAGE_SYSTEMD

Quoted 29 lines

Or did I miss something else?

[--SNIP--]

Quoted 3 lines
Quoted 3 lines

package/iwd/iwd.mk else · line 56

Quoted 3 lines
package/iwd/iwd.mk +3 -0
+ifeq ($(BR2_INIT_SYSTEMD),y)
+define IWD_CONFIG_FILE_NAME_RESOLV_SERVICE
+	echo -e "[Network]\nNameResolvingService=systemd" >> $(TARGET_DIR)/etc/iwd/main.conf

[--SNIP--]

Quoted 4 lines
Quoted 2 lines

However, this will not be working nicely on rebuilds, as it will keep appending this to the file. See below for a better approach (I think):

On re-builds the common IWD_INSTALL_CONFIG_FILE (copy plain main.conf will be executed first, so no problem...

Indeed, but still that's not obvious, as it splits the install of that one file in two places: a generic one, and a per-init-system one.

Quoted 9 lines
Quoted 8 lines

Also, the condiotion on BR2_INIT_SYSTEMD is already handled by the infra, by using the appropriate INIT_INSTALL hooks:

    define IWD_INSTALL_INIT_SYSV
        sed -r -e '$s/$/\n[Network]\nNameResolvingService=resolvconf/' \
            $(IWD_PKGDIR)main.conf \
            >$(TARGET_DIR)/etc/iwd/main.conf
    endef
Quoted 3 lines

Does not work, gives:

sed: -e expression #1, char 46: missing command

Quoted 8 lines

This is Makefile, I forgot to duplicate the $ signs when copy-pasting from my shell experiment...

Quoted 2 lines

And did not figure out what would be the right sed exprecssion (the leading $ seems to be wrong, but without another error occures)...

The leading $ means 'on the last line', so the replacement is only attemped on the last line.

Did not know this one, will test...

Quoted 16 lines
Quoted 8 lines
Quoted 6 lines
    define IWD_INSTALL_INIT_SYSTEMD
        sed -r -e '$s/$/\n[Network]\nNameResolvingService=systemd/' \
            $(IWD_PKGDIR)main.conf \
            >$(TARGET_DIR)/etc/iwd/main.conf
    endef

Nice shortcut, but misses the enable-the-one-option-for-systemd and enable-the-other-option-for-all-other-init-systems...

Sorry, I don't follow you.

For systemd, only the IWD_INSTALL_INIT_SYSTEMD hook is run, and for the others, only the IWD_INSTALL_INIT_SYSV hook is run. And each does append a different NameResolvingService key, systemd in the first case, resolvconf in the second case.

Quoted 4 lines

Ah, there is *one* case where the file would not be copied and expanded with my proposal, when the user uses BR2_INIT_NONE. But this really is the user's reponsibility to catter for the requirements of their init system...

And what is about the LIBFOO_INSTALL_INIT_OPENRC mentioned in [1]?

Regards,
Peter

[1] https://buildroot.org/downloads/manual/manual.html#_infrastructure_for_packages_with_specific_build_systems

Quoted 13 lines

[--SNIP--]

Quoted 5 lines
Quoted 4 lines

package/iwd/iwd.mk else · line 66

Quoted 3 lines
package/iwd/iwd.mk +3 -0
+IWD_POST_INSTALL_TARGET_HOOKS += \
+	IWD_INSTALL_CONFIG_FILE \
+	IWD_CONFIG_FILE_NAME_RESOLV_SERVICE

And thus those post-install hooks are not longer required.

Nice, but see downside above...

Except for BR2_INIT_NONE, I don't see the problem...

Regards,
Yann E. MORIN.

#6 lore raw

PATCH 2/3 package/iwd: add basic configuration file

Peter, All,

On 2020-06-14 23:28 +0200, Peter Seiderer spake thusly:

Quoted 4 lines · Yann E. MORIN
Quoted 3 lines

On 2020-06-14 21:07 +0200, Peter Seiderer spake thusly:

Quoted 2 lines · Yann E. MORIN
Quoted 1 line

package/iwd/Config.in config BR2_PACKAGE_IWD · line 11

Quoted 1 line
package/iwd/Config.in +1 -0
+	select BR2_PACKAGE_OPENRESOLV if !BR2_INIT_SYSTEMD

[--SNIP--]

Quoted 9 lines
Quoted 9 lines

I'm still not convinced...
What if one has:
BR2_INIT_SYSTEMD=y
# BR2_PACKAGE_SYSTEMD_RESOLVED is not set
Does systemd still provides resolv.conf?
I guess not. So in fact the dependency is really not about the init system. but about a package that provides resolv.conf. In which case it should be changed to:
select BR2_PACKAGE_OPENRESOLV if !BR2_PACKAGE_SYSTEMD_RESOLVED

Quoted 3 lines

Or:
select BR2_PACKAGE_OPENRESOLV if !BR2_INIT_SYSTEMD select BR2_PACKAGE_SYSTEMD_RESOLVED if BR2_PACKAGE_SYSTEMD

No sorry, that still does not make sense to me... :-(

For one, the conditions are not homogeneous: in one case you test against the init system, in the other you test against the package.

[--SNIP--]

Quoted 1 line

And what is about the LIBFOO_INSTALL_INIT_OPENRC mentioned in [1]?

Aha! If not specified, it defaults to using the sysv hook, quoting:

The only exception is when openrc is chosen as init system and LIBFOO_INSTALL_INIT_OPENRC has not been set, in such situation LIBFOO_INSTALL_INIT_SYSV will be called, since openrc supports sysv init scripts.

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#7 lore raw

PATCH 2/3 package/iwd: add basic configuration file

Hello Yann,

Quoted 20 lines · Yann E. MORIN

Peter, All,

On 2020-06-14 23:28 +0200, Peter Seiderer spake thusly:

Quoted 4 lines · Yann E. MORIN
Quoted 3 lines

On 2020-06-14 21:07 +0200, Peter Seiderer spake thusly:

Quoted 2 lines · Yann E. MORIN
Quoted 1 line

package/iwd/Config.in config BR2_PACKAGE_IWD · line 11

Quoted 1 line
package/iwd/Config.in +1 -0
+	select BR2_PACKAGE_OPENRESOLV if !BR2_INIT_SYSTEMD

[--SNIP--]

Quoted 12 lines
Quoted 9 lines

I'm still not convinced...
What if one has:
BR2_INIT_SYSTEMD=y
# BR2_PACKAGE_SYSTEMD_RESOLVED is not set
Does systemd still provides resolv.conf?
I guess not. So in fact the dependency is really not about the init system. but about a package that provides resolv.conf. In which case it should be changed to:
select BR2_PACKAGE_OPENRESOLV if !BR2_PACKAGE_SYSTEMD_RESOLVED

Or:

select BR2_PACKAGE_OPENRESOLV if !BR2_INIT_SYSTEMD

This one fixes it for all non-systemd init systems...

Quoted 1 line
Quoted 1 line

select BR2_PACKAGE_SYSTEMD_RESOLVED if BR2_PACKAGE_SYSTEMD

This one fixes it for systemd-init-system implemented with BR2_PACKAGE_SYSTEMD...

Quoted 8 lines

No sorry, that still does not make sense to me... :-(

For one, the conditions are not homogeneous: in one case you test against the init system, in the other you test against the package.

[--SNIP--]

Quoted 8 lines
Quoted 1 line

And what is about the LIBFOO_INSTALL_INIT_OPENRC mentioned in [1]?

Aha! If not specified, it defaults to using the sysv hook, quoting:

The only exception is when openrc is chosen as init system and LIBFOO_INSTALL_INIT_OPENRC has not been set, in such situation LIBFOO_INSTALL_INIT_SYSV will be called, since openrc supports sysv init scripts.

So, what do with the openrc-init case (for the config file)?

Regards,
Peter

Quoted 4 lines

Regards,
Yann E. MORIN.

#8 lore raw

PATCH 2/3 package/iwd: add basic configuration file

Peter, All,

On 2020-06-14 23:48 +0200, Peter Seiderer spake thusly:

Quoted 2 lines · Yann E. MORIN
Quoted 1 line

On 2020-06-14 23:28 +0200, Peter Seiderer spake thusly:

[--SNIP--]

Quoted 7 lines
Quoted 6 lines
Quoted 1 line

And what is about the LIBFOO_INSTALL_INIT_OPENRC mentioned in [1]?

Aha! If not specified, it defaults to using the sysv hook, quoting:
The only exception is when openrc is chosen as init system and LIBFOO_INSTALL_INIT_OPENRC has not been set, in such situation LIBFOO_INSTALL_INIT_SYSV will be called, since openrc supports sysv init scripts.

So, what do with the openrc-init case (for the config file)?

In the openrc case, you'd get to use openresolv, so the config file would be the same as for the sysv case. And since you are adding a startup script for sysv (in the followup patch), it will also be used for the openrc case.

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#9 lore raw

PATCH 2/3 package/iwd: add basic configuration file

Hello Yann,

Quoted 12 lines · Yann E. MORIN

Peter, All,

On 2020-06-14 23:48 +0200, Peter Seiderer spake thusly:

Quoted 2 lines · Yann E. MORIN
Quoted 1 line

On 2020-06-14 23:28 +0200, Peter Seiderer spake thusly:

[--SNIP--]

Quoted 6 lines
Quoted 6 lines
Quoted 1 line

And what is about the LIBFOO_INSTALL_INIT_OPENRC mentioned in [1]?

Aha! If not specified, it defaults to using the sysv hook, quoting:
The only exception is when openrc is chosen as init system and LIBFOO_INSTALL_INIT_OPENRC has not been set, in such situation LIBFOO_INSTALL_INIT_SYSV will be called, since openrc supports sysv init scripts.

Quoted 6 lines
Quoted 1 line

So, what do with the openrc-init case (for the config file)?

In the openrc case, you'd get to use openresolv, so the config file would be the same as for the sysv case. And since you are adding a startup script for sysv (in the followup patch), it will also be used for the openrc case.

But in case of LIBFOO_INSTALL_INIT_OPENRC no (additional) entry will be written to the config file...

Regards,
Peter

Quoted 4 lines

Regards,
Yann E. MORIN.

#10 lore raw

PATCH 2/3 package/iwd: add basic configuration file

Peter, All,

On 2020-06-15 20:09 +0200, Peter Seiderer spake thusly:

Quoted 13 lines · Yann E. MORIN
Quoted 12 lines

On 2020-06-14 23:48 +0200, Peter Seiderer spake thusly:

Quoted 2 lines · Yann E. MORIN
Quoted 1 line

On 2020-06-14 23:28 +0200, Peter Seiderer spake thusly:

[--SNIP--]

Quoted 7 lines
Quoted 6 lines
Quoted 1 line

And what is about the LIBFOO_INSTALL_INIT_OPENRC mentioned in [1]?

Aha! If not specified, it defaults to using the sysv hook, quoting:
The only exception is when openrc is chosen as init system and LIBFOO_INSTALL_INIT_OPENRC has not been set, in such situation LIBFOO_INSTALL_INIT_SYSV will be called, since openrc supports sysv init scripts.

So, what do with the openrc-init case (for the config file)?

Quoted 7 lines
Quoted 4 lines

In the openrc case, you'd get to use openresolv, so the config file would be the same as for the sysv case. And since you are adding a startup script for sysv (in the followup patch), it will also be used for the openrc case.

But in case of LIBFOO_INSTALL_INIT_OPENRC no (additional) entry will be written to the config file...

Not sure I followed you here... So let me clarify:

- when a user selects openrc as an init system, but LIBFOO_INSTALL_INIT_OPENRC is not defined, then LIBFOO_INSTALL_INIT_SYSV will be used instead.

So this should cover the case you mentioned earlier (quoting you from memory): "for systemd, iwd handles resolv.conf with systemd, for all other init systems, it handles it with openresolv" (at least, that was along those lines...).

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#11 lore raw

PATCH 2/3 package/iwd: add basic configuration file

In reply to Yann E. MORIN

Hello Yann,

On Sun, 14 Jun 2020 22:57:15 +0200, "Yann E. MORIN" <[email protected]> wrote:

[...]

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines

Also, the condiotion on BR2_INIT_SYSTEMD is already handled by the infra, by using the appropriate INIT_INSTALL hooks:

    define IWD_INSTALL_INIT_SYSV
        sed -r -e '$s/$/\n[Network]\nNameResolvingService=resolvconf/' \
            $(IWD_PKGDIR)main.conf \
            >$(TARGET_DIR)/etc/iwd/main.conf
    endef
Quoted 7 lines
Quoted 3 lines

Does not work, gives:

sed: -e expression #1, char 46: missing command

This is Makefile, I forgot to duplicate the $ signs when copy-pasting from my shell experiment...

O.k. thanks for explanation, the following works as expected:

        sed -r -e '$$s/$$/\n[Network]\nNameResolvingService=systemd/' \
                $(IWD_PKGDIR)main.conf > $(TARGET_DIR)/etc/iwd/main.conf

But nevertheless I would like to keep the split into copy of plain file and append of extra options (in case more options with different dependencies follow)...

Regards,
Peter

#12 lore raw

PATCH 2/3 package/iwd: add basic configuration file

Peter, All,

On 2020-06-15 20:41 +0200, Peter Seiderer spake thusly:

Quoted 3 lines

But nevertheless I would like to keep the split into copy of plain file and append of extra options (in case more options with different dependencies follow)...

... at which point we will be able to revisit it.

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#13 lore raw

PATCH 3/3 package/iwd: add sysv init script

In reply to Peter Seiderer
---
 package/iwd/S40iwd | 30 ++++++++++++++++++++++++++++++
 package/iwd/iwd.mk |  7 +++++++
 2 files changed, 37 insertions(+)
 create mode 100644 package/iwd/S40iwd
package/iwd/S40iwd new file +30 -0
new file mode 100644
index 0000000000..4a720b43c2
@@ -0,0 +1,30 @@
+#!/bin/sh
+#
+# Start iwd daemon
+#
+
+# Create needed directories.
+[ -d /tmp/iwd/hotspot ] || mkdir -p /tmp/iwd/hotspot
+
+case "$1" in
+    start)
+	printf "Starting iwd:"
+	/usr/libexec/iwd &
+	echo "OK"
+        ;;
+    stop)
+	printf "Stopping iwd:"
+	killall iwd
+	[ $? = 0 ] && echo "OK" || echo "FAIL"
+        ;;
+    restart|reload)
+        "$0" stop
+        "$0" start
+        ;;
+    *)
+        echo "Usage: $0 {start|stop|restart|reload}"
+	exit 1
+        ;;
+esac
+
+exit $?
package/iwd/iwd.mk +7 -0
index d105d3b128..285fef2fd8 100644
@@ -65,4 +65,11 @@ IWD_POST_INSTALL_TARGET_HOOKS += \
 	IWD_INSTALL_CONFIG_FILE \
 	IWD_CONFIG_FILE_NAME_RESOLV_SERVICE
 
+define IWD_INSTALL_INIT_SYSV
+	$(INSTALL) -m 0755 -D package/iwd/S40iwd \
+		$(TARGET_DIR)/etc/init.d/S40iwd
+	mkdir -p $(TARGET_DIR)/var/lib/iwd
+	ln -sf /tmp/iwd/hotspot $(TARGET_DIR)/var/lib/iwd/hotspot
+endef
+
 $(eval $(autotools-package))
Signature · 1 line
2.26.2
#14 lore raw

PATCH 3/3 package/iwd: add sysv init script

Peter, All,

On 2020-06-13 01:24 +0200, Peter Seiderer spake thusly:

Quoted 13 lines
---
 package/iwd/S40iwd | 30 ++++++++++++++++++++++++++++++
 package/iwd/iwd.mk |  7 +++++++
 2 files changed, 37 insertions(+)
 create mode 100644 package/iwd/S40iwd
package/iwd/S40iwd new file +0 -0
new file mode 100644
index 0000000000..4a720b43c2

package/iwd/S40iwd line 7

Quoted 7 lines
package/iwd/S40iwd new file +7 -0
@@ -0,0 +1,30 @@
+#!/bin/sh
+#
+# Start iwd daemon
+#
+
+# Create needed directories.
+[ -d /tmp/iwd/hotspot ] || mkdir -p /tmp/iwd/hotspot

No need to test-and-create, as mkdir -p does that well for you already.

Is that script just about acting as a hotspot, then?

package/iwd/S40iwd line 13

Quoted 5 lines
package/iwd/S40iwd new file +5 -0
+case "$1" in
+    start)
+	printf "Starting iwd:"
+	/usr/libexec/iwd &
+	echo "OK"

This script has a mix of leading spaces and TABs.

Don't mix (use spaces please! ;-] ).

package/iwd/S40iwd line 17

Quoted 4 lines
package/iwd/S40iwd new file +4 -0
+        ;;
+    stop)
+	printf "Stopping iwd:"
+	killall iwd

Can't we use start-stop-daemon instead? See package/busybox/S01syslogd as a template.

Quoted 36 lines
package/iwd/S40iwd new file +13 -0
+	[ $? = 0 ] && echo "OK" || echo "FAIL"
+        ;;
+    restart|reload)
+        "$0" stop
+        "$0" start
+        ;;
+    *)
+        echo "Usage: $0 {start|stop|restart|reload}"
+	exit 1
+        ;;
+esac
+
+exit $?
package/iwd/iwd.mk +7 -0
index d105d3b128..285fef2fd8 100644
@@ -65,4 +65,11 @@ IWD_POST_INSTALL_TARGET_HOOKS += \
 	IWD_INSTALL_CONFIG_FILE \
 	IWD_CONFIG_FILE_NAME_RESOLV_SERVICE
 
+define IWD_INSTALL_INIT_SYSV
+	$(INSTALL) -m 0755 -D package/iwd/S40iwd \
+		$(TARGET_DIR)/etc/init.d/S40iwd
+	mkdir -p $(TARGET_DIR)/var/lib/iwd
+	ln -sf /tmp/iwd/hotspot $(TARGET_DIR)/var/lib/iwd/hotspot
+endef
+
 $(eval $(autotools-package))
Signature · 6 lines
2.26.2

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#15 lore raw

PATCH 3/3 package/iwd: add sysv init script

Hello Yann,

Quoted 10 lines · Yann E. MORIN

Peter, All,

On 2020-06-13 01:24 +0200, Peter Seiderer spake thusly:

Quoted 7 lines
---
 package/iwd/S40iwd | 30 ++++++++++++++++++++++++++++++
 package/iwd/iwd.mk |  7 +++++++
 2 files changed, 37 insertions(+)
 create mode 100644 package/iwd/S40iwd
Quoted 15 lines

package/iwd/S40iwd line 7

Quoted 13 lines
package/iwd/S40iwd new file +7 -0
new file mode 100644
index 0000000000..4a720b43c2
@@ -0,0 +1,30 @@
+#!/bin/sh
+#
+# Start iwd daemon
+#
+
+# Create needed directories.
+[ -d /tmp/iwd/hotspot ] || mkdir -p /tmp/iwd/hotspot

No need to test-and-create, as mkdir -p does that well for you already.

Did copy from S30dbus...., will fix it...

Quoted 2 lines

Is that script just about acting as a hotspot, then?

No (and did yet test only the client part), but iwd does not start up without a hotspot directory...

Quoted 10 lines

package/iwd/S40iwd line 13

Quoted 6 lines
package/iwd/S40iwd new file +5 -0
+case "$1" in
+    start)
+	printf "Starting iwd:"
+	/usr/libexec/iwd &
+	echo "OK"

This script has a mix of leading spaces and TABs.

Don't mix (use spaces please! ;-] ).

Arghh, still have no xterm which does the tab-copy right...and there are always some space/tabs I am missing...., will fix...

Quoted 8 lines

package/iwd/S40iwd line 17

Quoted 5 lines
package/iwd/S40iwd new file +4 -0
+        ;;
+    stop)
+	printf "Stopping iwd:"
+	killall iwd

Can't we use start-stop-daemon instead? See package/busybox/S01syslogd as a template.

O.k, will take a look at it...

Regards,
Peter

Quoted 38 lines
Quoted 37 lines
package/iwd/S40iwd new file +13 -0
+	[ $? = 0 ] && echo "OK" || echo "FAIL"
+        ;;
+    restart|reload)
+        "$0" stop
+        "$0" start
+        ;;
+    *)
+        echo "Usage: $0 {start|stop|restart|reload}"
+	exit 1
+        ;;
+esac
+
+exit $?
package/iwd/iwd.mk +7 -1
index d105d3b128..285fef2fd8 100644
@@ -65,4 +65,11 @@ IWD_POST_INSTALL_TARGET_HOOKS += \
 	IWD_INSTALL_CONFIG_FILE \
 	IWD_CONFIG_FILE_NAME_RESOLV_SERVICE
 
+define IWD_INSTALL_INIT_SYSV
+	$(INSTALL) -m 0755 -D package/iwd/S40iwd \
+		$(TARGET_DIR)/etc/init.d/S40iwd
+	mkdir -p $(TARGET_DIR)/var/lib/iwd
+	ln -sf /tmp/iwd/hotspot $(TARGET_DIR)/var/lib/iwd/hotspot
+endef
+
 $(eval $(autotools-package))
--

2.26.2

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#16 lore raw

PATCH 1/3 package/iwd: needs dbus (runtime)

In reply to Peter Seiderer

Peter, All,

On 2020-06-13 01:24 +0200, Peter Seiderer spake thusly:

Quoted 7 lines

Fixes (on startup):

  $ usr/libexec/iwd
  Wireless daemon version 1.7
  Failed to initialize D-Bus

Applied to master, after fixing two minor nits:
- move MMU dependency first
- split long line in comment dependencies

Thanks.

Regards,
Yann E. MORIN.

Quoted 42 lines

---
Note:
- for an alternative iwd without dbus demand take a lookt at
https://github.com/dylanaraps/eiwd

---
 package/iwd/Config.in | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
package/iwd/Config.in +6 -2
index eff24a8599..4501017630 100644
@@ -1,16 +1,20 @@
 config BR2_PACKAGE_IWD
 	bool "iwd"
+	depends on BR2_TOOLCHAIN_HAS_THREADS # dbus
+	depends on BR2_USE_MMU # dbus
 	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # ell
 	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_12 # ell
 	depends on !BR2_STATIC_LIBS # ell
 	depends on BR2_USE_WCHAR # ell
+	select BR2_PACKAGE_DBUS # runtime
 	select BR2_PACKAGE_ELL
 	help
 	  iNet Wireless daemon (iwd)
 
 	  https://iwd.wiki.kernel.org/
 
-comment "iwd needs a toolchain w/ dynamic library, wchar, headers >= 4.12"
+comment "iwd needs a toolchain w/ threads, dynamic library, wchar, headers >= 4.12"
+	depends on BR2_USE_MMU # dbus
 	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # ell
-	depends on BR2_STATIC_LIBS || !BR2_USE_WCHAR || \
+	depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS || !BR2_USE_WCHAR || \
 		!BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_12
Signature · 6 lines
2.26.2

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#17 lore raw

PATCH 1/3 package/iwd: needs dbus (runtime)

In reply to Peter Seiderer
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Peter" == Peter Seiderer <[email protected]> writes:

Fixes (on startup):

  $ usr/libexec/iwd
  Wireless daemon version 1.7
  Failed to initialize D-Bus

1.6 also contains the D-Bus logic in src/main.c:

        dbus = l_dbus_new_default(L_DBUS_SYSTEM_BUS);
        if (!dbus) {
                l_error("Failed to initialize D-Bus");
                goto fail_dbus;
        }

So committed to 2020.02.x and 2020.05.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard