diff options
| author | Joey Hess <joeyh@joeyh.name> | 2017-07-28 11:47:13 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2017-07-28 11:47:13 -0400 |
| commit | 417412207725a3c99c6fd9871eab8080356b20b2 (patch) | |
| tree | 150f416d818590111f07cbeece4e28e8a54433c9 | |
| parent | 93e8d4c41b7f125f755775707c0277a72437cf36 (diff) | |
| parent | 1eaf855e5f5ac35300c092034d4e7504cc232e6e (diff) | |
Merge branch 'joeyconfig'
| l--------- | config.hs | 2 | ||||
| -rw-r--r-- | debian/changelog | 9 | ||||
| -rw-r--r-- | privdata/relocate | 1 | ||||
| -rw-r--r-- | src/Propellor/Property/Systemd.hs | 62 |
4 files changed, 36 insertions, 38 deletions
@@ -1 +1 @@ -config-simple.hs
\ No newline at end of file +joeyconfig.hs
\ No newline at end of file diff --git a/debian/changelog b/debian/changelog index 6bfaa70d..e5eacd30 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +propellor (4.6.2) UNRELEASED; urgency=medium + + * Systemd.nspawned: Recent systemd versions such as 234 ignore + non-symlinks in /etc/systemd/system/multi-user.target.wants, + which was used to configure systemd-nspawn parameters. Instead, + use a service.d/local.conf file to configure that. + + -- Joey Hess <id@joeyh.name> Thu, 27 Jul 2017 16:34:37 -0400 + propellor (4.6.1) unstable; urgency=medium * Added Network.dhcp' and Network.static', which allow specifying diff --git a/privdata/relocate b/privdata/relocate new file mode 100644 index 00000000..271692d8 --- /dev/null +++ b/privdata/relocate @@ -0,0 +1 @@ +.joeyconfig diff --git a/src/Propellor/Property/Systemd.hs b/src/Propellor/Property/Systemd.hs index d1a94aa8..51d1313c 100644 --- a/src/Propellor/Property/Systemd.hs +++ b/src/Propellor/Property/Systemd.hs @@ -283,54 +283,42 @@ nspawned c@(Container name (Chroot.Chroot loc builder _ _) h) = chroot = Chroot.Chroot loc builder Chroot.propagateChrootInfo h --- | Sets up the service file for the container, and then starts --- it running. +-- | Sets up the service files for the container, using the +-- systemd-nspawn@.service template, and starts it running. nspawnService :: Container -> ChrootCfg -> RevertableProperty Linux Linux nspawnService (Container name _ _) cfg = setup <!> teardown where service = nspawnServiceName name - servicefile = "/etc/systemd/system/multi-user.target.wants" </> service + overridedir = "/etc/systemd/system" </> nspawnServiceName name ++ ".d" + overridefile = overridedir </> "local.conf" + overridecontent = + [ "[Service]" + , "# Reset ExecStart from the template" + , "ExecStart=" + , "ExecStart=/usr/bin/systemd-nspawn " ++ unwords nspawnparams + ] + nspawnparams = + [ "--quiet" + , "--keep-unit" + , "--boot" + , "--directory=" ++ containerDir name + , "--machine=" ++ name + ] ++ nspawnServiceParams cfg - servicefilecontent = do - ls <- lines <$> readFile "/lib/systemd/system/systemd-nspawn@.service" - return $ unlines $ - "# deployed by propellor" : map addparams ls - addparams l - | "ExecStart=" `isPrefixOf` l = unwords $ - [ "ExecStart = /usr/bin/systemd-nspawn" - , "--quiet" - , "--keep-unit" - , "--boot" - , "--directory=" ++ containerDir name - , "--machine=%i" - ] ++ nspawnServiceParams cfg - | otherwise = l - - goodservicefile = (==) - <$> servicefilecontent - <*> catchDefaultIO "" (readFile servicefile) - - writeservicefile :: Property Linux - writeservicefile = property servicefile $ makeChange $ do - c <- servicefilecontent - File.viaStableTmp (\t -> writeFile t c) servicefile - - setupservicefile :: Property Linux - setupservicefile = check (not <$> goodservicefile) $ - -- if it's running, it has the wrong configuration, - -- so stop it - stopped service - `requires` daemonReloaded - `requires` writeservicefile + overrideconfigured = File.hasContent overridefile overridecontent + `onChange` daemonReloaded + `requires` File.dirExists overridedir setup :: Property Linux setup = started service - `requires` setupservicefile + `requires` enabled service + `requires` overrideconfigured `requires` machined teardown :: Property Linux - teardown = check (doesFileExist servicefile) $ - disabled service `requires` stopped service + teardown = stopped service + `before` disabled service + `before` File.notPresent overridefile nspawnServiceParams :: ChrootCfg -> [String] nspawnServiceParams NoChrootCfg = [] |
