summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/DiskImage.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Propellor/Property/DiskImage.hs')
-rw-r--r--src/Propellor/Property/DiskImage.hs19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/Propellor/Property/DiskImage.hs b/src/Propellor/Property/DiskImage.hs
index 79865db4..c9998d3c 100644
--- a/src/Propellor/Property/DiskImage.hs
+++ b/src/Propellor/Property/DiskImage.hs
@@ -274,13 +274,18 @@ partitionsPopulated chrootdir mnts mntopts devs = property' desc $ \w ->
desc = "partitions populated from " ++ chrootdir
go _ Nothing _ _ = noChange
- go w (Just mnt) mntopt loopdev = withTmpDir "mnt" $ \tmpdir -> bracket
- (liftIO $ mount "auto" (partitionLoopDev loopdev) tmpdir mntopt)
- (const $ liftIO $ umountLazy tmpdir)
- $ \ismounted -> if ismounted
- then ensureProperty w $
- syncDirFiltered (filtersfor mnt) (chrootdir ++ mnt) tmpdir
- else return FailedChange
+ go w (Just mnt) mntopt loopdev = ifM (liftIO $ doesDirectoryExist srcdir) $
+ ( withTmpDir "mnt" $ \tmpdir -> bracket
+ (liftIO $ mount "auto" (partitionLoopDev loopdev) tmpdir mntopt)
+ (const $ liftIO $ umountLazy tmpdir)
+ $ \ismounted -> if ismounted
+ then ensureProperty w $
+ syncDirFiltered (filtersfor mnt) srcdir tmpdir
+ else return FailedChange
+ , return NoChange
+ )
+ where
+ srcdir = chrootdir ++ mnt
filtersfor mnt =
let childmnts = map (drop (length (dropTrailingPathSeparator mnt))) $