sysupgrade: unmount filesystems before reboot

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>
This commit is contained in:
Mathias Kresin 2016-08-02 22:29:31 +02:00 committed by Felix Fietkau
parent 188517144e
commit 3004298e62
2 changed files with 3 additions and 0 deletions

View file

@ -243,6 +243,7 @@ do_upgrade() {
[ -n "$DELAY" ] && sleep "$DELAY" [ -n "$DELAY" ] && sleep "$DELAY"
ask_bool 1 "Reboot" && { ask_bool 1 "Reboot" && {
v "Rebooting system..." v "Rebooting system..."
umount -a
reboot -f reboot -f
sleep 5 sleep 5
echo b 2>/dev/null >/proc/sysrq-trigger echo b 2>/dev/null >/proc/sysrq-trigger

View file

@ -198,6 +198,7 @@ nand_do_upgrade_success() {
sync sync
[ -f "$conf_tar" ] && nand_restore_config "$conf_tar" [ -f "$conf_tar" ] && nand_restore_config "$conf_tar"
echo "sysupgrade successful" echo "sysupgrade successful"
umount -a
reboot -f reboot -f
} }
@ -213,6 +214,7 @@ nand_upgrade_ubinized() {
if [ ! "$mtdnum" ]; then if [ ! "$mtdnum" ]; then
echo "cannot find mtd device $CI_UBIPART" echo "cannot find mtd device $CI_UBIPART"
umount -a
reboot -f reboot -f
fi fi