From: Daniel Golle Date: Thu, 30 May 2024 13:38:56 +0000 (+0100) Subject: mediatek: filogic: avoid sub-shell invovation in netdev rename loop X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=983222605ce6fabb036fbbd5797b6689ed082136;p=openwrt%2Fstaging%2Fldir.git 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 --- 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