summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Ccache.hs
diff options
context:
space:
mode:
authorJoey Hess2016-06-21 11:08:24 -0400
committerJoey Hess2016-06-21 11:08:24 -0400
commit4db15a017a5defb2721803eae258a425ca74f8e9 (patch)
treeb402311e32dec9156b4990d0beeaf3cf2072e8ef /src/Propellor/Property/Ccache.hs
parent11f046f41a3f717b52e1f3a9d404427dd06a403e (diff)
parent632c2bb3639d043d7d9101b6fd2f198e6ac8cd8f (diff)
Merge remote-tracking branch 'spwhitton/reboot'
Diffstat (limited to 'src/Propellor/Property/Ccache.hs')
-rw-r--r--src/Propellor/Property/Ccache.hs30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/Propellor/Property/Ccache.hs b/src/Propellor/Property/Ccache.hs
index 34ed6761..54d84279 100644
--- a/src/Propellor/Property/Ccache.hs
+++ b/src/Propellor/Property/Ccache.hs
@@ -95,14 +95,40 @@ group@(Group g) `hasCache` limit = (make `requires` installed) <!> delete
& File.dirExists path
& File.ownerGroup path (User "root") group
& File.mode path (combineModes $
- readModes ++ executeModes
- ++ [ownerWriteMode, groupWriteMode])
+ readModes ++ executeModes ++
+ [ ownerWriteMode
+ , groupWriteMode
+ , setGroupIDMode
+ ]) `onChange` fixSetgidBit
+ -- ^ we use onChange to catch upgrades from
+ -- 3.0.5 where the setGroupIDMode line was not
+ -- present
& hasLimits path limit
delete = check (doesDirectoryExist path) $
cmdProperty "rm" ["-r", path] `assume` MadeChange
`describe` ("ccache for " ++ g ++ " does not exist")
+ -- Here we deal with a bug in Propellor 3.0.5. If the ccache was
+ -- created with that version, it will not have the setgid bit set. That
+ -- means its subdirectories won't have inherited the setgid bit, and
+ -- then the files in those directories won't be owned by group sbuild.
+ -- This breaks ccache.
+ fixSetgidBit :: Property UnixLike
+ fixSetgidBit =
+ (cmdProperty "find"
+ [ path
+ , "-type", "d"
+ , "-exec", "chmod", "g+s"
+ , "{}", "+"
+ ] `assume` MadeChange)
+ `before`
+ (cmdProperty "chown"
+ [ "-R"
+ , "root:" ++ g
+ , path
+ ] `assume` MadeChange)
+
path = "/var/cache/ccache-" ++ g
installed :: Property DebianLike