summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/DiskImage.hs
diff options
context:
space:
mode:
authorJoey Hess2015-09-01 11:24:02 -0700
committerJoey Hess2015-09-01 11:24:02 -0700
commit804622719b8a348bfdd32f427502e0529d50a8ed (patch)
tree42a7c0be0541c177db996e03659f31cf1d86bb6d /src/Propellor/Property/DiskImage.hs
parente85a15d160005929a9d5ea5cb21c25751856c5ae (diff)
removal of chroot on disk image rebuild
Diffstat (limited to 'src/Propellor/Property/DiskImage.hs')
-rw-r--r--src/Propellor/Property/DiskImage.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/Propellor/Property/DiskImage.hs b/src/Propellor/Property/DiskImage.hs
index f649b7bb..54fa8945 100644
--- a/src/Propellor/Property/DiskImage.hs
+++ b/src/Propellor/Property/DiskImage.hs
@@ -15,6 +15,7 @@ module Propellor.Property.DiskImage (
import Propellor
import Propellor.Property.Chroot (Chroot)
+import Propellor.Property.Chroot.Util (removeChroot)
import qualified Propellor.Property.Chroot as Chroot
import Propellor.Property.Parted
import qualified Propellor.Property.Grub as Grub
@@ -56,6 +57,7 @@ built' :: Bool -> FilePath -> (FilePath -> Chroot) -> MkPartTable -> DiskImageFi
built' rebuild img mkchroot mkparttable final =
(mkimg <!> unmkimg)
`requires` Chroot.provisioned (mkchroot chrootdir)
+ `requires` (handlerebuild <!> doNothing)
`describe` desc
where
desc = "built disk image " ++ img
@@ -70,6 +72,11 @@ built' rebuild img mkchroot mkparttable final =
exists img disksz
`before`
partitioned YesReallyDeleteDiskContents img t
+ handlerebuild
+ | rebuild = property desc $ do
+ liftIO $ removeChroot chrootdir
+ return MadeChange
+ | otherwise = doNothing
-- | Ensures that a disk image file of the specified size exists.
--