summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Propellor/Property/Sbuild.hs12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/Propellor/Property/Sbuild.hs b/src/Propellor/Property/Sbuild.hs
index 3967d0a1..55fb29c0 100644
--- a/src/Propellor/Property/Sbuild.hs
+++ b/src/Propellor/Property/Sbuild.hs
@@ -134,8 +134,16 @@ updated s@(SbuildSchroot suite arch) =
`requires` installed
where
go :: Property DebianLike
- go = tightenTargets $ cmdProperty
- "sbuild-update" ["-udr", suite ++ "-" ++ arch]
+ go = do
+ fstab <- lines <$> liftIO $ readFile "/etc/schroot/sbuild/fstab"
+ -- If this schroot shares its apt archives with the host
+ -- machine, don't run apt-get clean/autoclean
+ let args = if cacheLine `elem` fstab
+ then "-udr"
+ else "-udcar"
+ tightenTargets $ cmdProperty
+ "sbuild-update" [args, suite ++ "-" ++ arch]
+ cacheLine = "/var/cache/apt/archives /var/cache/apt/archives none rw,bind 0 0"
-- Find the conf file that sbuild-createchroot(1) made when we passed it
-- --chroot-suffix=propellor, and edit and rename such that it is as if we