From be7e85bb0e78f497cfa84448b9cf9fb0f8fcfc9c Mon Sep 17 00:00:00 2001 From: Clayton Craft Date: Wed, 22 Nov 2023 00:03:57 -0800 Subject: [PATCH] main/postmarketos-base-ui: Allow selecting WiFi backend (MR 4564) With this change, users who build pmOS will be able to select a WiFi backend (wpa_supplicant or iwd) Also see: https://gitlab.com/postmarketOS/pmaports/-/issues/1379 --- main/postmarketos-base-ui/APKBUILD | 40 +++++++++++++++++-- ...postmarketos-base-ui-wifi-iwd.post-install | 4 ++ ...postmarketos-base-ui-wifi-iwd.post-upgrade | 1 + ...s-base-ui-wifi-wpa_supplicant.post-install | 4 ++ ...s-base-ui-wifi-wpa_supplicant.post-upgrade | 1 + .../postmarketos-base-ui.post-install | 2 +- ...-usr-lib-NetworkManager-conf.d-50-iwd.conf | 2 + 7 files changed, 49 insertions(+), 5 deletions(-) create mode 100644 main/postmarketos-base-ui/postmarketos-base-ui-wifi-iwd.post-install create mode 120000 main/postmarketos-base-ui/postmarketos-base-ui-wifi-iwd.post-upgrade create mode 100644 main/postmarketos-base-ui/postmarketos-base-ui-wifi-wpa_supplicant.post-install create mode 120000 main/postmarketos-base-ui/postmarketos-base-ui-wifi-wpa_supplicant.post-upgrade create mode 100644 main/postmarketos-base-ui/rootfs-usr-lib-NetworkManager-conf.d-50-iwd.conf diff --git a/main/postmarketos-base-ui/APKBUILD b/main/postmarketos-base-ui/APKBUILD index a863360b0..973702449 100644 --- a/main/postmarketos-base-ui/APKBUILD +++ b/main/postmarketos-base-ui/APKBUILD @@ -1,6 +1,6 @@ # Maintainer: Clayton Craft pkgname=postmarketos-base-ui -pkgver=15 +pkgver=16 pkgrel=0 pkgdesc="Meta package for minimal postmarketOS UI base" url="https://postmarketos.org" @@ -18,7 +18,6 @@ depends=" tzdata util-linux wireless-regdb - wpa_supplicant " subpackages=" $pkgname-bluez @@ -27,10 +26,12 @@ subpackages=" $pkgname-networkmanager $pkgname-openrc-settingsd:_openrc_settingsd $pkgname-pulseaudio - $pkgname-tinydm - $pkgname-x11 $pkgname-qt-tweaks:qt_tweaks $pkgname-qt-wayland:qt_wayland + $pkgname-tinydm + $pkgname-wifi-iwd:iwd + $pkgname-wifi-wpa_supplicant:wpa_supplicant + $pkgname-x11 postmarketos-default-camera:_default_camera " install="$pkgname.post-install $pkgname.post-upgrade" @@ -53,6 +54,7 @@ _source644=" etc/sleep-inhibitor.conf etc/X11/Xwrapper.config usr/lib/NetworkManager/conf.d/50-hostname-mode.conf + usr/lib/NetworkManager/conf.d/50-iwd.conf usr/lib/NetworkManager/conf.d/50-random-mac.conf usr/lib/NetworkManager/conf.d/50-tethering.conf usr/lib/NetworkManager/conf.d/50-use-dnsmasq.conf @@ -78,7 +80,13 @@ flatpath() { } source="$(flatpath $_source644 $_source600 $_source755)" +_pmb_select="postmarketos-base-ui-wifi" package() { + # wifi-backend is provided by a subpackage in this APKBUILD, and it won't + # exist when this is evaluated at the top level. It's moved into this + # function to work around this. + depends="$depends postmarketos-base-ui-wifi" + local i for i in $_source644; do install -Dm644 "$srcdir/$(flatpath "$i")" "$pkgdir/$i" @@ -186,6 +194,29 @@ qt_wayland() { amove etc/profile.d/qt-wayland.sh } +wpa_supplicant() { + pkgdesc="Use wpa_supplicant as the WiFi backend." + depends="wpa_supplicant" + install="$subpkgname.post-install $subpkgname.post-upgrade" + replaces="wpa_supplicant-openrc" + provides="postmarketos-base-ui-wifi=$pkgver-r$pkgrel" + provider_priority=100 + + amove etc/conf.d/wpa_supplicant +} + +iwd() { + pkgdesc="Use iwd as the WiFi backend (recommended, but may not work with all devices in 'testing')" + depends="iwd" + install="$subpkgname.post-install $subpkgname.post-upgrade" + provides="postmarketos-base-ui-wifi=$pkgver-r$pkgrel" + # Lower than wpa_supplicant for now, see: + # https://gitlab.com/postmarketOS/pmaports/-/issues/1379 + provider_priority=90 + + amove usr/lib/NetworkManager/conf.d/50-iwd.conf +} + sha512sums=" e5d049db1d82c510bab9246208b51b8ec2711d008d67792fc10d4c0b65ed4dece7b5ae3c3dd28a8539d177b6849c1f921cb9fef3d2c7bee0355451f7b4757ec6 rootfs-etc-chrony-chrony.conf 8d2c54fe3ca62c62f8337fb6be28479d0e02ea63f32abae81907f2768631e65c9e17485f8bc0854a013377f729b06dd1873e2b75f86f657ece866d00aecbbdb4 rootfs-etc-elogind-logind.conf @@ -198,6 +229,7 @@ fe0651904c1f40ffa67d83daca190af199f63247e53642a59a1e1147cd06776fcf20b7b2fcc53737 6b9c7bb73213187eb9ca8a94109b2b816f50c1158c90fec2e92b373864280d67741589e5bfbab8810945f031d2f4b535aad78a72e46e52ea50be5b85324da381 rootfs-etc-sleep-inhibitor.conf cac604e25c46e695dd30bd5a10cfd2d69595fcc3bc290096ac94b76b10834d591ea6576afb79c46b5da492a1dbf8660cf87b6110cd39937e15237bc74fa7a5c6 rootfs-etc-X11-Xwrapper.config 3c9ae7415f4891bee8595166ed6a42cb577a837f741c6b5409d193558626348b41516888a01d0c4895282c5f4e9a1ff838c19712888750b2ef68429bb4b42ee3 rootfs-usr-lib-NetworkManager-conf.d-50-hostname-mode.conf +439615745d5be0d1ab6801cfbf960a31b12da30bf5df64ba2914ff32dae9e650595d7f96e66f5dff6308f092de1f746277ea7f4e701888a22571f7c119b7bf0d rootfs-usr-lib-NetworkManager-conf.d-50-iwd.conf d4b4c4fed2dee7266f6a87ae266691377593014943e2953e4cd87a59f3110f25bfb5f3f866cc843519f628695e4df7602bfdcd3d79f2c2cd6e8256535c33b038 rootfs-usr-lib-NetworkManager-conf.d-50-random-mac.conf 6507eb31cdd694a7db0280246433118a650bf5d99fbe639f967ae2d95945429a7e03ca6feb5bb6e7b9fb14fcec21e13e51209a79edd0041e77b5bf76b129ed6f rootfs-usr-lib-NetworkManager-conf.d-50-tethering.conf 900554534191fa0797064d35350934cdd8af59f30f0ae7d8ec63c2e11c44a16c643d3024b6543940488cd590fec1d392548bcaacc3be88cddff90f69b17ece07 rootfs-usr-lib-NetworkManager-conf.d-50-use-dnsmasq.conf diff --git a/main/postmarketos-base-ui/postmarketos-base-ui-wifi-iwd.post-install b/main/postmarketos-base-ui/postmarketos-base-ui-wifi-iwd.post-install new file mode 100644 index 000000000..ea30958f8 --- /dev/null +++ b/main/postmarketos-base-ui/postmarketos-base-ui-wifi-iwd.post-install @@ -0,0 +1,4 @@ +#!/bin/sh -e + +rc-update -qq del wpa_supplicant || true +rc-update -q add iwd default diff --git a/main/postmarketos-base-ui/postmarketos-base-ui-wifi-iwd.post-upgrade b/main/postmarketos-base-ui/postmarketos-base-ui-wifi-iwd.post-upgrade new file mode 120000 index 000000000..66076d93d --- /dev/null +++ b/main/postmarketos-base-ui/postmarketos-base-ui-wifi-iwd.post-upgrade @@ -0,0 +1 @@ +postmarketos-base-ui-wifi-iwd.post-install \ No newline at end of file diff --git a/main/postmarketos-base-ui/postmarketos-base-ui-wifi-wpa_supplicant.post-install b/main/postmarketos-base-ui/postmarketos-base-ui-wifi-wpa_supplicant.post-install new file mode 100644 index 000000000..e12b6dca5 --- /dev/null +++ b/main/postmarketos-base-ui/postmarketos-base-ui-wifi-wpa_supplicant.post-install @@ -0,0 +1,4 @@ +#!/bin/sh -e + +rc-update -qq del iwd || true +rc-update -q add wpa_supplicant default diff --git a/main/postmarketos-base-ui/postmarketos-base-ui-wifi-wpa_supplicant.post-upgrade b/main/postmarketos-base-ui/postmarketos-base-ui-wifi-wpa_supplicant.post-upgrade new file mode 120000 index 000000000..6beddffa4 --- /dev/null +++ b/main/postmarketos-base-ui/postmarketos-base-ui-wifi-wpa_supplicant.post-upgrade @@ -0,0 +1 @@ +postmarketos-base-ui-wifi-wpa_supplicant.post-install \ No newline at end of file diff --git a/main/postmarketos-base-ui/postmarketos-base-ui.post-install b/main/postmarketos-base-ui/postmarketos-base-ui.post-install index 3f447c711..a0ad7f838 100644 --- a/main/postmarketos-base-ui/postmarketos-base-ui.post-install +++ b/main/postmarketos-base-ui/postmarketos-base-ui.post-install @@ -1,6 +1,6 @@ #!/bin/sh -e -for service in cgroups dbus haveged wpa_supplicant chronyd rfkill; do +for service in cgroups dbus haveged chronyd rfkill; do rc-update -q add $service default done exit 0 diff --git a/main/postmarketos-base-ui/rootfs-usr-lib-NetworkManager-conf.d-50-iwd.conf b/main/postmarketos-base-ui/rootfs-usr-lib-NetworkManager-conf.d-50-iwd.conf new file mode 100644 index 000000000..515c976f0 --- /dev/null +++ b/main/postmarketos-base-ui/rootfs-usr-lib-NetworkManager-conf.d-50-iwd.conf @@ -0,0 +1,2 @@ +[device] +wifi.backend=iwd