Merge pull request #922 from ConnectBox/bugfix/unclean-shutdown-corrupts-armbianenv

Flush armbianEnv.txt to disk to avoid corruption
This commit is contained in:
Igor Pečovnik 2018-04-09 10:57:03 +02:00 committed by GitHub
commit 9adb2da5c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -371,6 +371,10 @@ add_usb_storage_quirks() {
read USBQUIRKS <${TMPFILE}
sed -i '/^usbstoragequirks/d' /boot/armbianEnv.txt
echo "usbstoragequirks=${USBQUIRKS}" >>/boot/armbianEnv.txt
# Make sure /boot/armbianEnv.txt is completely written to disk given
# we flush to disk infrequently and corruption of this file can have
# nasty side-effects
sync
if [ -f /sys/module/usb_storage/parameters/quirks ]; then
echo ${USBQUIRKS} >/sys/module/usb_storage/parameters/quirks
fi