core/grub2/grub2.install

68 lines
1.8 KiB
Plaintext
Raw Normal View History

2011-06-12 21:55:37 +08:00
infodir=usr/share/info
filelist=(grub.info grub-dev.info)
show_important_message() {
2011-08-08 19:29:08 +08:00
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
}
2010-11-14 06:20:42 +08:00
post_install() {
2011-06-12 21:55:37 +08:00
if [ -f /boot/grub/grub.cfg.pacsave ]; then
echo "Copying /boot/grub/grub.cfg.pacsave to /boot/grub/grub.cfg"
install -Dm644 /boot/grub/grub.cfg.pacsave /boot/grub/grub.cfg
fi
2010-11-14 06:20:42 +08:00
2011-06-12 21:55:37 +08:00
echo -n "Generating grub.cfg.example config file... "
grub-mkconfig -o /boot/grub/grub.cfg.example 2> /dev/null
echo "done."
2010-11-14 06:20:42 +08:00
2011-06-12 21:55:37 +08:00
for file in ${filelist[@]}; do
install-info $infodir/$file.gz $infodir/dir 2> /dev/null
done
2011-08-08 19:29:08 +08:00
delete_symlinks
show_important_message
2010-11-14 06:20:42 +08:00
}
post_upgrade() {
2011-06-12 21:55:37 +08:00
for file in ${filelist[@]}; do
install-info $infodir/$file.gz $infodir/dir 2> /dev/null
done
2011-08-08 19:29:08 +08:00
delete_symlinks
show_important_message
2012-01-22 10:36:58 +08:00
if [ -s /boot/grub/grub.cfg ]
2011-08-08 20:03:42 +08:00
then
update-grub
fi
2010-11-14 06:20:42 +08:00
}
2011-06-12 21:55:37 +08:00
pre_remove() {
for file in ${filelist[@]}; do
install-info --delete $infodir/$file $infodir/dir 2> /dev/null
done
}