summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Machine.hs
diff options
context:
space:
mode:
authorJoey Hess2017-11-19 15:21:53 -0400
committerJoey Hess2017-11-19 15:21:53 -0400
commitc7a8c812add892eb7f7b7068d258efa01095fcde (patch)
treeff9100d6847b8f8007beec8761e48e5875eae53a /src/Propellor/Property/Machine.hs
parent143996429e594def4c31d1346713433335758128 (diff)
partition table in Info
Diskimage.imageBuiltFor: New property to build a disk image for a Host, using partition table information configured via the new properties hasPartitionTableType, hasPartition and adjustPartition. This lets Machine properties include eg /boot partitions that are known to be needed by the bootloader, and the user can adjust those partitions and add others. This commit was sponsored by Brock Spratlen on Patreon.
Diffstat (limited to 'src/Propellor/Property/Machine.hs')
-rw-r--r--src/Propellor/Property/Machine.hs53
1 files changed, 45 insertions, 8 deletions
diff --git a/src/Propellor/Property/Machine.hs b/src/Propellor/Property/Machine.hs
index b4ffc008..ec522c21 100644
--- a/src/Propellor/Property/Machine.hs
+++ b/src/Propellor/Property/Machine.hs
@@ -17,6 +17,31 @@
-- firmware, but if the non-free firmware is only needed for non-critical
-- functionality, it won't be included.
+-- | Example: Building a disk image for a Marvell SheevaPlug
+--
+-- This defines a Host "sheeva" that is a Marvell SheevaPlug.
+-- A bootable disk image for "sheeva" is built on another machine
+-- "darkstar", which can be eg an Intel laptop running Debian.
+--
+-- > import Propellor.Property.Machine
+-- > import Propellor.Property.DiskImage
+-- >
+-- > sheeva :: Host
+-- > sheeva = host "sheeva.example.com" $ props
+-- > & osDebian Unstable ARMEL
+-- > & marvell_SheevaPlug Marvell_SheevaPlug_SDCard
+-- > & hasPartiton
+-- > ( partition EXT4
+-- > `mountedAt` "/"
+-- > `addFreeSpace` MegaBytes 2048
+-- > )
+-- >
+-- > darkstar :: Host
+-- > darkstar = host "darkstar.example.com" $ props
+-- > & imageBuiltFor sheeva
+-- > (RawDiskImage "/srv/sheeva-disk.img")
+-- > (Debootstrapped mempty)
+
module Propellor.Property.Machine (
-- * ARM boards
Marvell_SheevaPlug_BootDevice(..),
@@ -41,25 +66,37 @@ import Propellor.Types.Core
import qualified Propellor.Property.Apt as Apt
import qualified Propellor.Property.FlashKernel as FlashKernel
import qualified Propellor.Property.Uboot as Uboot
+import Propellor.Property.DiskImage.PartSpec
data Marvell_SheevaPlug_BootDevice
= Marvell_SheevaPlug_SDCard
| Marvell_SheevaPlug_ESATA
--- | Marvel SheevaPlug
+-- | Marvell SheevaPlug
--
--- Needs a small /boot partition formatted EXT2
+-- This includes a small EXT2 formatted /boot partition.
--
-- Note that u-boot may need to be upgraded manually, and will need to be
-- configured to boot from the SD card or eSATA. See
-- https://www.cyrius.com/debian/kirkwood/sheevaplug/install/
marvell_SheevaPlug :: Marvell_SheevaPlug_BootDevice -> Property (HasInfo + DebianLike)
-marvell_SheevaPlug Marvell_SheevaPlug_SDCard =
- FlashKernel.installed "Marvell SheevaPlug Reference Board"
- `requires` marvell
-marvell_SheevaPlug Marvell_SheevaPlug_ESATA =
- FlashKernel.installed "Marvell eSATA SheevaPlug Reference Board"
- `requires` marvell
+marvell_SheevaPlug bd = fk
+ `requires` marvell
+ `requires` hasPartition bootpart
+ where
+ fk = case bd of
+ Marvell_SheevaPlug_SDCard ->
+ FlashKernel.installed "Marvell SheevaPlug Reference Board"
+ Marvell_SheevaPlug_ESATA ->
+ FlashKernel.installed "Marvell eSATA SheevaPlug Reference Board"
+ -- The boot loader needs an EXT2 boot partition, which comes
+ -- first. Add some free space to allow for additional kernel images
+ -- and initrds.
+ bootpart :: PartSpec PartLocation
+ bootpart = partition EXT2
+ `mountedAt` "/boot"
+ `partLocation` Beginning
+ `addFreeSpace` MegaBytes 150
-- | Cubietech Cubietruck
--