main/postmarketos-initramfs: fix starting unudhcpd 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
This commit is contained in:
parent
2b02900d5b
commit
b0226839d4
2 changed files with 11 additions and 7 deletions
|
@ -1,7 +1,7 @@
|
||||||
# Maintainer: Oliver Smith <ollieparanoid@postmarketos.org>
|
# Maintainer: Oliver Smith <ollieparanoid@postmarketos.org>
|
||||||
# Co-Maintainer: Clayton Craft <clayton@craftyguy.net>
|
# Co-Maintainer: Clayton Craft <clayton@craftyguy.net>
|
||||||
pkgname=postmarketos-initramfs
|
pkgname=postmarketos-initramfs
|
||||||
pkgver=2.5.3
|
pkgver=2.5.4
|
||||||
pkgrel=0
|
pkgrel=0
|
||||||
pkgdesc="Base files for the postmarketOS initramfs / initramfs-extra"
|
pkgdesc="Base files for the postmarketOS initramfs / initramfs-extra"
|
||||||
url="https://postmarketos.org"
|
url="https://postmarketos.org"
|
||||||
|
@ -89,7 +89,7 @@ sha512sums="
|
||||||
ab41b45b0613f25a61114ed8c8b92bc53c60838f6e2e0ba18c76e5369b2984e6023a0661887692673aca3f647f268c468a468f6b1ac424cfee609017a89481dd 00-initramfs-base.files
|
ab41b45b0613f25a61114ed8c8b92bc53c60838f6e2e0ba18c76e5369b2984e6023a0661887692673aca3f647f268c468a468f6b1ac424cfee609017a89481dd 00-initramfs-base.files
|
||||||
8a4adad3785af474b36a09a05f6a3b2c4b4f43aac331a53b903abfa51ea12be1e3d1d807b7a6e66a1346815f3b0044daf8cd62e21e2dc75d2db13ee265a72985 00-initramfs-extra-base.files
|
8a4adad3785af474b36a09a05f6a3b2c4b4f43aac331a53b903abfa51ea12be1e3d1d807b7a6e66a1346815f3b0044daf8cd62e21e2dc75d2db13ee265a72985 00-initramfs-extra-base.files
|
||||||
b1462989633c65a102e7ae7ced9c41a00673b4c7434cd3fe16c229c39bb870d7e850b0d317487191b7d7ca32c75b2eed1561b1facf405bd4d876d32c71badcf3 init.sh
|
b1462989633c65a102e7ae7ced9c41a00673b4c7434cd3fe16c229c39bb870d7e850b0d317487191b7d7ca32c75b2eed1561b1facf405bd4d876d32c71badcf3 init.sh
|
||||||
465fd1098680af5ee1783f31329e8965ac077719dc2762140bbef6d9471b085256d219fcbce9e9c80a30345a49757ebdb4c5f213fa12271ca83924ee91184531 init_functions.sh
|
8ff684e8245217cc9461297bce55dd8b417f0478ef38cdbddf7662f9ecc4324ca09e75978261084e00f5a1f2e36cc3b25a609a9bdca4addc5a60d3c370cbdb90 init_functions.sh
|
||||||
ba3275a9af788c7c782322a22a0f144d5e50e3498ea6886486a29331f23ae89cd32d500a3635cfa7cab369afba92edc18aeca64ccbf0cd589061cce23d15b46c unudhcpd.conf
|
ba3275a9af788c7c782322a22a0f144d5e50e3498ea6886486a29331f23ae89cd32d500a3635cfa7cab369afba92edc18aeca64ccbf0cd589061cce23d15b46c unudhcpd.conf
|
||||||
675e7d5bee39b2df7d322117f8dcaccc274d61beaf4d50ead19bbf2109446d64b1c0aa0c5b4f9846eb6c1c403418f28f6364eff4537ba41120fbfcbc484b7da7 mdev.conf
|
675e7d5bee39b2df7d322117f8dcaccc274d61beaf4d50ead19bbf2109446d64b1c0aa0c5b4f9846eb6c1c403418f28f6364eff4537ba41120fbfcbc484b7da7 mdev.conf
|
||||||
"
|
"
|
||||||
|
|
|
@ -695,11 +695,15 @@ start_unudhcpd() {
|
||||||
# Get usb interface
|
# Get usb interface
|
||||||
usb_network_function="${deviceinfo_usb_network_function:-ncm.usb0}"
|
usb_network_function="${deviceinfo_usb_network_function:-ncm.usb0}"
|
||||||
usb_network_function_fallback="rndis.usb0"
|
usb_network_function_fallback="rndis.usb0"
|
||||||
INTERFACE="$(
|
if [ -n "$(cat /config/usb_gadget/g1/UDC)" ]; then
|
||||||
cat "/config/usb_gadget/g1/functions/$usb_network_function/ifname" 2>/dev/null ||
|
INTERFACE="$(
|
||||||
cat "/config/usb_gadget/g1/functions/$usb_network_function_fallback/ifname" 2>/dev/null ||
|
cat "/config/usb_gadget/g1/functions/$usb_network_function/ifname" 2>/dev/null ||
|
||||||
echo ''
|
cat "/config/usb_gadget/g1/functions/$usb_network_function_fallback/ifname" 2>/dev/null ||
|
||||||
)"
|
echo ''
|
||||||
|
)"
|
||||||
|
else
|
||||||
|
INTERFACE=""
|
||||||
|
fi
|
||||||
if [ -n "$INTERFACE" ]; then
|
if [ -n "$INTERFACE" ]; then
|
||||||
ifconfig "$INTERFACE" "$host_ip"
|
ifconfig "$INTERFACE" "$host_ip"
|
||||||
elif ifconfig rndis0 "$host_ip" 2>/dev/null; then
|
elif ifconfig rndis0 "$host_ip" 2>/dev/null; then
|
||||||
|
|
Loading…
Reference in a new issue