From 80190c923ba28079ef23c4d630c9a7df3d4ee5c6 Mon Sep 17 00:00:00 2001 From: David Bremner Date: Sun, 7 Oct 2018 21:53:29 -0300 Subject: Add a DirectBoot bootloader type. This doesn't actually do anything to the chroot in question, just marks it as needing to be boot directly, e.g. by some external kernel and initrd. --- propellor.cabal | 1 + src/Propellor/Property/DirectBoot.hs | 7 +++++++ src/Propellor/Types/Bootloader.hs | 2 ++ 3 files changed, 10 insertions(+) create mode 100644 src/Propellor/Property/DirectBoot.hs diff --git a/propellor.cabal b/propellor.cabal index 0454fc92..518505a4 100644 --- a/propellor.cabal +++ b/propellor.cabal @@ -74,6 +74,7 @@ Library Propellor.Property.Cron Propellor.Property.DebianMirror Propellor.Property.Debootstrap + Propellor.Property.DirectBoot Propellor.Property.DiskImage Propellor.Property.DiskImage.PartSpec Propellor.Property.Dns diff --git a/src/Propellor/Property/DirectBoot.hs b/src/Propellor/Property/DirectBoot.hs new file mode 100644 index 00000000..4807471e --- /dev/null +++ b/src/Propellor/Property/DirectBoot.hs @@ -0,0 +1,7 @@ +module Propellor.Property.DirectBoot(installed) where + +import Propellor.Base +import Propellor.Types.Bootloader + +installed :: Property (HasInfo + UnixLike) +installed = pureInfoProperty "direct boot" [DirectBoot] diff --git a/src/Propellor/Types/Bootloader.hs b/src/Propellor/Types/Bootloader.hs index 65117bd2..cdb37a31 100644 --- a/src/Propellor/Types/Bootloader.hs +++ b/src/Propellor/Types/Bootloader.hs @@ -10,6 +10,7 @@ data BootloaderInstalled = GrubInstalled GrubTarget | FlashKernelInstalled | UbootInstalled (FilePath -> FilePath -> Property Linux) + | DirectBoot deriving (Typeable) -- | Platforms that grub can boot. @@ -19,6 +20,7 @@ instance Show BootloaderInstalled where show (GrubInstalled _) = "GrubInstalled" show FlashKernelInstalled = "FlashKernelInstalled" show (UbootInstalled _) = "UbootInstalled" + show DirectBoot = "DirectBoot" instance IsInfo [BootloaderInstalled] where propagateInfo _ = PropagateInfo False -- cgit v1.2.3 From ed118fb909ff5d5f5d030570878bdb1c0fe0ff18 Mon Sep 17 00:00:00 2001 From: David Bremner Date: Sun, 7 Oct 2018 22:15:31 -0300 Subject: add DirectBoot finalization Eventually this should perhaps copy the kernel and initrd out of the chroot. --- src/Propellor/Property/DiskImage.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Propellor/Property/DiskImage.hs b/src/Propellor/Property/DiskImage.hs index 289de151..a41af18c 100644 --- a/src/Propellor/Property/DiskImage.hs +++ b/src/Propellor/Property/DiskImage.hs @@ -228,6 +228,7 @@ imageBuilt' rebuild img mkchroot tabletype partspec = ubootFlashKernelFinalized p [FlashKernelInstalled, UbootInstalled p] -> ubootFlashKernelFinalized p + [DirectBoot] -> directBootFinalized _ -> unbootable "multiple bootloaders are installed; don't know which to use" -- | This property is automatically added to the chroot when building a @@ -469,6 +470,9 @@ grubFinalized grubtarget _img mnt loopdevs = ubootFinalized :: (FilePath -> FilePath -> Property Linux) -> Finalization ubootFinalized p (RawDiskImage img) mnt _loopdevs = p img mnt +directBootFinalized :: Finalization +directBootFinalized _img _mnt _loopDevs = doNothing + flashKernelFinalized :: Finalization flashKernelFinalized _img mnt _loopdevs = FlashKernel.flashKernelMounted mnt -- cgit v1.2.3