[LEDE-DEV] [PATCH] opkg: use fsync in migrate script to flush config files changes
Rafał Miłecki
zajec5 at gmail.com
Tue Sep 6 13:39:45 PDT 2016
From: Rafał Miłecki <rafal at milecki.pl>
Whenever app/script wants to have its changes reliably stored it has to
use (f)sync. It applies to this uci-defaults script as after exiting 0
we (most likely) won't be called ever again.
Up to now power cut right after script execution could result in both:
/etc/opkg.conf and /etc/opkg/customfeeds.conf being empty.
Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
---
package/system/opkg/files/20_migrate-feeds | 3 +++
1 file changed, 3 insertions(+)
diff --git a/package/system/opkg/files/20_migrate-feeds b/package/system/opkg/files/20_migrate-feeds
index 38cc57c..bd27849 100644
--- a/package/system/opkg/files/20_migrate-feeds
+++ b/package/system/opkg/files/20_migrate-feeds
@@ -6,4 +6,7 @@ echo -e "# Old feeds from previous image\n# Uncomment to reenable\n" >> /etc/opk
sed -n "s/.*\(src\/.*\)/# \1/p" /etc/opkg.conf >> /etc/opkg/customfeeds.conf
sed -i "/.*src\/.*/d" /etc/opkg.conf
+fsync /etc/opkg.conf
+fsync /etc/opkg/customfeeds.conf
+
exit 0
--
2.9.3
More information about the Lede-dev
mailing list