mirror of
https://github.com/Ysurac/openmptcprouter.git
synced 2025-02-15 04:42:02 +00:00
26 lines
754 B
Bash
26 lines
754 B
Bash
#!/bin/sh
|
|
|
|
SECTION="hwinfo"
|
|
CONFIG="hwinfo"
|
|
|
|
get_hw_info() {
|
|
param=$(/sbin/mnf_info "--name")
|
|
[ -n "$param" -a ${#param} == 12 ] && uci set "system"."@system[0]"."device_code"=$param
|
|
|
|
hostname=${param:0:6}
|
|
[ -n "$hostname" -a ${#hostname} == 6 -a -z "$(uci -q get system.@system[0].hostname)" ] && uci set "system"."@system[0]"."hostname"=OpenMPTCProuter
|
|
|
|
routername=${param:0:6}
|
|
[ -n "$routername" -a ${#routername} == 6 -a -z "$(uci -q get system.@system[0].routername)" ] && uci set "system"."@system[0]"."routername"=$routername
|
|
|
|
version=$(cat /etc/version)
|
|
[ -n "$version" ] && uci set "system"."@system[0]"."device_fw_version"=$version
|
|
|
|
uci commit "system"
|
|
}
|
|
|
|
# get device information
|
|
echo "Reading device information"
|
|
get_hw_info
|
|
|
|
exit 0
|