difos/target/linux/x86/base-files/lib/preinit/81_upgrade_bootloader
Adrian Schmutzler 48c1fdd046 treewide: drop shebang from non-executable target files
This drops the shebang from all target files for /lib and
/etc/uci-defaults folders, as these are sourced and the shebang
is useless.

While at it, fix the executable flag on a few of these files.

This does not touch ar71xx, as this target is just used for
backporting now and applying cosmetic changes would just complicate
things.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-06-16 14:26:33 +02:00

18 lines
478 B
Text

upgrade_bootloader() {
local diskdev
. /lib/upgrade/common.sh
if [ ! -f /boot/grub/upgraded ] && export_bootdevice && export_partdevice diskdev 0; then
part_magic_efi "/dev/$diskdev" && return 0
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