summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog2
-rw-r--r--src/Propellor/Property/File.hs5
2 files changed, 6 insertions, 1 deletions
diff --git a/debian/changelog b/debian/changelog
index e92a24e1..7917bbf6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -21,6 +21,8 @@ propellor (4.1.0) UNRELEASED; urgency=medium
* Propellor.Property.XFCE added with some useful properties for the
desktop environment.
* Added File.applyPath property.
+ * File.isCopyOf: Fix bug that prevented this property from working
+ when the destination file did not yet exist.
-- Joey Hess <id@joeyh.name> Tue, 20 Jun 2017 10:55:37 -0400
diff --git a/src/Propellor/Property/File.hs b/src/Propellor/Property/File.hs
index b1e72989..8d10b94c 100644
--- a/src/Propellor/Property/File.hs
+++ b/src/Propellor/Property/File.hs
@@ -154,7 +154,10 @@ f `isCopyOf` src = property desc $ go =<< (liftIO $ tryIO $ getFileStatus src)
where
desc = f ++ " is copy of " ++ src
go (Right stat) = if isRegularFile stat
- then gocmp =<< (liftIO $ cmp)
+ then ifM (liftIO $ doesFileExist f)
+ ( gocmp =<< (liftIO $ cmp)
+ , doit
+ )
else warningMessage (src ++ " is not a regular file") >>
return FailedChange
go (Left e) = warningMessage (show e) >> return FailedChange