summaryrefslogtreecommitdiff
path: root/src/Propellor/Property
diff options
context:
space:
mode:
authorJoey Hess2015-10-22 20:22:52 -0400
committerJoey Hess2015-10-22 20:22:52 -0400
commitc84005cbbf432a8296ee44fec83227b15ce18d38 (patch)
tree59bc88f9decf944878deb707b3bef9a2e8116eda /src/Propellor/Property
parent69d1021c0c12bae52cbea2cc64399be4e4b3532f (diff)
propellor spin
Diffstat (limited to 'src/Propellor/Property')
-rw-r--r--src/Propellor/Property/DiskImage.hs2
-rw-r--r--src/Propellor/Property/Mount.hs6
2 files changed, 7 insertions, 1 deletions
diff --git a/src/Propellor/Property/DiskImage.hs b/src/Propellor/Property/DiskImage.hs
index cb38cef3..dcd522a3 100644
--- a/src/Propellor/Property/DiskImage.hs
+++ b/src/Propellor/Property/DiskImage.hs
@@ -331,7 +331,7 @@ grubBooted bios = (Grub.installed' bios, boots)
where
boots mnt loopdevs = combineProperties "disk image boots using grub"
-- bind mount host /dev so grub can access the loop devices
- [ mounted "bind" "/dev" (inmnt "/dev")
+ [ bindMount "/dev" (inmnt "/dev")
, mounted "proc" "proc" (inmnt "/proc")
, mounted "sysfs" "sys" (inmnt "/sys")
-- work around for http://bugs.debian.org/802717
diff --git a/src/Propellor/Property/Mount.hs b/src/Propellor/Property/Mount.hs
index 25984afa..09016011 100644
--- a/src/Propellor/Property/Mount.hs
+++ b/src/Propellor/Property/Mount.hs
@@ -40,5 +40,11 @@ mounted :: FsType -> Source -> FilePath -> Property NoInfo
mounted fs src mnt = property (mnt ++ " mounted") $
toResult <$> liftIO (mount fs src mnt)
+-- | Bind mounts the first directory so its contents also appear
+-- in the second directory.
+bindMount :: FilePath -> FilePath -> Property NoInfo
+bindMount src dest = cmdProperty "mount" ["--bind", src, dest]
+ `describe` ("bind mounted " ++ src ++ " to " ++ dest)
+
mount :: FsType -> Source -> FilePath -> IO Bool
mount fs src mnt = boolSystem "mount" [Param "-t", Param fs, Param src, Param mnt]