[openwrt/openwrt] base-files: commit and sync before removing defaults script.

LEDE Commits lede-commits at lists.infradead.org
Sat Oct 4 11:49:52 PDT 2025


hauke pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/1e6ee26691f8efb053c7c2ce1578196828539caa

commit 1e6ee26691f8efb053c7c2ce1578196828539caa
Author: Markus Gothe <markus.gothe at genexis.eu>
AuthorDate: Thu Sep 25 10:32:58 2025 +0200

    base-files: commit and sync before removing defaults script.
    
    Improve the resilence against power failures during
    boot-up by trying to sync the file system before
    removing the script. The order of the operations
    are important.
    
    Signed-off-by: Markus Gothe <markus.gothe at genexis.eu>
    Link: https://github.com/openwrt/openwrt/pull/20248
    Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 package/base-files/files/etc/init.d/boot | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/package/base-files/files/etc/init.d/boot b/package/base-files/files/etc/init.d/boot
index a26d4886b2..ab25c11129 100755
--- a/package/base-files/files/etc/init.d/boot
+++ b/package/base-files/files/etc/init.d/boot
@@ -10,10 +10,13 @@ uci_apply_defaults() {
 	cd /etc/uci-defaults || return 0
 	files="$(ls)"
 	[ -z "$files" ] && return 0
+	applied=""
 	for file in $files; do
-		( . "./$(basename $file)" ) && rm -f "$file"
+		( . "./$(basename $file)" ) && applied="$applied $file"
 	done
 	uci commit
+	sync
+	rm -f $applied
 }
 
 boot() {




More information about the lede-commits mailing list