base-files: board_detect: allow specifying the generated file
authorJonas Gorski <jonas.gorski@gmail.com>
Sat, 13 Aug 2016 12:04:23 +0000 (14:04 +0200)
committerJonas Gorski <jonas.gorski@gmail.com>
Sat, 13 Aug 2016 13:49:51 +0000 (15:49 +0200)
Allow passing a filename to change the location of the generated
board.json.

Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
package/base-files/files/bin/board_detect
package/base-files/files/lib/functions/uci-defaults.sh

index 3a23381c2c44d61f02090552cb07097b51bb4fc8..f9640f0388717b389a69483f9e3cdcdda08aba0f 100755 (executable)
@@ -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
index 8c954374a99c466322b07992e2ec591b5221e39a..a88308bbd0feefda7c915a742d3869b659050744 100755 (executable)
@@ -1,7 +1,5 @@
 #!/bin/ash
 
-CFG=/etc/board.json
-
 . /lib/functions.sh
 . /usr/share/libubox/jshn.sh