Fix for host env leak into grub
While building images in a dual boot host, /dev/sda is leaking into build's grub config. It is visible in the logs that the commands GRUB-INSTALL and GRUB-MKCONFIG probes Host OS environment. This is avoided by setting grub_disable_os_prober to true in /default/grub config file. Change-Id: I7408de7b3bc8a62f8bf103f00a88a596f988353c Closes-Bug: 1166491
This commit is contained in:
parent
f4ba47467b
commit
697e771e4d
@ -135,8 +135,24 @@ function install_grub2 {
|
|||||||
sed -i -e 's/\(^GRUB_CMDLINE_LINUX.*\)"$/\1 nofb nomodeset vga=normal"/' /etc/default/grub
|
sed -i -e 's/\(^GRUB_CMDLINE_LINUX.*\)"$/\1 nofb nomodeset vga=normal"/' /etc/default/grub
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# os-prober leaks /dev/sda into config file in dual-boot host
|
||||||
|
# Disable grub-os-prober to avoid the issue while running
|
||||||
|
# grub-mkconfig
|
||||||
|
# Setting a flag to track whether the entry is already there in grub config
|
||||||
|
PROBER_DISABLED=
|
||||||
|
if ! grep -qe "^\s*GRUB_DISABLE_OS_PROBER=true" /etc/default/grub; then
|
||||||
|
PROBER_DISABLED=true
|
||||||
|
echo 'GRUB_DISABLE_OS_PROBER=true' >> /etc/default/grub
|
||||||
|
fi
|
||||||
|
|
||||||
$GRUB_MKCONFIG
|
$GRUB_MKCONFIG
|
||||||
|
|
||||||
|
# Remove the fix to disable os_prober
|
||||||
|
if [ -n "$PROBER_DISABLED" ]; then
|
||||||
|
sed -i '$d' /etc/default/grub
|
||||||
|
fi
|
||||||
|
|
||||||
RELEASE=`lsb_release -cs`
|
RELEASE=`lsb_release -cs`
|
||||||
[ -n "$RELEASE" ]
|
[ -n "$RELEASE" ]
|
||||||
# grub-mkconfig generates a config with the device in it,
|
# grub-mkconfig generates a config with the device in it,
|
||||||
|
Loading…
Reference in New Issue
Block a user