Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > 0f6d622eee3287463f07d0e94e630d43 > scriptlet

grub2-efi-2.00-59.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
rm -f /var/log/grub2_post.log

# 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
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) and no drakboot.conf exists
# then print warning.

# Check for drakboot.conf
if [ $1 -eq 2 ]; then
  if [ -e /boot/grub2/drakboot.conf ]; then
# Get install device from drakboot.conf
    install_dev=$(cat /boot/grub2/drakboot.conf|grep "boot="|cut -d= -f2)
# Check it's not a partition
    if ! echo $install_dev | grep -q "[0-9]"; then
      echo "Installing grub2 to $install_dev" | tee -a /var/log/grub2_post.log
      grub2-install $install_dev
    fi
  else
cat >> /var/log/grub2_post.log<<EOF
************************** WARNING ***************************
Could not install grub2 to a device as the target was not known.
IF grub2 is your current bootloader, please ensure that 
grub2-install is run on the boot device BEFORE re-booting.
e.g. as root: grub2-install /dev/sdX
To avoid this warning in future please either use MCC -> Boot to set up grub2
or create the file: /boot/grub2/drakboot.conf containing boot=/dev/sdX 
where /dev/sdX is the boot device.
EOF
    cat /var/log/grub2_post.log
  fi
fi
# Generate grub.cfg only on install
if [ $1 -eq 1 ]; then
    grub2-mkconfig -o /boot/grub2/grub.cfg
fi