Author: jow
Date: 2015-12-04 12:06:57 +0100 (Fri, 04 Dec 2015)
New Revision: 47752

Modified:
   trunk/package/base-files/files/lib/functions/uci-defaults-new.sh
Log:
base-files: board.d: auto-set model id and name if /tmp/sysinfo is available

Signed-off-by: Jo-Philipp Wich <[email protected]>

Modified: trunk/package/base-files/files/lib/functions/uci-defaults-new.sh
===================================================================
--- trunk/package/base-files/files/lib/functions/uci-defaults-new.sh    
2015-12-04 10:06:03 UTC (rev 47751)
+++ trunk/package/base-files/files/lib/functions/uci-defaults-new.sh    
2015-12-04 11:06:57 UTC (rev 47752)
@@ -543,6 +543,16 @@
 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() {
_______________________________________________
openwrt-commits mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-commits

Reply via email to