mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2026-03-02 23:44:37 +01:00
sdk: At first boot; copy factory default to cwmp UCI.
This commit is contained in:
parent
a6b66929e4
commit
47a15eb231
1 changed files with 24 additions and 0 deletions
24
icwmp/files/etc/uci-defaults/85-cwmp-set-userid
Normal file
24
icwmp/files/etc/uci-defaults/85-cwmp-set-userid
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
|
||||
# Copy defaults by the factory to the cwmp UCI user section.
|
||||
|
||||
|
||||
# Get factory base MAC.
|
||||
baseMac=$(db -q get hw.board.basemac)
|
||||
|
||||
# Erase colon and space characters.
|
||||
baseMac=${baseMac//:/}
|
||||
baseMac=${baseMac// /}
|
||||
|
||||
# Caseing and fixed length string.
|
||||
mac=$(printf "%12.12X" $((0x$baseMac)))
|
||||
|
||||
# Get system serial number.
|
||||
serial=$(db -q get hw.board.serial_number)
|
||||
|
||||
uci -q batch <<-EOF
|
||||
set cwmp.acs.userid="${mac:0:6}-${serial}"
|
||||
set cwmp.cpe.userid="${mac:0:6}-${serial}"
|
||||
EOF
|
||||
|
||||
|
||||
# No need for commit here, it is done by uci_apply_defaults().
|
||||
Loading…
Add table
Reference in a new issue