mirror of
https://gitdl.cn/https://github.com/chakralinux/core.git
synced 2025-02-03 07:47:20 +08:00
048b1361c2
That is because grub2 1.99 did own /boot/grub/grub.cfg, so upgrading to grub2 2.00 would result in that file being moved to its .pacsave entry. To avoid this, which would break systems, I'll restore the old configuration, so that the configuration on disk and the bootloader in the MBR should match. Any other choice (automatically run grub-mkconfig, or automatically run grub-install) is conceptually wrong and could lead to unwanted results or broken systems.
51 lines
1.3 KiB
Plaintext
51 lines
1.3 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"
|
|
}
|
|
|
|
restore_grubcfg() {
|
|
if [ -f /boot/grub/grub.cfg.pacsave ]; then
|
|
echo -n "Copying /boot/grub/grub.cfg.pacsave to /boot/grub/grub.cfg... "
|
|
install -D -m644 /boot/grub/grub.cfg.pacsave \
|
|
/boot/grub/grub.cfg
|
|
echo "done."
|
|
fi
|
|
}
|
|
|
|
post_install() {
|
|
restore_grubcfg
|
|
|
|
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
|
|
|
|
show_important_message
|
|
}
|
|
|
|
post_upgrade() {
|
|
restore_grubcfg
|
|
|
|
for file in "${filelist[@]}"; do
|
|
install-info "${infodir}/${file}.gz" "${infodir}/dir" 2> /dev/null
|
|
done
|
|
|
|
show_important_message
|
|
}
|
|
|
|
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:
|