Просмотр исходного кода

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 <[email protected]>
Link: https://github.com/openwrt/openwrt/pull/20248
Signed-off-by: Hauke Mehrtens <[email protected]>
Markus Gothe 3 месяцев назад
Родитель
Сommit
1e6ee26691
1 измененных файлов с 4 добавлено и 1 удалено
  1. 4 1
      package/base-files/files/etc/init.d/boot

+ 4 - 1
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() {