From b11c5d59911f9549a56839576379e5b2902b4f99 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 6 Aug 2012 12:26:52 -0400 Subject: [PATCH] nscd: Ensure that invalidate-nscd starts after nscd --- modules/services/system/nscd.nix | 12 +++++++++--- modules/services/ttys/agetty.nix | 23 +++++++++++++++-------- modules/system/upstart/upstart.nix | 11 ++++++----- 3 files changed, 30 insertions(+), 16 deletions(-) diff --git a/modules/services/system/nscd.nix b/modules/services/system/nscd.nix index b2596dbb413..80fa1394aca 100644 --- a/modules/services/system/nscd.nix +++ b/modules/services/system/nscd.nix @@ -27,7 +27,7 @@ in }; - + ###### implementation config = mkIf config.services.nscd.enable { @@ -47,13 +47,18 @@ in preStart = '' - mkdir -m 0755 -p /var/run/nscd + mkdir -m 0755 -p /run/nscd + rm -f /run/nscd/nscd.pid mkdir -m 0755 -p /var/db/nscd ''; path = [ pkgs.glibc ]; - exec = "nscd -f ${./nscd.conf} -d 2> /dev/null"; + exec = "nscd -f ${./nscd.conf}"; + + daemonType = "fork"; + + serviceConfig = "PIDFile=/run/nscd/nscd.pid"; }; # Flush nscd's ‘hosts’ database when the network comes up or the @@ -62,6 +67,7 @@ in { name = "invalidate-nscd"; description = "Invalidate NSCD cache"; startOn = "ip-up or config-changed"; + after = [ "nscd.service" ]; task = true; exec = "${pkgs.glibc}/sbin/nscd --invalidate hosts"; }; diff --git a/modules/services/ttys/agetty.nix b/modules/services/ttys/agetty.nix index 1916c13333d..92915f9132b 100644 --- a/modules/services/ttys/agetty.nix +++ b/modules/services/ttys/agetty.nix @@ -2,6 +2,18 @@ with pkgs.lib; +let + + issueFile = pkgs.writeText "issue" '' + + ${config.services.mingetty.greetingLine} + xyzzy6 + ${config.services.mingetty.helpLine} + + ''; + +in + { ###### interface @@ -79,7 +91,7 @@ with pkgs.lib; [Service] Environment=TERM=linux Environment=LOCALE_ARCHIVE=/run/current-system/sw/lib/locale/locale-archive - ExecStart=@${pkgs.utillinux}/sbin/agetty agetty --noclear --login-program ${pkgs.shadow}/bin/login %I 38400 + ExecStart=@${pkgs.utillinux}/sbin/agetty agetty --noclear -f ${issueFile} --login-program ${pkgs.shadow}/bin/login %I 38400 Type=idle Restart=always RestartSec=0 @@ -95,7 +107,7 @@ with pkgs.lib; # instead, to ensure that login terminates cleanly. KillSignal=SIGHUP ''; - + boot.systemd.units."serial-getty@.service".text = '' [Unit] @@ -131,12 +143,7 @@ with pkgs.lib; environment.etc = singleton { # Friendly greeting on the virtual consoles. - source = pkgs.writeText "issue" '' - - ${config.services.mingetty.greetingLine} - ${config.services.mingetty.helpLine} - - ''; + source = issueFile; target = "issue"; }; diff --git a/modules/system/upstart/upstart.nix b/modules/system/upstart/upstart.nix index 6375289293f..92a7add88eb 100644 --- a/modules/system/upstart/upstart.nix +++ b/modules/system/upstart/upstart.nix @@ -54,14 +54,15 @@ let ''; in { - inherit (job) description path environment; + inherit (job) description requires wants before environment path; after = - if job.startOn == "stopped udevtrigger" then [ "systemd-udev-settle.service" ] else - if job.startOn == "started udev" then [ "systemd-udev.service" ] else - []; + (if job.startOn == "stopped udevtrigger" then [ "systemd-udev-settle.service" ] else + if job.startOn == "started udev" then [ "systemd-udev.service" ] else + []) ++ job.after; - wantedBy = if job.startOn == "" then [ ] else [ "multi-user.target" ]; + wantedBy = + (if job.startOn == "" then [ ] else [ "multi-user.target" ]) ++ job.wantedBy; serviceConfig = ''