base-files: rename hostname with EUI of mac address
If a label MAC address is provided for device, system
will rename the hostname with OpenWrt_{eui mac address}.
This helps to distinguish between different devices.
Since it's no good idea to nest json_* functions, this code does
not use get_mac_label directly, but only get_mac_label_dt as
external resource.
Signed-off-by: Rosy Song <rosysong@rosinson.com>
[merged with commit introducing macaddr_geteui, rebased on updated
label MAC address storage, extended commit message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
This commit is contained in:
committed by
Adrian Schmutzler
parent
a6fbdd3a78
commit
6170c46b47
@@ -144,6 +144,13 @@ macaddr_add() {
|
||||
echo $oui:$nic
|
||||
}
|
||||
|
||||
macaddr_geteui() {
|
||||
local mac=$1
|
||||
local sep=$2
|
||||
|
||||
echo ${mac:9:2}$sep${mac:12:2}$sep${mac:15:2}
|
||||
}
|
||||
|
||||
macaddr_setbit_la() {
|
||||
local mac=$1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user