More robust detection of GRUB_TERMINAL=console, autocomment GRUB_TERMINAL_OUTPUT=console

This commit is contained in:
Stuart Hayhurst 2020-10-18 16:33:19 +01:00
parent 70152af6d2
commit a32502f6ed

View File

@ -189,9 +189,14 @@ install() {
echo "${gfxmode}" >> /etc/default/grub
fi
if grep "GRUB_TERMINAL=console" /etc/default/grub 2>&1 >/dev/null; then
if grep "GRUB_TERMINAL=console" /etc/default/grub 2>&1 >/dev/null || grep "GRUB_TERMINAL=\"console\"" /etc/default/grub 2>&1 >/dev/null; then
#Replace GRUB_TERMINAL
sed -i "s|.*GRUB_TERMINAL=console.*|#GRUB_TERMINAL=console|" /etc/default/grub
sed -i "s|.*GRUB_TERMINAL=.*|#GRUB_TERMINAL=console|" /etc/default/grub
fi
if grep "GRUB_TERMINAL_OUTPUT=console" /etc/default/grub 2>&1 >/dev/null || grep "GRUB_TERMINAL_OUTPUT=\"console\"" /etc/default/grub 2>&1 >/dev/null; then
#Replace GRUB_TERMINAL_OUTPUT
sed -i "s|.*GRUB_TERMINAL_OUTPUT=.*|#GRUB_TERMINAL_OUTPUT=console|" /etc/default/grub
fi
# Update grub config