summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog2
-rw-r--r--doc/forum/support_for_non-bootable_disk_images/comment_5_ee60d5bf1cdd1fd0e4319eed99f614c1._comment13
-rw-r--r--propellor.cabal1
-rw-r--r--src/Propellor/Property/DirectBoot.hs7
-rw-r--r--src/Propellor/Property/DiskImage.hs15
-rw-r--r--src/Propellor/Types/Bootloader.hs4
6 files changed, 28 insertions, 14 deletions
diff --git a/debian/changelog b/debian/changelog
index cc0e0a15..b0f7121b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -15,6 +15,8 @@ propellor (5.5.0) UNRELEASED; urgency=medium
the line to /etc/sudoers, but that would override more specific lines
in the include directory.
* Borg: Added UsesEnvVar.
+ * Added DiskImage.noBootloader, useful for eg, direct booting with
+ qemu. Thanks, David Bremner.
-- Joey Hess <id@joeyh.name> Thu, 09 Aug 2018 10:54:41 -0400
diff --git a/doc/forum/support_for_non-bootable_disk_images/comment_5_ee60d5bf1cdd1fd0e4319eed99f614c1._comment b/doc/forum/support_for_non-bootable_disk_images/comment_5_ee60d5bf1cdd1fd0e4319eed99f614c1._comment
new file mode 100644
index 00000000..9ebe3062
--- /dev/null
+++ b/doc/forum/support_for_non-bootable_disk_images/comment_5_ee60d5bf1cdd1fd0e4319eed99f614c1._comment
@@ -0,0 +1,13 @@
+[[!comment format=mdwn
+ username="joey"
+ subject="""comment 5"""
+ date="2018-10-14T00:39:51Z"
+ content="""
+Ah right, [[todo/support_for_libvirt_KVM_VMs]];
+your patch is kind of a prerequisite for that. Pulling the kernel and
+initrd out of the chroot is a good idea!
+
+"Host" is slightly ambiguous around disk image building because
+a disk image can be built for a Host by `imageBuiltFor`. I've gone ahead
+and merged it in with the NoBootloader name.
+"""]]
diff --git a/propellor.cabal b/propellor.cabal
index 518505a4..0454fc92 100644
--- a/propellor.cabal
+++ b/propellor.cabal
@@ -74,7 +74,6 @@ 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
deleted file mode 100644
index 4807471e..00000000
--- a/src/Propellor/Property/DirectBoot.hs
+++ /dev/null
@@ -1,7 +0,0 @@
-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/Property/DiskImage.hs b/src/Propellor/Property/DiskImage.hs
index a41af18c..fa41808e 100644
--- a/src/Propellor/Property/DiskImage.hs
+++ b/src/Propellor/Property/DiskImage.hs
@@ -18,6 +18,7 @@ module Propellor.Property.DiskImage (
imageBuiltFrom,
imageExists,
GrubTarget(..),
+ noBootloader,
) where
import Propellor.Base
@@ -228,7 +229,7 @@ imageBuilt' rebuild img mkchroot tabletype partspec =
ubootFlashKernelFinalized p
[FlashKernelInstalled, UbootInstalled p] ->
ubootFlashKernelFinalized p
- [DirectBoot] -> directBootFinalized
+ [NoBootloader] -> noBootloaderFinalized
_ -> unbootable "multiple bootloaders are installed; don't know which to use"
-- | This property is automatically added to the chroot when building a
@@ -470,9 +471,6 @@ 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
@@ -481,6 +479,15 @@ ubootFlashKernelFinalized p img mnt loopdevs =
ubootFinalized p img mnt loopdevs
`before` flashKernelFinalized img mnt loopdevs
+-- | Normally a boot loader is installed on a disk image. However,
+-- when the disk image will be booted by eg qemu booting the kernel and
+-- initrd, no boot loader is needed, and this property can be used.
+noBootloader :: Property (HasInfo + UnixLike)
+noBootloader = pureInfoProperty "no bootloader" [NoBootloader]
+
+noBootloaderFinalized :: Finalization
+noBootloaderFinalized _img _mnt _loopDevs = doNothing
+
isChild :: FilePath -> Maybe MountPoint -> Bool
isChild mntpt (Just d)
| d `equalFilePath` mntpt = False
diff --git a/src/Propellor/Types/Bootloader.hs b/src/Propellor/Types/Bootloader.hs
index cdb37a31..52a6da02 100644
--- a/src/Propellor/Types/Bootloader.hs
+++ b/src/Propellor/Types/Bootloader.hs
@@ -10,7 +10,7 @@ data BootloaderInstalled
= GrubInstalled GrubTarget
| FlashKernelInstalled
| UbootInstalled (FilePath -> FilePath -> Property Linux)
- | DirectBoot
+ | NoBootloader
deriving (Typeable)
-- | Platforms that grub can boot.
@@ -20,7 +20,7 @@ instance Show BootloaderInstalled where
show (GrubInstalled _) = "GrubInstalled"
show FlashKernelInstalled = "FlashKernelInstalled"
show (UbootInstalled _) = "UbootInstalled"
- show DirectBoot = "DirectBoot"
+ show NoBootloader = "NoBootloader"
instance IsInfo [BootloaderInstalled] where
propagateInfo _ = PropagateInfo False