From d9866a1ba5d0a4adca8bd026c652b762302bba45 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 5 Sep 2017 16:30:58 -0400 Subject: move parseFs to Property.Partition --- src/Propellor/Property/Lvm.hs | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'src/Propellor/Property/Lvm.hs') diff --git a/src/Propellor/Property/Lvm.hs b/src/Propellor/Property/Lvm.hs index e1f3b934..c5d215bc 100644 --- a/src/Propellor/Property/Lvm.hs +++ b/src/Propellor/Property/Lvm.hs @@ -142,27 +142,15 @@ lvState lv = do then return Nothing else do s <- readLvSize - fs <- readFs + fs <- maybe Nothing (Partition.parseFs . takeWhile (/= '\n')) <$> readFs return $ do size <- s - return $ LvState size $ parseFs $ - takeWhile (/= '\n') <$> fs + return $ LvState size fs where readLvSize = catchDefaultIO Nothing $ readish <$> readProcess "lvs" [ "-o", "size", "--noheadings", "--nosuffix", "--units", "b", vglv lv ] readFs = Mount.blkidTag "TYPE" (path lv) - parseFs (Just "ext2") = Just Partition.EXT2 - parseFs (Just "ext3") = Just Partition.EXT3 - parseFs (Just "ext4") = Just Partition.EXT4 - parseFs (Just "btrfs") = Just Partition.BTRFS - parseFs (Just "reiserfs") = Just Partition.REISERFS - parseFs (Just "xfs") = Just Partition.XFS - parseFs (Just "fat") = Just Partition.FAT - parseFs (Just "vfat") = Just Partition.VFAT - parseFs (Just "ntfs") = Just Partition.NTFS - parseFs (Just "swap") = Just Partition.LinuxSwap - parseFs _ = Nothing -- Read extent size (or Nothing on error). vgExtentSize :: VolumeGroup -> IO (Maybe Integer) -- cgit v1.3-2-g0d8e