diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Propellor/Property/Parted.hs | 2 | ||||
| -rw-r--r-- | src/Propellor/Property/Partition.hs | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/Propellor/Property/Parted.hs b/src/Propellor/Property/Parted.hs index f463164e..aa7bece4 100644 --- a/src/Propellor/Property/Parted.hs +++ b/src/Propellor/Property/Parted.hs @@ -77,7 +77,7 @@ instance PartedVal PartType where val Extended = "extended" -- | All partition sizing is done in megabytes, so that parted can --- automatically lay out the partitions. +-- automatically lay out the partitions. -- -- Note that these are SI megabytes, not mebibytes. newtype MegaBytes = MegaBytes Integer diff --git a/src/Propellor/Property/Partition.hs b/src/Propellor/Property/Partition.hs index 53d8a946..41bdf795 100644 --- a/src/Propellor/Property/Partition.hs +++ b/src/Propellor/Property/Partition.hs @@ -45,10 +45,12 @@ kpartx :: FilePath -> ([FilePath] -> Property NoInfo) -> Property NoInfo kpartx diskimage mkprop = go `requires` Apt.installed ["kpartx"] where go = property (propertyDesc (mkprop [])) $ do + cleanup -- idempotency s <- liftIO $ readProcess "kpartx" ["-avs", diskimage] r <- ensureProperty (mkprop (devlist s)) - void $ liftIO $ boolSystem "kpartx" [Param "-d", File diskimage] + cleanup return r devlist = mapMaybe (finddev . words) . lines finddev ("add":"map":s:_) = Just ("/dev/mapper/" ++ s) finddev _ = Nothing + cleanup = void $ liftIO $ boolSystem "kpartx" [Param "-d", File diskimage] |
