diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2015-12-04 11:06:57 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2015-12-04 11:06:57 +0000 |
commit | b7cddddd17a8b1149b26d7d09e49ac533f7bac29 (patch) | |
tree | fc71b6de9892be75c4820f42798a2b313f0e3c75 /package/base-files/files/lib | |
parent | 4c7a14ef80ef5098ea5218b1e7e6b4872bd18c0e (diff) | |
download | master-187ad058-b7cddddd17a8b1149b26d7d09e49ac533f7bac29.tar.gz master-187ad058-b7cddddd17a8b1149b26d7d09e49ac533f7bac29.tar.bz2 master-187ad058-b7cddddd17a8b1149b26d7d09e49ac533f7bac29.zip |
base-files: board.d: auto-set model id and name if /tmp/sysinfo is available
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@47752 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/base-files/files/lib')
-rwxr-xr-x | package/base-files/files/lib/functions/uci-defaults-new.sh | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/package/base-files/files/lib/functions/uci-defaults-new.sh b/package/base-files/files/lib/functions/uci-defaults-new.sh index b970383049..61aa6e168e 100755 --- a/package/base-files/files/lib/functions/uci-defaults-new.sh +++ b/package/base-files/files/lib/functions/uci-defaults-new.sh @@ -543,6 +543,16 @@ ucidef_set_rssimon() { board_config_update() { json_init [ -f ${CFG} ] && json_load "$(cat ${CFG})" + + # auto-initialize model id and name if applicable + if ! json_is_a model object; then + json_select_object model + [ -f "/tmp/sysinfo/board_name" ] && \ + json_add_string id "$(cat /tmp/sysinfo/board_name)" + [ -f "/tmp/sysinfo/model" ] && \ + json_add_string name "$(cat /tmp/sysinfo/model)" + json_select .. + fi } board_config_flush() { |