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@genexis.eu>
Link: https://github.com/openwrt/openwrt/pull/20248
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This commit is contained in:
Markus Gothe 2025-09-25 10:32:58 +02:00 committed by Hauke Mehrtens
parent 5263c4b993
commit 1e6ee26691
1 changed files with 4 additions and 1 deletions

View File

@ -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() {