From 4b2f46e510080b6d5df0ee04a3fae8e53df1ea7a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 21 Dec 2017 00:12:01 -0400 Subject: Grub.boots, Grub.bootsMounted: Pass --target to grub-install. This is to support eg, coreboot. The GrubTarget passed to Grub.installed is introspected to determine --target. If multiple grubs are installed, it currently doesn't pass any --target. Might make more sense to run grub-install repeatedly, but I don't know if that case is sane at all. The Xen -> "x86_64-xen" mapping is kind of arbitrarily chosen since there's a i386-xen available too. I don't know when that case would be used in any case though; chainPVGrub uses installed Xen, but it does not run grub-install. If this does become a problem, would probably need to split it into Xen64 and Xen32. Renamed BIOS to GrubTarget in passing to match grub's terminology; BIOS was kind of a joke term for this in propellor. This commit was sponsored by Francois Marier on Patreon. --- src/Propellor/Property/DiskImage.hs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/Propellor/Property/DiskImage.hs') diff --git a/src/Propellor/Property/DiskImage.hs b/src/Propellor/Property/DiskImage.hs index 1f4f8118..24459476 100644 --- a/src/Propellor/Property/DiskImage.hs +++ b/src/Propellor/Property/DiskImage.hs @@ -17,7 +17,7 @@ module Propellor.Property.DiskImage ( imageRebuiltFor, imageBuiltFrom, imageExists, - Grub.BIOS(..), + GrubTarget(..), ) where import Propellor.Base @@ -221,7 +221,7 @@ imageBuilt' rebuild img mkchroot tabletype partspec = -- installed. final = case fromInfo (containerInfo chroot) of [] -> unbootable "no bootloader is installed" - [GrubInstalled] -> grubFinalized + [GrubInstalled grubtarget] -> grubFinalized grubtarget [UbootInstalled p] -> ubootFinalized p [FlashKernelInstalled] -> flashKernelFinalized [UbootInstalled p, FlashKernelInstalled] -> @@ -454,9 +454,10 @@ unbootable msg = \_ _ _ -> property desc $ do where desc = "image is not bootable" -grubFinalized :: Finalization -grubFinalized _img mnt loopdevs = Grub.bootsMounted mnt wholediskloopdev - `describe` "disk image boots using grub" +grubFinalized :: GrubTarget -> Finalization +grubFinalized grubtarget _img mnt loopdevs = + Grub.bootsMounted mnt wholediskloopdev grubtarget + `describe` "disk image boots using grub" where -- It doesn't matter which loopdev we use; all -- come from the same disk image, and it's the loop dev -- cgit v1.2.3