core/grub2/grub2.install
Daniele 8efeacef65 Changing the grub2.install script so that it runs update-grub no matter what.
The old script only did this in the post_upgrade() hook if there was a
/boot/grub/grub.cfg file with non-zero size, but as we already tell pacman
to backup that file, we can safely regenerate it anyway.
2012-07-15 21:42:21 +02:00

63 lines
1.7 KiB
Plaintext

infodir=usr/share/info
filelist=('grub.info' 'grub-dev.info')
show_important_message() {
echo -e "\033[0;31m IMPORTANT"
echo -e "\033[0;0m Run \033[0;32m 'grub-install /dev/sda --no-floppy' \033[0;0m as root for installing in MBR"
echo -e "\033[0;0m Run \033[0;32m 'grub-mkconfig -o /boot/grub/grub.cfg' \033[0;0m as root for generating grub.cfg"
echo -e "\033[0;0m Also you can run \033[0;32m 'update-grub' \033[0;0m as root for generating grub.cfg"
}
delete_symlinks() {
if readlink /boot/kernel26.img; then
echo "removing backward-symlink"
rm -v /boot/kernel26.img
fi
if readlink /boot/kernel26-lts.img; then
echo "removing backward-symlink"
rm -v /boot/kernel26-lts.img
fi
if readlink /boot/vmlinuz26; then
echo "removing backward-symlink"
rm -v /boot/vmlinuz26
fi
if readlink /boot/vmlinuz26-lts; then
echo "removing backward-symlink"
rm -v /boot/vmlinuz26-lts
fi
}
post_install() {
if [ -f /boot/grub/grub.cfg.pacsave ]; then
echo "Copying /boot/grub/grub.cfg.pacsave to /boot/grub/grub.cfg"
install -D -m644 /boot/grub/grub.cfg.pacsave /boot/grub/grub.cfg
fi
echo -n "Generating grub.cfg.example config file... "
grub-mkconfig -o /boot/grub/grub.cfg.example 2> /dev/null
echo "done."
for file in "${filelist[@]}"; do
install-info "${infodir}/${file}.gz" "${infodir}/dir" 2> /dev/null
done
delete_symlinks
show_important_message
}
post_upgrade() {
for file in "${filelist[@]}"; do
install-info "${infodir}/${file}.gz" "${infodir}/dir" 2> /dev/null
done
delete_symlinks
show_important_message
update-grub
}
pre_remove() {
for file in "${filelist[@]}"; do
install-info --delete "${infodir}/${file}" "${infodir}/dir" 2> /dev/null
done
}
# vim:set ts=2 sw=2 et: