mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-21 22:47:56 +00:00
mediatek: mt7622: add netdev rename preinit script
Add preinit script to rename network interfaces according to the
label provided in Device Tree.
Fixes: b6d8297510
("mediatek: mt7622: add Adtran SmartRG SDG-841t6 device")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This commit is contained in:
parent
e98987048a
commit
7e51d6a4c8
@ -0,0 +1,15 @@
|
|||||||
|
set_netdev_labels() {
|
||||||
|
local dir
|
||||||
|
local label
|
||||||
|
local netdev
|
||||||
|
|
||||||
|
for dir in /sys/class/net/*; do
|
||||||
|
[ -r "$dir/of_node/label" ] || continue
|
||||||
|
read -r label < "$dir/of_node/label"
|
||||||
|
netdev="${dir##*/}"
|
||||||
|
[ "$netdev" = "$label" ] && continue
|
||||||
|
ip link set "$netdev" name "$label"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
boot_hook_add preinit_main set_netdev_labels
|
Loading…
Reference in New Issue
Block a user