[LEDE-DEV] [RFC/RFT 1/7] base-files: split config generation out of board_detect

Jonas Gorski jonas.gorski at gmail.com
Fri Jul 29 02:07:49 PDT 2016


Move config generation out of board_detect and allow overriding the
generated json's filename.

Signed-off-by: Jonas Gorski <jonas.gorski at gmail.com>
---
 package/base-files/files/bin/board_detect              | 10 ++++++----
 package/base-files/files/etc/init.d/boot               |  2 +-
 package/base-files/files/lib/functions/uci-defaults.sh |  2 --
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/package/base-files/files/bin/board_detect b/package/base-files/files/bin/board_detect
index beb7f4e..f9640f0 100755
--- a/package/base-files/files/bin/board_detect
+++ b/package/base-files/files/bin/board_detect
@@ -1,12 +1,14 @@
 #!/bin/sh
 
-[ -d "/etc/board.d/" -a ! -f "/etc/board.json" ] && {
+CFG=$1
+
+[ -n "$CFG" ] || CFG=/etc/board.json
+
+[ -d "/etc/board.d/" -a ! -f "$CFG" ] && {
 	for a in `ls /etc/board.d/*`; do
 		[ -x $a ] || continue;
 		$(. $a)
 	done
 }
 
-[ -f "/etc/board.json" ] || return 1
-
-/bin/config_generate
+[ -f "$CFG" ] || return 1
diff --git a/package/base-files/files/etc/init.d/boot b/package/base-files/files/etc/init.d/boot
index ccd0afe..c2fd5f5 100755
--- a/package/base-files/files/etc/init.d/boot
+++ b/package/base-files/files/etc/init.d/boot
@@ -48,7 +48,7 @@ boot() {
 	rm -f /tmp/wireless.tmp
 
 	/bin/board_detect
-	uci_apply_defaults
+	[ -f /etc/board.json ] && /bin/config_generate
 	
 	# temporary hack until configd exists
 	/sbin/reload_config
diff --git a/package/base-files/files/lib/functions/uci-defaults.sh b/package/base-files/files/lib/functions/uci-defaults.sh
index 8c95437..a88308b 100755
--- a/package/base-files/files/lib/functions/uci-defaults.sh
+++ b/package/base-files/files/lib/functions/uci-defaults.sh
@@ -1,7 +1,5 @@
 #!/bin/ash
 
-CFG=/etc/board.json
-
 . /lib/functions.sh
 . /usr/share/libubox/jshn.sh
 
-- 
2.1.4




More information about the Lede-dev mailing list