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@makrotopia.org>
This commit is contained in:
parent
87d5d38e2a
commit
983222605c
1 changed files with 2 additions and 2 deletions
|
@ -5,8 +5,8 @@ set_netdev_labels() {
|
||||||
|
|
||||||
for dir in /sys/class/net/*; do
|
for dir in /sys/class/net/*; do
|
||||||
[ -r "$dir/of_node/label" ] || continue
|
[ -r "$dir/of_node/label" ] || continue
|
||||||
label="$(cat "$dir/of_node/label")"
|
read -r label < "$dir/of_node/label"
|
||||||
netdev="$(basename $dir)"
|
netdev="${dir##*/}"
|
||||||
[ "$netdev" = "$label" ] && continue
|
[ "$netdev" = "$label" ] && continue
|
||||||
ip link set "$netdev" name "$label"
|
ip link set "$netdev" name "$label"
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue