Commit 8efeacef authored by Daniele's avatar Daniele
Browse files

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.
parent 9ab875d1
infodir=usr/share/info
filelist=(grub.info grub-dev.info)
filelist=('grub.info' 'grub-dev.info')
show_important_message() {
echo -e "\033[0;31m IMPORTANT"
......@@ -9,23 +9,19 @@ show_important_message() {
}
delete_symlinks() {
if [ `readlink /boot/kernel26.img` ] ;
then
if readlink /boot/kernel26.img; then
echo "removing backward-symlink"
rm -v /boot/kernel26.img
fi
if [ `readlink /boot/kernel26-lts.img` ] ;
then
if readlink /boot/kernel26-lts.img; then
echo "removing backward-symlink"
rm -v /boot/kernel26-lts.img
fi
if [ `readlink /boot/vmlinuz26` ] ;
then
if readlink /boot/vmlinuz26; then
echo "removing backward-symlink"
rm -v /boot/vmlinuz26
fi
if [ `readlink /boot/vmlinuz26-lts` ] ;
then
if readlink /boot/vmlinuz26-lts; then
echo "removing backward-symlink"
rm -v /boot/vmlinuz26-lts
fi
......@@ -34,34 +30,33 @@ delete_symlinks() {
post_install() {
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
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
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
for file in "${filelist[@]}"; do
install-info "${infodir}/${file}.gz" "${infodir}/dir" 2> /dev/null
done
delete_symlinks
show_important_message
if [ -s /boot/grub/grub.cfg ]
then
update-grub
fi
update-grub
}
pre_remove() {
for file in ${filelist[@]}; do
install-info --delete $infodir/$file $infodir/dir 2> /dev/null
for file in "${filelist[@]}"; do
install-info --delete "${infodir}/${file}" "${infodir}/dir" 2> /dev/null
done
}
# vim:set ts=2 sw=2 et:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment