base-files: uci-defaults: do config flush in one shot
authorRoman Yeryomin <roman@advem.lv>
Mon, 21 Oct 2019 21:10:20 +0000 (00:10 +0300)
committerJohn Crispin <john@phrozen.org>
Tue, 22 Oct 2019 09:39:28 +0000 (11:39 +0200)
Moving a file between tmpfs and other fs is neither
faster nor safer, thus no point in doing it in two steps.
Use new jshn option to write output directly to file.

Originally discussed here:
http://lists.openwrt.org/pipermail/openwrt-devel/2017-December/010127.html

Signed-off-by: Roman Yeryomin <roman@advem.lv>
package/base-files/files/lib/functions/uci-defaults.sh

index c2c6dc3fdc241528fdd45a93aada4faf88460b26..0d2dcd52415f50636482d113be2249f5fa77f1ce 100755 (executable)
@@ -615,6 +615,5 @@ board_config_update() {
 }
 
 board_config_flush() {
-       json_dump -i > /tmp/.board.json
-       mv /tmp/.board.json ${CFG}
+       json_dump -i -o ${CFG}
 }