base-files: board_detect: allow specifying the generated file
[openwrt/openwrt.git] / package / base-files / files / bin / board_detect
index ddd17a16337d1159cc05fda4d6ce1c7a0dd34e75..f9640f0388717b389a69483f9e3cdcdda08aba0f 100755 (executable)
@@ -1,14 +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 "/etc/config/network" ] || {
-       touch /etc/config/network
-       /bin/config_generate
-}
+[ -f "$CFG" ] || return 1