[source] base-files: board_detect: allow specifying the generated file

LEDE Commits lede-commits at lists.infradead.org
Sat Aug 13 06:52:14 PDT 2016


jogo pushed a commit to source.git, branch master:
https://git.lede-project.org/?p=source.git;a=commitdiff;h=780ccbf9f1ca60ecb6f125fb6d6d3a0652446685

commit 780ccbf9f1ca60ecb6f125fb6d6d3a0652446685
Author: Jonas Gorski <jonas.gorski at gmail.com>
AuthorDate: Sat Aug 13 14:04:23 2016 +0200

    base-files: board_detect: allow specifying the generated file
    
    Allow passing a filename to change the location of the generated
    board.json.
    
    Signed-off-by: Jonas Gorski <jonas.gorski at gmail.com>
---
 package/base-files/files/bin/board_detect              | 8 ++++++--
 package/base-files/files/lib/functions/uci-defaults.sh | 2 --
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/package/base-files/files/bin/board_detect b/package/base-files/files/bin/board_detect
index 3a23381..f9640f0 100755
--- a/package/base-files/files/bin/board_detect
+++ b/package/base-files/files/bin/board_detect
@@ -1,10 +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
+[ -f "$CFG" ] || return 1
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
 



More information about the lede-commits mailing list