From: Jo-Philipp Wich Date: Fri, 4 Dec 2015 11:06:57 +0000 (+0000) Subject: base-files: board.d: auto-set model id and name if /tmp/sysinfo is available X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=61a99da4f9219237a25bba37244307f803f2e1e1;p=librecmc%2Flibrecmc.git base-files: board.d: auto-set model id and name if /tmp/sysinfo is available Signed-off-by: Jo-Philipp Wich SVN-Revision: 47752 --- 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() {