x86: move sysupgrade.tgz only if it exists
[openwrt/staging/lynxis/omap.git] / target / linux / x86 / base-files / lib / preinit / 79_move_config
index 5ac81cb90d1c15782a9c4f271720cfa66d6d03a9..37954f0236faafca657a05a3c1efc7df2e162bfc 100644 (file)
@@ -7,9 +7,12 @@ move_config() {
        . /lib/upgrade/platform.sh
 
        if platform_export_bootdevice && platform_export_partdevice partdev 1; then
-               mount -t ext4 -o rw,noatime "/dev/$partdev" /mnt
-               mv -f /mnt/sysupgrade.tgz /
-               umount /mnt
+               if mount -t ext4 -o rw,noatime "/dev/$partdev" /mnt; then
+                       if [ -f /mnt/sysupgrade.tgz ]; then
+                               mv -f /mnt/sysupgrade.tgz /
+                       fi
+                       umount /mnt
+               fi
        fi
 }