Merge branch 'joeyconfig'

This commit is contained in:
Joey Hess 2014-12-05 17:54:45 -04:00
commit a6e756791e
1 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,23 @@
module Propellor.Property.Mount where
import Propellor
import Utility.SafeCommand
type FsType = String
type Source = String
mountPoints :: IO [FilePath]
mountPoints = lines <$> readProcess "findmnt" ["-rn", "--output", "target"]
getFsType :: FilePath -> IO (Maybe FsType)
getFsType mnt = catchDefaultIO Nothing $
headMaybe . lines
<$> readProcess "findmnt" ["-n", mnt, "--output", "fstype"]
umountLazy :: FilePath -> IO ()
umountLazy mnt =
unlessM (boolSystem "umount" [ Param "-l", Param mnt ]) $
errorMessage $ "failed unmounting " ++ mnt
mount :: FsType -> Source -> FilePath -> IO Bool
mount fs src mnt = boolSystem "mount" [Param "-t", Param fs, Param src, Param mnt]