diff options
| author | Joey Hess <joeyh@joeyh.name> | 2016-04-23 14:10:38 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2016-04-23 14:10:38 -0400 |
| commit | 7933a0006a9174904e3362d0af11537a5f13e15c (patch) | |
| tree | 89cf58a1d0c5ed2a58524a69a70cf62ac2493a6f | |
| parent | e103af97f800708a8285524085847ae6bdfa640f (diff) | |
added AtticRepo type alias
| -rw-r--r-- | debian/changelog | 2 | ||||
| -rw-r--r-- | src/Propellor/Property/Attic.hs | 10 |
2 files changed, 8 insertions, 4 deletions
diff --git a/debian/changelog b/debian/changelog index 3c3d41ac..ef68886a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,8 @@ propellor (3.0.2) UNRELEASED; urgency=medium * Apt.unattendedUpgrades: Enable mailing problems reports to root. Thanks, Félix Sipma. * Added Propellor.Property.Fstab, and moved the fstabbed property to there. + * Attic module added for the backup system. + Thanks, Félix Sipma. -- Joey Hess <id@joeyh.name> Tue, 05 Apr 2016 13:48:47 -0400 diff --git a/src/Propellor/Property/Attic.hs b/src/Propellor/Property/Attic.hs index 3d857913..0fadc113 100644 --- a/src/Propellor/Property/Attic.hs +++ b/src/Propellor/Property/Attic.hs @@ -17,13 +17,15 @@ import Data.List (intercalate) type AtticParam = String +type AtticRepo = FilePath + installed :: Property DebianLike installed = Apt.installed ["attic"] -repoExists :: FilePath -> IO Bool +repoExists :: AtticRepo -> IO Bool repoExists repo = boolSystem "attic" [Param "list", File repo] -init :: FilePath -> Property DebianLike +init :: AtticRepo -> Property DebianLike init backupdir = check (not <$> repoExists backupdir) (cmdProperty "attic" initargs) `requires` installed where @@ -32,7 +34,7 @@ init backupdir = check (not <$> repoExists backupdir) (cmdProperty "attic" inita , backupdir ] -restored :: [FilePath] -> FilePath -> Property DebianLike +restored :: [FilePath] -> AtticRepo -> Property DebianLike restored dirs backupdir = cmdProperty "attic" restoreargs `assume` MadeChange `describe` ("attic restore from " ++ backupdir) @@ -44,7 +46,7 @@ restored dirs backupdir = cmdProperty "attic" restoreargs ] ++ dirs -backup :: [FilePath] -> FilePath -> Cron.Times -> [AtticParam] -> [KeepPolicy] -> Property DebianLike +backup :: [FilePath] -> AtticRepo -> Cron.Times -> [AtticParam] -> [KeepPolicy] -> Property DebianLike backup dirs backupdir crontimes extraargs kp = propertyList (backupdir ++ " attic backup") $ props & check (not <$> repoExists backupdir) (restored dirs backupdir) & Cron.niceJob ("attic_backup" ++ backupdir) crontimes (User "root") "/" backupcmd |
