tn3399_openwrt/package/base-files/files/bin/board_detect
Koen Vandeputte 0f27096100 base-files: also generate configs when current is empty (FS#193)
Before a configuration is generated, an empty file is created to store
it in. (required by UCI)

If something happens during config generation
(power cut, interruption, ..) an empty file exists and it is never
regenerated again, causing some daemons to fail starting
(NTPD, logread, ..)

Fix this by also generating new configs if a critical file
is empty.

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
2016-10-05 19:59:11 +02:00

15 lines
204 B
Bash
Executable File

#!/bin/sh
CFG=$1
[ -n "$CFG" ] || CFG=/etc/board.json
[ -d "/etc/board.d/" -a ! -s "$CFG" ] && {
for a in `ls /etc/board.d/*`; do
[ -x $a ] || continue;
$(. $a)
done
}
[ -s "$CFG" ] || return 1