Merge force-text-mode-console into the bootloader script

52-force-text-mode-console, running after 51-bootloader, calls
grub2-mkconfig (on Ubuntu that will happen via the update-grub call).
This call will overwrite all the changes that 51-bootloader did to the
grub.cfg. By merging the 52-force-text-mode-console code into
51-bootloader we avoid that. This also means that 51-bootloader will now
call grub2-mkconfig regardless of whether there is already and existing
grub2 configuration or not (52-force-text-mode-console did that in the
past anyway).

Additionally this commit enables the force to textmode code for openSUSE
(was previously only working correctly for Ubuntu and Fedora).

Closes-Bug: #1260323
Change-Id: Ida8e1a69df22d41ad70eb7154707c50613b536a8
This commit is contained in:
Ralf Haferkamp 2013-12-12 12:55:39 +01:00
parent 37f3c4fe90
commit 7da1425438
2 changed files with 20 additions and 39 deletions

View File

@ -120,24 +120,31 @@ function install_grub2 {
# This might be better factored out into a per-distro 'install-bootblock'
# helper.
if [ -f "/boot/grub/grub.cfg" ] ; then
GRUB_CFG=/boot/grub/grub.cfg
elif [ -f "/boot/grub2/grub.cfg" ] ; then
if [ -d /boot/grub2 ]; then
GRUB_CFG=/boot/grub2/grub.cfg
elif [ -d /boot/grub ]; then
GRUB_CFG=/boot/grub/grub.cfg
fi
# If GRUB configuration file does not exist, generate one
if [ ! $GRUB_CFG ]; then
if [ -d /boot/grub2 ]; then
GRUB_CFG=/boot/grub2/grub.cfg
elif [ -d /boot/grub ]; then
GRUB_CFG=/boot/grub/grub.cfg
fi
grub2-mkconfig -o $GRUB_CFG
fi;
DIST=`lsb_release -is`
[ -n "$DIST" ]
echo 'GRUB_TERMINAL=console' >>/etc/default/grub
echo 'GRUB_GFXPAYLOAD_LINUX=text' >>/etc/default/grub
GRUB_MKCONFIG="grub2-mkconfig -o $GRUB_CFG"
case $DIST in
'Ubuntu'|'Debian')
sed -i -e 's/\(^GRUB_CMDLINE_LINUX.*\)"$/\1 nofb nomodeset vga=normal"/' /etc/default/grub
GRUB_MKCONFIG=update-grub
;;
'Fedora')
echo 'GRUB_CMDLINE_LINUX="nofb nomodeset vga=normal"' >>/etc/default/grub
;;
'openSUSE project')
sed -i -e 's/\(^GRUB_CMDLINE_LINUX.*\)"$/\1 nofb nomodeset vga=normal"/' /etc/default/grub
;;
esac
$GRUB_MKCONFIG
RELEASE=`lsb_release -cs`
[ -n "$RELEASE" ]
# grub-mkconfig generates a config with the device in it,

View File

@ -1,26 +0,0 @@
#!/bin/bash
set -e
# If lsb_release is missing, just do nothing.
DISTRO=`lsb_release -si` || true
GRUBFILE=""
echo 'GRUB_TERMINAL=console' >>/etc/default/grub
echo 'GRUB_GFXPAYLOAD_LINUX=text' >>/etc/default/grub
case $DISTRO in
'Ubuntu'|'Debian')
sed -i -e 's/\(^GRUB_CMDLINE_LINUX.*\)"$/\1 nofb nomodeset vga=normal"/' /etc/default/grub
update-grub
;;
'Fedora')
# By default the F19 cloud image is using extlinux to boot the image
if [ -f /boot/grub2/grub.cfg ]; then
echo 'GRUB_CMDLINE_LINUX="nofb nomodeset vga=normal"' >/etc/default/grub
sed -i -e 's/terminal_output gfxterm/terminal_output console/' /boot/grub2/grub.cfg
grub2-mkconfig -o /boot/grub2/grub.cfg
fi
;;
esac