summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/DiskImage.hs
diff options
context:
space:
mode:
authorJoey Hess2017-11-17 15:14:02 -0400
committerJoey Hess2017-11-17 15:14:02 -0400
commit1a837867b8ae264fee2b9bacc8fd2a86d0f78ec8 (patch)
treebab422c65e7c8e93ad299351fe7a5a7c7bb39f43 /src/Propellor/Property/DiskImage.hs
parentf9565ef960a321819fe0760a1277f17c087b5a18 (diff)
update initramfs and flash-kernel during disk image finalization
flashKernelMounted is slightly cargo culted from Grub.bootsMounted, could be refactored. This commit was sponsored by Thom May on Patreon.
Diffstat (limited to 'src/Propellor/Property/DiskImage.hs')
-rw-r--r--src/Propellor/Property/DiskImage.hs24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/Propellor/Property/DiskImage.hs b/src/Propellor/Property/DiskImage.hs
index 69a4b188..08306106 100644
--- a/src/Propellor/Property/DiskImage.hs
+++ b/src/Propellor/Property/DiskImage.hs
@@ -28,6 +28,7 @@ import qualified Propellor.Property.Grub as Grub
import qualified Propellor.Property.File as File
import qualified Propellor.Property.Apt as Apt
import qualified Propellor.Property.Qemu as Qemu
+import qualified Propellor.Property.FlashKernel as FlashKernel
import Propellor.Property.Parted
import Propellor.Property.Fstab (SwapPartition(..), genFstab)
import Propellor.Property.Partition
@@ -193,13 +194,14 @@ imageBuilt' rebuild img mkchroot tabletype partspec =
-- installed.
final = case fromInfo (containerInfo chroot) of
[] -> unbootable "no bootloader is installed"
- l -> case filter (not . ignorablefinal) l of
- [] -> \_ _ _ -> doNothing
- [GrubInstalled] -> grubFinalized
- [UbootInstalled p] -> ubootFinalized p
- _ -> unbootable $ "multiple bootloaders are installed; don't know which to use: " ++ show l
- ignorablefinal FlashKernelInstalled = True
- ignorablefinal _ = False
+ [GrubInstalled] -> grubFinalized
+ [UbootInstalled p] -> ubootFinalized p
+ [FlashKernelInstalled] -> flashKernelFinalized
+ [UbootInstalled p, FlashKernelInstalled] ->
+ ubootFlashKernelFinalized p
+ [FlashKernelInstalled, UbootInstalled p] ->
+ ubootFlashKernelFinalized p
+ _ -> unbootable "multiple bootloaders are installed; don't know which to use"
-- | This property is automatically added to the chroot when building a
-- disk image. It cleans any caches of information that can be omitted;
@@ -427,6 +429,14 @@ grubFinalized _img mnt loopdevs = Grub.bootsMounted mnt wholediskloopdev
ubootFinalized :: (FilePath -> FilePath -> Property Linux) -> Finalization
ubootFinalized p (RawDiskImage img) mnt _loopdevs = p img mnt
+flashKernelFinalized :: Finalization
+flashKernelFinalized _img mnt _loopdevs = FlashKernel.flashKernelMounted mnt
+
+ubootFlashKernelFinalized :: (FilePath -> FilePath -> Property Linux) -> Finalization
+ubootFlashKernelFinalized p img mnt loopdevs =
+ ubootFinalized p img mnt loopdevs
+ `before` flashKernelFinalized img mnt loopdevs
+
isChild :: FilePath -> Maybe MountPoint -> Bool
isChild mntpt (Just d)
| d `equalFilePath` mntpt = False