main/postmarketos-base-ui: read USB network interface name from configfs gadget (MR 4750)

The configfs gadget can provide the actual interface name, which may not be
the default "usb0" since another gadget driver might have claimed "usb0".
This code is based on the `start_unudhcpd` function in `init_functions.sh`

[ci:skip-build] already built successfully in CI
This commit is contained in:
Arnav Singh 2024-01-17 12:45:59 -08:00 committed by Clayton Craft
parent 2a0fab1a77
commit ffd803d1dd
No known key found for this signature in database
GPG key ID: 4A4CED6D7EDF950A
2 changed files with 13 additions and 4 deletions

View file

@ -1,7 +1,7 @@
# Maintainer: Clayton Craft <clayton@craftyguy.net>
pkgname=postmarketos-base-ui
pkgver=16
pkgrel=1
pkgver=17
pkgrel=0
pkgdesc="Meta package for minimal postmarketOS UI base"
url="https://postmarketos.org"
arch="noarch"
@ -237,7 +237,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
5b26f7b281b2e61d12afd4a5fa2f4c28ef6d510db7ea2c52bb412cc3ab890af674ab3af7b90e944cc7fe39290cba9999dacbd4372ef081e8cf9bc2caabe0437a rootfs-usr-lib-NetworkManager-dispatcher.d-50-tethering.sh
7e822a44ed202cb14cf2a6f1fb414beb11ad5c3563eadfe8be5546335044968b89c94b85ca19fc26f311164c32952dd100c7f6cb8d074b5b85ed0bd443b9a5d4 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
"

View file

@ -9,7 +9,16 @@
# Must match with the supplied connection profile,
# using UUID allows the user to change the connection name if they want to.
con_uuid="83bd1823-feca-4c2b-9205-4b83dc792e1f"
interface="usb0"
. /usr/share/misc/source_deviceinfo
usb_network_function="${deviceinfo_usb_network_function:-ncm.usb0}"
usb_network_function_fallback="rndis.usb0"
interface="$(
cat "/sys/kernel/config/usb_gadget/g1/functions/$usb_network_function/ifname" 2>/dev/null ||
cat "/sys/kernel/config/usb_gadget/g1/functions/$usb_network_function_fallback/ifname" 2>/dev/null ||
echo 'usb0'
)"
[ -e /etc/unudhcpd.conf ] && . /etc/unudhcpd.conf
host_ip="${unudhcpd_host_ip:-172.16.42.1}"