From 6002e51b7090aeeb42947e0ca7ec22278d7227d0 Mon Sep 17 00:00:00 2001 From: Dylan Van Assche Date: Mon, 28 Aug 2023 15:35:38 +0200 Subject: [PATCH] postmarketos-base-ui: kill/restart unudhcpd unconditionally (MR 4354) In some cases, the dispatcher script fails if unudhcpd is already running. Forcefully killing unudhcpd resolves the issue. Fixes #2267. Tested-by: Sicelo A. Mhlongo [ci:skip-build]: already built successfully in CI --- main/postmarketos-base-ui/APKBUILD | 4 +-- ...etworkManager-dispatcher.d-50-tethering.sh | 27 +++++++++---------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/main/postmarketos-base-ui/APKBUILD b/main/postmarketos-base-ui/APKBUILD index 6b4799b96..557bb2609 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=13 +pkgver=14 pkgrel=0 pkgdesc="Meta package for minimal postmarketOS UI base" url="https://postmarketos.org" @@ -205,7 +205,7 @@ d4b4c4fed2dee7266f6a87ae266691377593014943e2953e4cd87a59f3110f25bfb5f3f866cc8435 d1ddd43489e6016e3ffd716027ed2bae4a2ab5f213118bdbcb96750e267ab7c0367cd0e0e386300aa5550352653144f5caeddd790621fe0879f83ca1995bb65c rootfs-etc-tinydm.d-env-wayland.d-50-firefox-wayland.sh ecaa57d033a119a53a6574c27636b7c89d659d75ea48a973a6a4ff6f90e5d07202529fd489bfc9dfc7430f5b60f40612f6d5c06f7fab47e681b0a3112a874058 rootfs-etc-tinydm.d-env-wayland.d-50-sdl-wayland.sh 52d58729cbf3cd0318de633e8a8da74c7af246025a8c5746d5e7c854bdabbf27fa07d8558ffec92a30491cdb687fe4414de5adcddd7da5be3510f918fba463a2 rootfs-usr-lib-NetworkManager-dispatcher.d-50-dns-filter.sh -515ede48ce1245e72b501e17e59986d04a26aab9a42881b44974253c7dec1db08658625157d23adb6f8f62fd78c3f93b71fee1894ad0c80d61be3f5f32d5b990 rootfs-usr-lib-NetworkManager-dispatcher.d-50-tethering.sh +5b26f7b281b2e61d12afd4a5fa2f4c28ef6d510db7ea2c52bb412cc3ab890af674ab3af7b90e944cc7fe39290cba9999dacbd4372ef081e8cf9bc2caabe0437a rootfs-usr-lib-NetworkManager-dispatcher.d-50-tethering.sh bf8db527c49fa724e640a90269ba2648a2555f5867b2adbfbd88d1f685261f757339757c09ee08f590c76de4bd3d0c73a47dea9bd340644dd4707e76152cefd1 rootfs-etc-profile.d-qt-mobile-controls.sh 6e193eca3961a78d47b4656892eae34d019d9317a255a201f5ea61e3300caff04c526a27cd98d0edc072b36e3eaf3a1768f4cd27c5e2be8b19c167d535c820a6 rootfs-etc-profile.d-qt-wayland.sh " diff --git a/main/postmarketos-base-ui/rootfs-usr-lib-NetworkManager-dispatcher.d-50-tethering.sh b/main/postmarketos-base-ui/rootfs-usr-lib-NetworkManager-dispatcher.d-50-tethering.sh index 8dd742e32..1702a6257 100644 --- a/main/postmarketos-base-ui/rootfs-usr-lib-NetworkManager-dispatcher.d-50-tethering.sh +++ b/main/postmarketos-base-ui/rootfs-usr-lib-NetworkManager-dispatcher.d-50-tethering.sh @@ -55,15 +55,14 @@ disable_tethering() { nmcli connection modify "$con_uuid" ipv6.method "link-local" nmcli connection modify "$con_uuid" connection.autoconnect "true" - # If unudhpcd is not running, start it and configure it similar to initfs - if [ ! "$(pidof unudhcpd)" ]; then - (unudhcpd -i "$interface" -s "$host_ip" -c "$client_ip") & - logger -t nm-tethering "unudhcpd started" - - reactivate_gadget - logger -t nm-tethering "USB tethering disabled" - fi + # Restart unudhpcd and configure it similar to initfs + killall unudhpcd || true + (unudhcpd -i "$interface" -s "$host_ip" -c "$client_ip") & + logger -t nm-tethering "unudhcpd started" + # Reactivate gadget to apply changes + reactivate_gadget + logger -t nm-tethering "USB tethering disabled" } # USB tethering @@ -83,14 +82,12 @@ enable_tethering() { fi # Kill unudhcpd if needed - if [ "$(pidof unudhcpd)" ]; then - killall unudhcpd - logger -t nm-tethering "unudhcpd stopped" - - reactivate_gadget - logger -t nm-tethering "USB tethering enabled" - fi + killall unudhcpd || true + logger -t nm-tethering "unudhcpd stopped" + # Reactivate gadget to apply changes + reactivate_gadget + logger -t nm-tethering "USB tethering enabled" } # Handle dispatcher events for tethering