diff options
| author | Sean Whitton <spwhitton@spwhitton.name> | 2017-01-30 18:12:16 -0700 |
|---|---|---|
| committer | Sean Whitton <spwhitton@spwhitton.name> | 2017-01-30 18:12:16 -0700 |
| commit | e5a581fee717b770600767d59f6edf812967eaf2 (patch) | |
| tree | dfae26027446c925686359bee76f422b680584ce /src | |
| parent | 8fcc618914716ad775f6bb800c9c598e51e349b9 (diff) | |
pin even if hostSuite == suite
Diffstat (limited to 'src')
| -rw-r--r-- | src/Propellor/Property/Apt.hs | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/Propellor/Property/Apt.hs b/src/Propellor/Property/Apt.hs index 4eac6670..0990c83b 100644 --- a/src/Propellor/Property/Apt.hs +++ b/src/Propellor/Property/Apt.hs @@ -105,23 +105,26 @@ type PinPriority = Int -- | Adds an apt source for a suite, and pins that suite to a given pin value -- (see apt_preferences(5)). Revert to drop the source and unpin the suite. -- --- If the requested suite is the host's OS suite, this property does nothing. --- That apt source should already be available, or you can use a property like --- 'Apt.stdSourcesList'. +-- If the requested suite is the host's OS suite, the suite is pinned, but no +-- source is added. That apt source should already be available, or you can use +-- a property like 'Apt.stdSourcesList'. suiteAvailablePinned :: DebianSuite -> PinPriority -> RevertableProperty Debian suiteAvailablePinned s pin = available <!> unavailable `onChange` update where - available = withOS (desc True) $ \w o -> case o of - (Just (System (Debian _ hostSuite) _)) -> - if s == hostSuite then doNothing else ensureProperty w $ - File.hasContent sourceFile + available = combineProperties (desc True) $ props + & File.hasContent prefFile + [ "Package: *" + , "Pin: release " ++ suitePin s + , "Pin-Priority: " ++ show pin + ] + & withOS (desc True) $ \w o -> case o of + (Just (System (Debian _ hostSuite) _)) -> + | s /= hostSuite = ensureProperty w $ + File.hasContent sourceFile (concatMap (\gen -> gen s) generators) - `requires` File.hasContent prefFile - [ "Package: *" - , "Pin: release " ++ suitePin s - , "Pin-Priority: " ++ show pin - ] + | otherwise = doNothing + _ -> doNothing unavailable = combineProperties (desc False) $ props & File.notPresent sourceFile |
