mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Keep ethernet name of USB devices
This commit is contained in:
parent
fcf41ac85d
commit
5e9a5791de
2 changed files with 56 additions and 18 deletions
|
@ -0,0 +1,25 @@
|
|||
#!/bin/sh
|
||||
# Copyright (C) 2020 Ycarus (Yannick Chabanois) <ycarus@zugaina.org> for OpenMPTCProuter
|
||||
|
||||
[ "$ACTION" = "add" ] || exit
|
||||
[ -n "${INTERFACE}" ] || exit
|
||||
[ -n "${DEVPATH}" ] || exit
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
_set_intf_name() {
|
||||
local intfname=$1
|
||||
local device
|
||||
local ifname
|
||||
config_get device $intfname device
|
||||
config_get ifname $intfname ifname
|
||||
[ -n "$device" ] && [ -n "$ifname" ] && [ "/sys${DEVPATH}" = "$device" ] && [ "$INTERFACE" != "$ifname" ] && {
|
||||
logger -t "OMR-Rename" "Rename ${INTERFACE} to ${ifname}"
|
||||
ip link set ${INTERFACE} down
|
||||
ip link set ${INTERFACE} name ${ifname}
|
||||
ip link set ${ifname} up
|
||||
}
|
||||
}
|
||||
|
||||
config_load network
|
||||
config_foreach _set_intf_name interface
|
Loading…
Add table
Add a link
Reference in a new issue