From 4500a4d8dc0a98754a59d994957d5ea87558c351 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sun, 30 Jul 2017 18:57:30 -0700 Subject: add Sbuild.userConfig, at Joey's suggestion --- src/Propellor/Property/Sbuild.hs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/Propellor') diff --git a/src/Propellor/Property/Sbuild.hs b/src/Propellor/Property/Sbuild.hs index 0b2ac211..f5116c04 100644 --- a/src/Propellor/Property/Sbuild.hs +++ b/src/Propellor/Property/Sbuild.hs @@ -78,6 +78,7 @@ module Propellor.Property.Sbuild ( keypairGenerated, keypairInsecurelyGenerated, usableBy, + userConfig, ) where import Propellor.Base @@ -445,6 +446,34 @@ ccachePrepared = propertyList "sbuild group ccache configured" $ props -- [Firewall.IPWithNumMask (IPv4 "127.0.0.1") 8]) -- `requires` installed -- sbuild group must exist +-- | Maintain recommended ~/.sbuildrc for a user, and adds them to the +-- sbuild group +-- +-- You probably want a custom ~/.sbuildrc on your workstation, but +-- this property is handy for quickly setting up build boxes. +userConfig :: User -> Property DebianLike +userConfig user@(User u) = go + `requires` usableBy + `requires` Apt.installed ["piuparts", "autopkgtest", "lintian"] + where + go = property' ("~/.sbuildrc for " ++ u) $ \w -> do + h <- liftIO (homedir user) + ensureProperty w $ File.hasContent (h ".sbuildrc") + [ "$run_lintian = 1;" + , "" + , "$run_piuparts = 1;" + , "$piuparts_opts = [" + , " '--no-eatmydata'," + , " '--schroot'," + , " '%r-%a-sbuild'," + , " '--fail-if-inadequate'," + , " ];" + , "" + , "$run_autopkgtest = 1;" + , "$autopkgtest_root_args = \"\";" + , "$autopkgtest_opts = [\"--\", \"schroot\", \"%r-%a-sbuild\"];" + ] + -- ==== utility functions ==== schrootFromSystem :: System -> Maybe SbuildSchroot -- cgit v1.2.3