Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > 36edb47d92e0100918ffe0f8f34665de > scriptlet

grub2-efi-2.00-58.mga4.x86_64.rpm

PREUN

/bin/sh
exec > /var/log/grub2_preun.log 2>&1
# Only if uninstalling
if [ $1 -eq 0 ]; then
rm -rf /boot/grub2/x86_64-efi
rm -rf /boot/grub2/locale
fi

POSTIN

/bin/sh
exec > /var/log/grub2_post.log 2>&1
# Determine the partition with /boot
BOOT_PARTITION=$(df -h /boot |(read; awk '{print $1; exit}'))
# make it work with live images
if [ "$BOOT_PARTITION" == "overlayfs" ]; then
    BOOT_PARTITION=$(df -h /mnt/install/boot |(read; awk '{print $1; exit}'))
fi

# Generate core.img, but don't let it be installed in boot sector
grub2-install --directory=/usr/lib/grub/x86_64-efi --grub-setup=/bin/true $BOOT_PARTITION

# On update re-install grub2 to where it was installed by drakboot
# otherwise next boot may fail due to mismatched boot code.
# If grub2 was manually installed (outside drakboot) do nothing.
# This will also re-build the menu.
if [ $1 -eq 2 ] && [ -e /boot/grub2/drakboot.conf ]; then
install_part=$(cat /boot/grub2/drakboot.conf|grep "boot="|cut -d= -f2)
root_part=$(df -h / |(read; awk '{print $1; exit}'))
if [ "$root_part" != "$install_part" ]; then
grub2-install $install_part
fi
fi

# Generate grub.cfg only on install
if [ $1 -eq 1 ]; then
    grub2-mkconfig -o /boot/grub2/grub.cfg
fi