main/postmarketos-base-ui: fix tethering script when no UDC configured (MR 4907)
Reading the `ifname` of a gadget that has not been configured with a UDC succeeds with the content `(unnamed net_device)` instead of failing. So we need to explicitly check that a UDC was configured before we read the interface name. Ref: #2648 [ci:skip-build]: already built successfully in CI
This commit is contained in:
parent
b0226839d4
commit
4d4dc1baea
2 changed files with 12 additions and 8 deletions
|
@ -1,7 +1,7 @@
|
|||
# Maintainer: Clayton Craft <clayton@craftyguy.net>
|
||||
pkgname=postmarketos-base-ui
|
||||
pkgver=19
|
||||
pkgrel=1
|
||||
pkgver=20
|
||||
pkgrel=0
|
||||
pkgdesc="Meta package for minimal postmarketOS UI base"
|
||||
url="https://postmarketos.org"
|
||||
arch="noarch"
|
||||
|
@ -252,7 +252,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
|
||||
91410389f8d59ee504068b108ea8b93b89d3e9dd40f8db44ac984ada9a5b82ded1c0bbe2fedd6d8803ba449a66967e3b302ebbf0e2362923edb277f6c75a84af rootfs-usr-lib-NetworkManager-dispatcher.d-50-dns-filter.sh
|
||||
7e822a44ed202cb14cf2a6f1fb414beb11ad5c3563eadfe8be5546335044968b89c94b85ca19fc26f311164c32952dd100c7f6cb8d074b5b85ed0bd443b9a5d4 rootfs-usr-lib-NetworkManager-dispatcher.d-50-tethering.sh
|
||||
9dcf698c729e6a3d05201aa74c1618169f344f9c973e6a074591b0b4f352470235decbbc658393f44c62b6b1508c68f3c1787a640f219dbcc136e9335f3994c4 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
|
||||
"
|
||||
|
|
|
@ -14,11 +14,15 @@ con_uuid="83bd1823-feca-4c2b-9205-4b83dc792e1f"
|
|||
|
||||
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'
|
||||
)"
|
||||
if [ -n "$(cat /sys/kernel/config/usb_gadget/g1/UDC)" ]; then
|
||||
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'
|
||||
)"
|
||||
else
|
||||
interface='eth0'
|
||||
fi
|
||||
|
||||
[ -e /etc/unudhcpd.conf ] && . /etc/unudhcpd.conf
|
||||
host_ip="${unudhcpd_host_ip:-172.16.42.1}"
|
||||
|
|
Loading…
Reference in a new issue