summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Mount.hs
diff options
context:
space:
mode:
authorJoey Hess2015-09-03 08:53:40 -0700
committerJoey Hess2015-09-03 08:54:06 -0700
commit43a67e310740e58707d0a7908237641ef46f5ae6 (patch)
tree89df6bbb593bc85f8a443316c16dd4cd893f97d1 /src/Propellor/Property/Mount.hs
parentf158d1cf81c2fe4ece5320dd725496043e5b953d (diff)
parent776b4dc3b24f8d30fa0fe56254c16e613d8e0bbe (diff)
Merge branch 'joeyconfig'
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]