diff options
| author | Joey Hess <id@joeyh.name> | 2014-12-05 17:54:45 -0400 |
|---|---|---|
| committer | Joey Hess <id@joeyh.name> | 2014-12-05 17:54:45 -0400 |
| commit | a6e756791e365955445e7cd0decd478a51c88fed (patch) | |
| tree | d6395f75cfb33384f9edf9656b06b88ad369e4ad /src/Propellor | |
| parent | 9805f132ac6440bb8c2ca5957101db2cb59428c7 (diff) | |
| parent | a7e71faaaa0ed2672b956691833ca6c3a3431189 (diff) | |
Merge branch 'joeyconfig'
Diffstat (limited to 'src/Propellor')
| -rw-r--r-- | src/Propellor/Property/Mount.hs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/Propellor/Property/Mount.hs b/src/Propellor/Property/Mount.hs new file mode 100644 index 00000000..f4d10302 --- /dev/null +++ b/src/Propellor/Property/Mount.hs @@ -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] |
