diff options
| author | Joey Hess <joeyh@joeyh.name> | 2015-09-13 12:49:08 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2015-09-13 12:49:08 -0400 |
| commit | 0f9f05ae9e65182daa9bfc98a9932e2e1382e9b5 (patch) | |
| tree | b50b56d366fe2e7f2b6c8ddb30746970253d5aff /src/Propellor | |
| parent | 7c5bfb7d77bf64557b7b98c9ae358048b64e8329 (diff) | |
| parent | 2af70d4ac7ff25a3e596de195abe40db46c74074 (diff) | |
Merge branch 'joeyconfig'
Diffstat (limited to 'src/Propellor')
| -rw-r--r-- | src/Propellor/Property/DebianMirror.hs | 61 | ||||
| -rw-r--r-- | src/Propellor/Property/DiskImage.hs | 1 | ||||
| -rw-r--r-- | src/Propellor/Property/SiteSpecific/JoeySites.hs | 3 |
3 files changed, 65 insertions, 0 deletions
diff --git a/src/Propellor/Property/DebianMirror.hs b/src/Propellor/Property/DebianMirror.hs new file mode 100644 index 00000000..cd98b6ff --- /dev/null +++ b/src/Propellor/Property/DebianMirror.hs @@ -0,0 +1,61 @@ +module Propellor.Property.DebianMirror + ( DebianPriority(..) + , showPriority + , mirror + , mirrorCdn + ) where + +import Propellor +import qualified Propellor.Property.File as File +import qualified Propellor.Property.Apt as Apt +import qualified Propellor.Property.Cron as Cron +import qualified Propellor.Property.User as User + +import Data.List + + +data DebianPriority = Essential | Required | Important | Standard | Optional | Extra + deriving (Show, Eq) + +showPriority :: DebianPriority -> String +showPriority Essential = "essential" +showPriority Required = "required" +showPriority Important = "important" +showPriority Standard = "standard" +showPriority Optional = "optional" +showPriority Extra = "extra" + +mirror :: Apt.Url -> FilePath -> [DebianSuite] -> [Architecture] -> [Apt.Section] -> Bool -> [DebianPriority] -> Cron.Times -> Property NoInfo +mirror url dir suites archs sections source priorities crontimes = propertyList + ("Debian mirror " ++ dir) + [ Apt.installed ["debmirror"] + , User.accountFor (User "debmirror") + , File.dirExists dir + , File.ownerGroup dir (User "debmirror") (Group "debmirror") + , check (not . and <$> mapM suitemirrored suites) $ cmdProperty "debmirror" args + `describe` "debmirror setup" + , Cron.niceJob ("debmirror_" ++ dir) crontimes (User "debmirror") "/" $ + unwords ("/usr/bin/debmirror" : args) + ] + where + suitemirrored suite = doesDirectoryExist $ dir </> "dists" </> Apt.showSuite suite + architecturearg = intercalate "," + suitearg = intercalate "," $ map Apt.showSuite suites + priorityRegex pp = "(" ++ intercalate "|" (map showPriority pp) ++ ")" + args = + [ "--dist" , suitearg + , "--arch", architecturearg archs + , "--section", intercalate "," sections + , "--limit-priority", "\"" ++ priorityRegex priorities ++ "\"" + ] + ++ + (if source then [] else ["--nosource"]) + ++ + [ "--host", url + , "--method", "http" + , "--keyring", "/usr/share/keyrings/debian-archive-keyring.gpg" + , dir + ] + +mirrorCdn :: FilePath -> [DebianSuite] -> [Architecture] -> [Apt.Section] -> Bool -> [DebianPriority] -> Cron.Times -> Property NoInfo +mirrorCdn = mirror "http://httpredir.debian.org/debian" diff --git a/src/Propellor/Property/DiskImage.hs b/src/Propellor/Property/DiskImage.hs index 7a3460cb..35082eec 100644 --- a/src/Propellor/Property/DiskImage.hs +++ b/src/Propellor/Property/DiskImage.hs @@ -292,6 +292,7 @@ fitChrootSize tt l basesizes = (mounts, parttable) type Finalization = (Property NoInfo, Property NoInfo) -- | Makes grub be the boot loader of the disk image. +-- TODO not implemented grubBooted :: Grub.BIOS -> Finalization grubBooted bios = (Grub.installed bios, undefined) diff --git a/src/Propellor/Property/SiteSpecific/JoeySites.hs b/src/Propellor/Property/SiteSpecific/JoeySites.hs index b6524f69..0a59452c 100644 --- a/src/Propellor/Property/SiteSpecific/JoeySites.hs +++ b/src/Propellor/Property/SiteSpecific/JoeySites.hs @@ -520,6 +520,9 @@ kiteMailServer = propertyList "kitenet.net mail server" $ props `onChange` Service.restarted "amavisd-milter" `describe` "amavisd-milter configured for postfix" & Apt.serviceInstalledRunning "clamav-freshclam" + -- Workaround https://bugs.debian.org/569150 + & Cron.niceJob "amavis-expire" Cron.Daily (User "root") "/" + "find /var/lib/amavis/virusmails/ -type f -ctime +7 -delete" & dkimInstalled |
