[openwrt/openwrt] mediatek: filogic: avoid sub-shell invovation in netdev rename loop
LEDE Commits
lede-commits at lists.infradead.org
Mon Jul 8 13:49:57 PDT 2024
rmilecki pushed a commit to openwrt/openwrt.git, branch openwrt-23.05:
https://git.openwrt.org/cb2cda24e7fdcdd4850c5aec6c76416ce7f89491
commit cb2cda24e7fdcdd4850c5aec6c76416ce7f89491
Author: Daniel Golle <daniel at makrotopia.org>
AuthorDate: Thu May 30 14:38:56 2024 +0100
mediatek: filogic: avoid sub-shell invovation in netdev rename loop
Rename network devices to their label set in DT without invocation of
a sub-shell.
Signed-off-by: Daniel Golle <daniel at makrotopia.org>
(cherry picked from commit 983222605ce6fabb036fbbd5797b6689ed082136)
---
.../linux/mediatek/filogic/base-files/lib/preinit/04_set_netdev_label | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/target/linux/mediatek/filogic/base-files/lib/preinit/04_set_netdev_label b/target/linux/mediatek/filogic/base-files/lib/preinit/04_set_netdev_label
index f8b6f155de..110e023b96 100644
--- a/target/linux/mediatek/filogic/base-files/lib/preinit/04_set_netdev_label
+++ b/target/linux/mediatek/filogic/base-files/lib/preinit/04_set_netdev_label
@@ -5,8 +5,8 @@ set_netdev_labels() {
for dir in /sys/class/net/*; do
[ -r "$dir/of_node/label" ] || continue
- label="$(cat "$dir/of_node/label")"
- netdev="$(basename $dir)"
+ read -r label < "$dir/of_node/label"
+ netdev="${dir##*/}"
[ "$netdev" = "$label" ] && continue
ip link set "$netdev" name "$label"
done
More information about the lede-commits
mailing list