From c1b1534c87dbb6b355ae93024135479364c13ac4 Mon Sep 17 00:00:00 2001 From: Doug Szumski Date: Tue, 15 May 2018 15:19:37 +0100 Subject: [PATCH] Remove duplicate GRUB command line entry Without this change DIB appends a second command line entry to the GRUB config. This causes the original command line entry to be ignored when Linux is booted. The expected behaviour is that DIB appends to the existing entry as it does for Ubuntu and SUSE. Following discussion on the review, this also removes the distro specific switch statement, as update-grub just calls grub-mkconfig, meaning that there was nothing distro specific in the first place. Change-Id: I2298675dda1f699c572b3423e7274bc8bd7c1c9d Closes-Bug: #1771366 --- .../elements/bootloader/finalise.d/50-bootloader | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/diskimage_builder/elements/bootloader/finalise.d/50-bootloader b/diskimage_builder/elements/bootloader/finalise.d/50-bootloader index 5e8c2d28..99486a48 100755 --- a/diskimage_builder/elements/bootloader/finalise.d/50-bootloader +++ b/diskimage_builder/elements/bootloader/finalise.d/50-bootloader @@ -187,24 +187,13 @@ function install_grub2 { echo "GRUB_CMDLINE_LINUX_DEFAULT=\"${GRUB_CMDLINE_LINUX_DEFAULT}\"" >>/etc/default/grub echo 'GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"' >>/etc/default/grub + sed -i -e "s/\(^GRUB_CMDLINE_LINUX.*\)\"$/\1 ${DIB_BOOTLOADER_DEFAULT_CMDLINE}\"/" /etc/default/grub + if type grub2-mkconfig >/dev/null; then GRUB_MKCONFIG="grub2-mkconfig -o $GRUB_CFG" else GRUB_MKCONFIG="grub-mkconfig -o $GRUB_CFG" fi - DISTRO_NAME=${DISTRO_NAME:-} - case $DISTRO_NAME in - 'ubuntu'|'debian') - sed -i -e "s/\(^GRUB_CMDLINE_LINUX.*\)\"$/\1 ${DIB_BOOTLOADER_DEFAULT_CMDLINE}\"/" /etc/default/grub - GRUB_MKCONFIG=update-grub - ;; - 'fedora'|'centos7'|'centos') - echo "GRUB_CMDLINE_LINUX=\"${DIB_BOOTLOADER_DEFAULT_CMDLINE}\"" >>/etc/default/grub - ;; - 'opensuse') - sed -i -e "s/\(^GRUB_CMDLINE_LINUX.*\)\"$/\1 ${DIB_BOOTLOADER_DEFAULT_CMDLINE}\"/" /etc/default/grub - ;; - esac # os-prober leaks /dev/sda into config file in dual-boot host # Disable grub-os-prober to avoid the issue while running