summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-05-24 18:09:11 +0200
committerLudovic Courtès <ludo@gnu.org>2014-05-24 18:10:05 +0200
commit4b2615e1cae8e21df8f180abf261d1dc22a2459e (patch)
tree2994817771da1ec294eb8b91d113158b630b5a9e
parent55ccc388b73312c9636857bb083f63a968b4255b (diff)
services: nscd: Provide an 'activate' script to make /var/run/nscd.
* gnu/services/base.scm (nscd-service): Add 'activate' field. * guix/build/install.scm (directives): Remove /var/run/nscd; add /var/run. * doc/guix.texi (Defining Services): Add 'activate' field in example. Document it.
-rw-r--r--doc/guix.texi19
-rw-r--r--gnu/services/base.scm5
-rw-r--r--guix/build/install.scm2
3 files changed, 19 insertions, 7 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index ddb0763495..bd853e6eac 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -3299,6 +3299,9 @@ like:
(return (service
(documentation "Run libc's name service cache daemon.")
(provision '(nscd))
+ (activate #~(begin
+ (use-modules (guix build utils))
+ (mkdir-p "/var/run/nscd")))
(start #~(make-forkexec-constructor
(string-append #$glibc "/sbin/nscd")
"-f" "/dev/null" "--foreground"))
@@ -3307,12 +3310,16 @@ like:
@end lisp
@noindent
-The @code{start} and @code{stop} fields are G-expressions
-(@pxref{G-Expressions}). They refer to dmd's facilities to start and
-stop processes (@pxref{Service De- and Constructors,,, dmd, GNU dmd
-Manual}). The @code{provision} field specifies the name under which
-this service is known to dmd, and @code{documentation} specifies on-line
-documentation. Thus, the commands @command{deco start ncsd},
+The @code{activate}, @code{start}, and @code{stop} fields are G-expressions
+(@pxref{G-Expressions}). The @code{activate} field contains a script to
+run at ``activation'' time; it makes sure that the @file{/var/run/nscd}
+directory exists before @command{nscd} is started.
+
+The @code{start} and @code{stop} fields refer to dmd's facilities to
+start and stop processes (@pxref{Service De- and Constructors,,, dmd,
+GNU dmd Manual}). The @code{provision} field specifies the name under
+which this service is known to dmd, and @code{documentation} specifies
+on-line documentation. Thus, the commands @command{deco start ncsd},
@command{deco stop nscd}, and @command{deco doc nscd} will do what you
would expect (@pxref{Invoking deco,,, dmd, GNU dmd Manual}).
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index aec6050588..dc0161408b 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -225,6 +225,11 @@ stopped before 'kill' is called."
(documentation "Run libc's name service cache daemon (nscd).")
(provision '(nscd))
(requirement '(user-processes))
+
+ (activate #~(begin
+ (use-modules (guix build utils))
+ (mkdir-p "/var/run/nscd")))
+
(start
#~(make-forkexec-constructor (string-append #$glibc "/sbin/nscd")
"-f" "/dev/null"
diff --git a/guix/build/install.scm b/guix/build/install.scm
index 24de954067..afa7d1dd8f 100644
--- a/guix/build/install.scm
+++ b/guix/build/install.scm
@@ -76,9 +76,9 @@ STORE."
`((directory ,store 0 0)
(directory "/etc")
(directory "/var/log") ; for dmd
- (directory "/var/run/nscd")
(directory "/var/guix/gcroots")
(directory "/var/empty") ; for no-login accounts
+ (directory "/var/run")
(directory "/run")
("/var/guix/gcroots/booted-system" -> "/run/booted-system")
("/var/guix/gcroots/current-system" -> "/run/current-system")