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 infodir=usr/share/info
filelist=(grub.info grub-dev.info) filelist=('grub.info' 'grub-dev.info')
show_important_message() { show_important_message() {
echo -e "\033[0;31m IMPORTANT" echo -e "\033[0;31m IMPORTANT"
...@@ -9,23 +9,19 @@ show_important_message() { ...@@ -9,23 +9,19 @@ show_important_message() {
} }
delete_symlinks() { delete_symlinks() {
if [ `readlink /boot/kernel26.img` ] ; if readlink /boot/kernel26.img; then
then
echo "removing backward-symlink" echo "removing backward-symlink"
rm -v /boot/kernel26.img rm -v /boot/kernel26.img
fi fi
if [ `readlink /boot/kernel26-lts.img` ] ; if readlink /boot/kernel26-lts.img; then
then
echo "removing backward-symlink" echo "removing backward-symlink"
rm -v /boot/kernel26-lts.img rm -v /boot/kernel26-lts.img
fi fi
if [ `readlink /boot/vmlinuz26` ] ; if readlink /boot/vmlinuz26; then
then
echo "removing backward-symlink" echo "removing backward-symlink"
rm -v /boot/vmlinuz26 rm -v /boot/vmlinuz26
fi fi
if [ `readlink /boot/vmlinuz26-lts` ] ; if readlink /boot/vmlinuz26-lts; then
then
echo "removing backward-symlink" echo "removing backward-symlink"
rm -v /boot/vmlinuz26-lts rm -v /boot/vmlinuz26-lts
fi fi
...@@ -34,34 +30,33 @@ delete_symlinks() { ...@@ -34,34 +30,33 @@ delete_symlinks() {
post_install() { post_install() {
if [ -f /boot/grub/grub.cfg.pacsave ]; then if [ -f /boot/grub/grub.cfg.pacsave ]; then
echo "Copying /boot/grub/grub.cfg.pacsave to /boot/grub/grub.cfg" 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 fi
echo -n "Generating grub.cfg.example config file... " echo -n "Generating grub.cfg.example config file... "
grub-mkconfig -o /boot/grub/grub.cfg.example 2> /dev/null grub-mkconfig -o /boot/grub/grub.cfg.example 2> /dev/null
echo "done." echo "done."
for file in ${filelist[@]}; do for file in "${filelist[@]}"; do
install-info $infodir/$file.gz $infodir/dir 2> /dev/null install-info "${infodir}/${file}.gz" "${infodir}/dir" 2> /dev/null
done done
delete_symlinks delete_symlinks
show_important_message show_important_message
} }
post_upgrade() { post_upgrade() {
for file in ${filelist[@]}; do for file in "${filelist[@]}"; do
install-info $infodir/$file.gz $infodir/dir 2> /dev/null install-info "${infodir}/${file}.gz" "${infodir}/dir" 2> /dev/null
done done
delete_symlinks delete_symlinks
show_important_message show_important_message
if [ -s /boot/grub/grub.cfg ] update-grub
then
update-grub
fi
} }
pre_remove() { pre_remove() {
for file in ${filelist[@]}; do for file in "${filelist[@]}"; do
install-info --delete $infodir/$file $infodir/dir 2> /dev/null install-info --delete "${infodir}/${file}" "${infodir}/dir" 2> /dev/null
done 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