sysupgrade: unmount filesystems before reboot
authorMathias Kresin <dev@kresin.me>
Tue, 2 Aug 2016 20:29:31 +0000 (22:29 +0200)
committerFelix Fietkau <nbd@nbd.name>
Thu, 4 Aug 2016 16:19:46 +0000 (18:19 +0200)
sysupgrade immediately reboots after flashing an image and doesn't
allow to unmount filesystems. At least in case the image used for
sysupgrade is stored on a FAT formatted usb flash drive, the following
warning is printed during the next mount of the flash drive:

FAT-fs (sda1): Volume was not properly unmounted. Some data may be
corrupt. Please run fsck.

Although a data corruption during read operations is unlikely, there is
no need to scare the users.

Signed-off-by: Mathias Kresin <dev@kresin.me>
package/base-files/files/lib/upgrade/common.sh
package/system/procd/files/nand.sh

index ea03f7761f3326f9db3f8b54e561757f8de1dfa6..bed9c188f2358017c8b60d46137663c576e25333 100644 (file)
@@ -243,6 +243,7 @@ do_upgrade() {
        [ -n "$DELAY" ] && sleep "$DELAY"
        ask_bool 1 "Reboot" && {
                v "Rebooting system..."
+               umount -a
                reboot -f
                sleep 5
                echo b 2>/dev/null >/proc/sysrq-trigger
index 8b0564dca2ecf04754112dd971e4a8cdb6f9df54..70b9af559dc0ddfdd63d508a561f7c3e197bc206 100644 (file)
@@ -198,6 +198,7 @@ nand_do_upgrade_success() {
        sync
        [ -f "$conf_tar" ] && nand_restore_config "$conf_tar"
        echo "sysupgrade successful"
+       umount -a
        reboot -f
 }
 
@@ -213,6 +214,7 @@ nand_upgrade_ubinized() {
 
        if [ ! "$mtdnum" ]; then
                echo "cannot find mtd device $CI_UBIPART"
+               umount -a
                reboot -f
        fi