x86: move sysupgrade.tgz only if it exists
[openwrt/staging/lynxis/omap.git] / target / linux / x86 / base-files / lib / preinit / 79_move_config
index 1d4873d78b480cb3f11e04e6246559417b431a8a..37954f0236faafca657a05a3c1efc7df2e162bfc 100644 (file)
@@ -2,12 +2,17 @@
 # Copyright (C) 2012-2015 OpenWrt.org
 
 move_config() {
+       local partdev
+
        . /lib/upgrade/platform.sh
 
-       if platform_export_bootpart; then
-               mount -t ext4 -o rw,noatime "$BOOTPART" /mnt
-               mv -f /mnt/sysupgrade.tgz /
-               umount /mnt
+       if platform_export_bootdevice && platform_export_partdevice partdev 1; then
+               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
 }