mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-02-15 03:51:51 +00:00
26 lines
687 B
Text
26 lines
687 B
Text
|
#!/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
|