x86: keep /boot mounted for kexec
[openwrt/staging/florian.git] / target / linux / x86 / base-files / lib / preinit / 79_move_config
index 5ac81cb90d1c15782a9c4f271720cfa66d6d03a9..7b34d9e5dac7f73800aa76a1470abbe570350c79 100644 (file)
@@ -4,12 +4,18 @@
 move_config() {
        local partdev
 
-       . /lib/upgrade/platform.sh
+       . /lib/upgrade/common.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 export_bootdevice && export_partdevice partdev 1; then
+               mkdir -p /boot
+               if mount -t ext4 -o ro,noatime "/dev/$partdev" /boot; then
+                       if [ -f /boot/sysupgrade.tgz ]; then
+                               mount /boot -o remount,rw,noatime
+                               mv -f /boot/sysupgrade.tgz /
+                               mount /boot -o remount,ro,noatime
+                       fi
+                       mount --bind /boot/boot /boot
+               fi
        fi
 }