diff options
Diffstat (limited to 'target/linux/x86/base-files/lib/preinit')
-rw-r--r-- | target/linux/x86/base-files/lib/preinit/81_upgrade_bootloader | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/target/linux/x86/base-files/lib/preinit/81_upgrade_bootloader b/target/linux/x86/base-files/lib/preinit/81_upgrade_bootloader new file mode 100644 index 0000000000..3a4e756b1e --- /dev/null +++ b/target/linux/x86/base-files/lib/preinit/81_upgrade_bootloader @@ -0,0 +1,19 @@ +#!/bin/sh + +upgrade_bootloader() { + local diskdev + + . /lib/upgrade/common.sh + + if [ ! -f /boot/grub/upgraded ] && export_bootdevice && export_partdevice diskdev 0; then + echo "(hd0) /dev/$diskdev" > /tmp/device.map + /usr/sbin/grub-bios-setup \ + -m "/tmp/device.map" \ + -d "/boot/grub" \ + -r "hd0,msdos1" \ + "/dev/$diskdev" \ + && touch /boot/grub/upgraded + fi +} + +[ "$INITRAMFS" = "1" ] || boot_hook_add preinit_main upgrade_bootloader |