Skip to contentSkip to conversation

package/iwd: add basic configuration file

PATCH Superseded Peter Seiderer 2 participants 4 messages Jun 15, 2020 – Jun 16, 2020

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/2 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-resolved case select the openresolv package to fulfill the iwd resolvconf requirement (and adjust the configuration file accordingly).

---
Changes v1 -> v2:
- use printf insteadof echo (Yann E. MORIN)

Changes v2 -> v3:
- select openresolv in all cases but systemd-resloved is enabled
- enable NameResolvingService=systemd in the configuration file only in case of systemd-resloved is enabled, enable NameResolvingService=resolvconf in the configuration file otherwise

---
 package/iwd/Config.in |  1 +
 package/iwd/iwd.mk    | 21 +++++++++++++++++++++
 package/iwd/main.conf |  3 +++
 3 files changed, 25 insertions(+)
 create mode 100644 package/iwd/main.conf
package/iwd/Config.in +1 -0
index ec53d13047..4e85fb4fd7 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_PACKAGE_SYSTEMD_RESOLVED
 	help
 	  iNet Wireless daemon (iwd)
 
package/iwd/iwd.mk +21 -0
index 32ff175933..c58e795f99 100644
@@ -46,4 +46,25 @@ 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_PACKAGE_SYSTEMD_RESOLVED),y)
+define IWD_CONFIG_FILE_NAME_RESOLV_SERVICE
+	print "[Network]\nNameResolvingService=systemd\n" \
+		>> $(TARGET_DIR)/etc/iwd/main.conf
+endef
+else
+define IWD_CONFIG_FILE_NAME_RESOLV_SERVICE
+	echo -e "[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
+
 $(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.27.0
#1 lore raw

PATCH v3 2/2 package/iwd: add sysv init script

---
Changes v1 -> v2:
- use start-stop-daemon (Yann E. MORIN)

Changes v2 -> v3:
- no changes

---
 package/iwd/S40iwd | 42 ++++++++++++++++++++++++++++++++++++++++++
 package/iwd/iwd.mk |  7 +++++++
 2 files changed, 49 insertions(+)
 create mode 100644 package/iwd/S40iwd
package/iwd/S40iwd new file +42 -0
new file mode 100644
index 0000000000..6714ca9956
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+DAEMON="/usr/libexec/iwd"
+PIDFILE="/var/run/iwd.pid"
+
+IWD_ARGS=""
+
+[ -r "/etc/default/iwd" ] && . "/etc/default/iwd"
+
+start() {
+	printf "Starting iwd:"
+	mkdir -p /tmp/iwd/hotspot
+	start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "$DAEMON" \
+		-- $IWD_ARGS
+	status=$?
+	if [ "$status" -eq 0 ]; then
+		echo "OK"
+	else
+		echo "FAIL"
+	fi
+	return "$status"
+}
+
+stop() {
+	printf "Stopping iwd:"
+	start-stop-daemon -K -q -p "$PIDFILE"
+	status=$?
+	if [ "$status" -eq 0 ]; then
+		echo "OK"
+	else
+		echo "FAIL"
+	fi
+	return "$status"
+}
+
+case "$1" in
+	start|stop)
+		"$1";;
+	*)
+		echo "Usage: $0 {start|stop}"
+		exit 1
+esac
package/iwd/iwd.mk +7 -0
index c58e795f99..5814d8805c 100644
@@ -67,4 +67,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.27.0
#2 lore raw

PATCH v3 1/2 package/iwd: add basic configuration file

In reply to Peter Seiderer

Hi Peter,

Quoted 42 lines · Peter Seiderer

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).

---
Changes v1 -> v2:
- use printf insteadof echo (Yann E. MORIN)

Changes v2 -> v3:
- select openresolv in all cases but systemd-resloved is enabled
- enable NameResolvingService=systemd in the configuration file only in case of systemd-resloved is enabled, enable NameResolvingService=resolvconf in the configuration file otherwise

---
 package/iwd/Config.in |  1 +
 package/iwd/iwd.mk    | 21 +++++++++++++++++++++
 package/iwd/main.conf |  3 +++
 3 files changed, 25 insertions(+)
 create mode 100644 package/iwd/main.conf
package/iwd/Config.in +1 -0
index ec53d13047..4e85fb4fd7 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_PACKAGE_SYSTEMD_RESOLVED
 	help
 	  iNet Wireless daemon (iwd)
 
package/iwd/iwd.mk +0 -0
index 32ff175933..c58e795f99 100644
@@ -46,4 +46,25 @@ 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_PACKAGE_SYSTEMD_RESOLVED),y)
+define IWD_CONFIG_FILE_NAME_RESOLV_SERVICE
+	print "[Network]\nNameResolvingService=systemd\n" \

print? Are you sure this does what you expect? It is surely not portable. On my system (Debian) /usr/bin/print is a symlink to run-mailcap.

package/iwd/iwd.mk else · line 61

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

You still use 'echo' here.

baruch

Quoted 18 lines
package/iwd/iwd.mk +8 -0
+		>> $(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 · 3 lines
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
#3 lore raw

PATCH v3 1/2 package/iwd: add basic configuration file

Hello Baruch,

Quoted 47 lines · Baruch Siach

Hi Peter,

Quoted 44 lines · Peter Seiderer

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).

---
Changes v1 -> v2:
- use printf insteadof echo (Yann E. MORIN)

Changes v2 -> v3:
- select openresolv in all cases but systemd-resloved is enabled
- enable NameResolvingService=systemd in the configuration file only in case of systemd-resloved is enabled, enable NameResolvingService=resolvconf in the configuration file otherwise

---
 package/iwd/Config.in |  1 +
 package/iwd/iwd.mk    | 21 +++++++++++++++++++++
 package/iwd/main.conf |  3 +++
 3 files changed, 25 insertions(+)
 create mode 100644 package/iwd/main.conf
package/iwd/Config.in +1 -0
index ec53d13047..4e85fb4fd7 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_PACKAGE_SYSTEMD_RESOLVED
 	help
 	  iNet Wireless daemon (iwd)
 
package/iwd/iwd.mk +0 -0
index 32ff175933..c58e795f99 100644
@@ -46,4 +46,25 @@ else
 IWD_CONF_OPTS += --disable-systemd-service
 endif
 
Quoted 12 lines

package/iwd/iwd.mk else · line 56

Quoted 8 lines
package/iwd/iwd.mk +8 -0
+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_PACKAGE_SYSTEMD_RESOLVED),y)
+define IWD_CONFIG_FILE_NAME_RESOLV_SERVICE
+	print "[Network]\nNameResolvingService=systemd\n" \

print? Are you sure this does what you expect? It is surely not portable. On my system (Debian) /usr/bin/print is a symlink to run-mailcap.

Your are right, I completely messed up this patch version...and is definitely not the one I tested with..., update follows, thanks for review....

Regards,
Peter

Quoted 30 lines

package/iwd/iwd.mk else · line 61

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

You still use 'echo' here.

baruch

Quoted 18 lines
package/iwd/iwd.mk +8 -0
+		>> $(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