summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Mount.hs
diff options
context:
space:
mode:
authorJoey Hess2015-09-02 11:13:36 -0700
committerJoey Hess2015-09-02 11:13:36 -0700
commitd2393d8141ac302eff5dc29d32d68014b630d166 (patch)
tree629d1e427e8dd53033bf8e3717e91497dcc51a3f /src/Propellor/Property/Mount.hs
parentbce9d314a94a1378ee35a4575aa7ecadf5967e62 (diff)
propellor spin
Diffstat (limited to 'src/Propellor/Property/Mount.hs')
-rw-r--r--src/Propellor/Property/Mount.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Propellor/Property/Mount.hs b/src/Propellor/Property/Mount.hs
index 43ca0cc6..4070ebcb 100644
--- a/src/Propellor/Property/Mount.hs
+++ b/src/Propellor/Property/Mount.hs
@@ -29,6 +29,12 @@ umountLazy mnt =
unlessM (boolSystem "umount" [ Param "-l", Param mnt ]) $
errorMessage $ "failed unmounting " ++ mnt
+-- | Unmounts anything mounted inside the specified directory.
+unmountBelow :: FilePath -> IO ()
+unmountBelow d = do
+ submnts <- mountPointsBelow d
+ forM_ submnts umountLazy
+
-- | Mounts a device.
mount :: FsType -> Source -> FilePath -> IO Bool
mount fs src mnt = boolSystem "mount" [Param "-t", Param fs, Param src, Param mnt]