summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Parted.hs
diff options
context:
space:
mode:
authorJoey Hess2015-09-02 11:27:25 -0700
committerJoey Hess2015-09-02 11:27:25 -0700
commite63158e270129b39b19a58b9952b9235570a393d (patch)
treee0758c236c0b320bf639e73aac86ea223bf536df /src/Propellor/Property/Parted.hs
parentc198daea0b8245279d9850b70f708308bb6a26f9 (diff)
run parted before kpartex
Diffstat (limited to 'src/Propellor/Property/Parted.hs')
-rw-r--r--src/Propellor/Property/Parted.hs12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/Propellor/Property/Parted.hs b/src/Propellor/Property/Parted.hs
index 4e2efe24..fcff089a 100644
--- a/src/Propellor/Property/Parted.hs
+++ b/src/Propellor/Property/Parted.hs
@@ -147,13 +147,15 @@ data Eep = YesReallyDeleteDiskContents
partitioned :: Eep -> FilePath -> PartTable -> Property NoInfo
partitioned eep disk (PartTable tabletype parts) = property desc $ do
isdev <- liftIO $ isBlockDevice <$> getFileStatus disk
- ensureProperty $ if isdev
- then go (map (\n -> disk ++ show n) [1 :: Int ..])
- else Partition.kpartx disk go
+ ensureProperty $ combineProperties desc
+ [ parted eep disk partedparams
+ , if isdev
+ then formatl (map (\n -> disk ++ show n) [1 :: Int ..])
+ else Partition.kpartx disk formatl
+ ]
where
desc = disk ++ " partitioned"
- go devs = combineProperties desc $
- parted eep disk partedparams : map format (zip parts devs)
+ formatl devs = combineProperties desc (map format (zip parts devs))
partedparams = concat $ mklabel : mkparts (1 :: Integer) mempty parts []
format (p, dev) = Partition.formatted' (partMkFsOpts p)
Partition.YesReallyFormatPartition (partFs p) dev