nscd: Ensure that invalidate-nscd starts after nscd

This commit is contained in:
Eelco Dolstra 2012-08-06 12:26:52 -04:00
parent 9f9ae7c7e9
commit b11c5d5991
3 changed files with 30 additions and 16 deletions

View file

@ -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";
};

View file

@ -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";
};

View file

@ -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 =
''