Fix the grub2 config location for non Ubuntu/Debian systems

Fedora and openSUSE use /boot/grub2/grub.cfg for the grub2
configuration. The path that was used for Fedora before
(/boot/grub/grub.conf) is only valid for older grub releases.

Change-Id: I1e532c73a373a2c3f92211eff52719c2b635b7e3
This commit is contained in:
Ralf Haferkamp 2013-12-16 17:11:34 +01:00
parent c04d472064
commit 0661fa168b
1 changed files with 14 additions and 5 deletions

View File

@ -2,9 +2,18 @@
sed -i -e 's/ console=ttyS0//' /etc/default/grub
GRUB_CONFIG_FILE=/boot/grub/grub.cfg
if [ ! -e $GRUB_CONFIG_FILE ] ; then
# Fedora grub config file location
GRUB_CONFIG_FILE=/boot/grub/grub.conf
GRUB_CONFIG_FILE=""
if [ -e /boot/grub/grub.cfg ] ; then
# Ubuntu and Debian are using /boot/grub/grub.cfg for the grub2
# configuration
GRUB_CONFIG_FILE=/boot/grub/grub.cfg
elif [ -e /boot/grub2/grub.cfg ]; then
# On openSUSE and recent Fedora releases the grub2 config resides
# in /boot/grub2/grub.cfg
GRUB_CONFIG_FILE=/boot/grub2/grub.cfg
fi
if [ "$GRUB_CONFIG_FILE" ]; then
sed -i -e 's/ console=ttyS0//' $GRUB_CONFIG_FILE
fi
sed -i -e 's/ console=ttyS0//' $GRUB_CONFIG_FILE