From 7933a0006a9174904e3362d0af11537a5f13e15c Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 23 Apr 2016 14:10:38 -0400 Subject: added AtticRepo type alias --- src/Propellor/Property/Attic.hs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/Propellor') 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 -- cgit v1.2.3