summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/DiskImage.hs
diff options
context:
space:
mode:
authorJoey Hess2015-09-04 15:04:07 -0700
committerJoey Hess2015-09-04 15:04:07 -0700
commitc796ff513c71783ace1c3265bb63bc12e7e7a366 (patch)
treefe8226254059bdaba7eb83749af95da97895ce5a /src/Propellor/Property/DiskImage.hs
parent36ba6022f63fc563743cab8c5a64693b9a755774 (diff)
propellor spin
Diffstat (limited to 'src/Propellor/Property/DiskImage.hs')
-rw-r--r--src/Propellor/Property/DiskImage.hs15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/Propellor/Property/DiskImage.hs b/src/Propellor/Property/DiskImage.hs
index d7fd6a04..7a3460cb 100644
--- a/src/Propellor/Property/DiskImage.hs
+++ b/src/Propellor/Property/DiskImage.hs
@@ -1,6 +1,10 @@
-- | Disk image generation.
--
-- This module is designed to be imported unqualified.
+--
+-- TODO run final
+--
+-- TODO avoid starting services while populating chroot and running final
module Propellor.Property.DiskImage (
-- * Properties
@@ -105,9 +109,6 @@ imageBuilt' rebuild img mkchroot tabletype partspec final =
-- | Builds a disk image from the contents of a chroot.
--
-- The passed property is run inside the mounted disk image.
---
--- TODO copy in
--- TODO run final
imageBuiltFrom :: DiskImage -> FilePath -> TableType -> [PartSpec] -> Property NoInfo -> RevertableProperty
imageBuiltFrom img chrootdir tabletype partspec final = mkimg <!> rmimg
where
@@ -221,14 +222,18 @@ type MountPoint = Maybe FilePath
defSz :: PartSize
defSz = MegaBytes 128
+-- Add 2% for filesystem overhead. Rationalle for picking 2%:
+-- A filesystem with 1% overhead might just sneak by as acceptable.
+-- Double that just in case. Add an additional 3 mb to deal with
+-- non-scaling overhead, of filesystems (eg, superblocks).
fudge :: PartSize -> PartSize
-fudge (MegaBytes n) = MegaBytes (n + n `div` 10)
+fudge (MegaBytes n) = MegaBytes (n + n `div` 100 * 2 + 3)
-- | Specifies a mount point and a constructor for a Partition.
--
-- The size that is eventually provided is the amount of space needed to
-- hold the files that appear in the directory where the partition is to be
--- mounted. Plus a 10% fudge factor, since filesystems have some space
+-- mounted. Plus a fudge factor, since filesystems have some space
-- overhead.
--
-- (Partitions that are not to be mounted (ie, LinuxSwap), or that have