diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Propellor/Property.hs | 2 | ||||
| -rw-r--r-- | src/Propellor/Property/Chroot.hs | 2 | ||||
| -rw-r--r-- | src/Propellor/Property/Debootstrap.hs | 6 | ||||
| -rw-r--r-- | src/Propellor/Property/OS.hs | 4 | ||||
| -rw-r--r-- | src/Propellor/Property/Obnam.hs | 26 | ||||
| -rw-r--r-- | src/Propellor/Types/OS.hs | 2 |
6 files changed, 24 insertions, 18 deletions
diff --git a/src/Propellor/Property.hs b/src/Propellor/Property.hs index a83bffc4..eee1409c 100644 --- a/src/Propellor/Property.hs +++ b/src/Propellor/Property.hs @@ -255,7 +255,7 @@ isNewerThan x y = do -- -- > myproperty = withOS "foo installed" $ \o -> case o of -- > (Just (System (Debian suite) arch)) -> ... --- > (Just (System (Ubuntu release) arch)) -> ... +-- > (Just (System (FooBuntu release) arch)) -> ... -- > Nothing -> ... withOS :: Desc -> (Maybe System -> Propellor Result) -> Property NoInfo withOS desc a = property desc $ a =<< getOS diff --git a/src/Propellor/Property/Chroot.hs b/src/Propellor/Property/Chroot.hs index cfa70e9f..44d7036d 100644 --- a/src/Propellor/Property/Chroot.hs +++ b/src/Propellor/Property/Chroot.hs @@ -90,7 +90,7 @@ data Debootstrapped = Debootstrapped Debootstrap.DebootstrapConfig instance ChrootBootstrapper Debootstrapped where buildchroot (Debootstrapped cf) system loc = case system of (Just s@(System (Debian _) _)) -> Right $ debootstrap s - (Just s@(System (Ubuntu _) _)) -> Right $ debootstrap s + (Just s@(System (FooBuntu _) _)) -> Right $ debootstrap s Nothing -> Left "Cannot debootstrap; `os` property not specified" where debootstrap s = Debootstrap.built loc s cf diff --git a/src/Propellor/Property/Debootstrap.hs b/src/Propellor/Property/Debootstrap.hs index 61912b32..445c0629 100644 --- a/src/Propellor/Property/Debootstrap.hs +++ b/src/Propellor/Property/Debootstrap.hs @@ -91,7 +91,7 @@ built' installprop target system@(System _ arch) config = extractSuite :: System -> Maybe String extractSuite (System (Debian s) _) = Just $ Apt.showSuite s -extractSuite (System (Ubuntu r) _) = Just r +extractSuite (System (FooBuntu r) _) = Just r -- | Ensures debootstrap is installed. -- @@ -108,12 +108,12 @@ installed = install <!> remove ) installon (Just (System (Debian _) _)) = aptinstall - installon (Just (System (Ubuntu _) _)) = aptinstall + installon (Just (System (FooBuntu _) _)) = aptinstall installon _ = sourceInstall remove = withOS "debootstrap removed" $ ensureProperty . removefrom removefrom (Just (System (Debian _) _)) = aptremove - removefrom (Just (System (Ubuntu _) _)) = aptremove + removefrom (Just (System (FooBuntu _) _)) = aptremove removefrom _ = sourceRemove aptinstall = Apt.installed ["debootstrap"] diff --git a/src/Propellor/Property/OS.hs b/src/Propellor/Property/OS.hs index 1f22888c..403b1df3 100644 --- a/src/Propellor/Property/OS.hs +++ b/src/Propellor/Property/OS.hs @@ -85,8 +85,8 @@ cleanInstallOnce confirmation = check (not <$> doesFileExist flagfile) $ osbootstrapped = withOS (newOSDir ++ " bootstrapped") $ \o -> case o of (Just d@(System (Debian _) _)) -> debootstrap d - (Just u@(System (Ubuntu _) _)) -> debootstrap u - _ -> error "os is not declared to be Debian or Ubuntu" + (Just u@(System (FooBuntu _) _)) -> debootstrap u + _ -> error "os is not declared to be Debian or *buntu" debootstrap targetos = ensureProperty $ -- Ignore the os setting, and install debootstrap from diff --git a/src/Propellor/Property/Obnam.hs b/src/Propellor/Property/Obnam.hs index 92c97f18..666328ac 100644 --- a/src/Propellor/Property/Obnam.hs +++ b/src/Propellor/Property/Obnam.hs @@ -36,6 +36,10 @@ data NumClients = OnlyClient | MultipleClients -- -- Note that this property does not make obnam encrypt the backup -- repository. +-- +-- Since obnam uses a fair amount of system resources, only one obnam +-- backup job will be run at a time. Other jobs will wait their turns to +-- run. backup :: FilePath -> Cron.Times -> [ObnamParam] -> NumClients -> Property NoInfo backup dir crontimes params numclients = backup' dir crontimes params numclients @@ -59,16 +63,18 @@ backup' dir crontimes params numclients = cronjob `describe` desc where desc = dir ++ " backed up by obnam" cronjob = Cron.niceJob ("obnam_backup" ++ dir) crontimes (User "root") "/" $ - unwords $ catMaybes - [ if numclients == OnlyClient - -- forcelock fails if repo does not exist yet - then Just $ forcelockcmd ++ " 2>/dev/null ;" - else Nothing - , Just backupcmd - , if any isKeepParam params - then Just $ "&& " ++ forgetcmd - else Nothing - ] + "flock " ++ shellEscape lockfile ++ " sh -c " ++ shellEscape cmdline + lockfile = "/var/lock/propellor-obnam.lock" + cmdline = unwords $ catMaybes + [ if numclients == OnlyClient + -- forcelock fails if repo does not exist yet + then Just $ forcelockcmd ++ " 2>/dev/null ;" + else Nothing + , Just backupcmd + , if any isKeepParam params + then Just $ "&& " ++ forgetcmd + else Nothing + ] forcelockcmd = unwords $ [ "obnam" , "force-lock" diff --git a/src/Propellor/Types/OS.hs b/src/Propellor/Types/OS.hs index 447d4396..6c2dd28e 100644 --- a/src/Propellor/Types/OS.hs +++ b/src/Propellor/Types/OS.hs @@ -24,7 +24,7 @@ data System = System Distribution Architecture data Distribution = Debian DebianSuite - | Ubuntu Release + | FooBuntu Release -- ^ "*buntu" (The actual name of this distribution is not used in Propellor per <http://joeyh.name/blog/entry/trademark_nonsense/>) deriving (Show, Eq) -- | Debian has several rolling suites, and a number of stable releases, |
