aboutsummaryrefslogtreecommitdiff
path: root/gnu/services/kerberos.scm
diff options
context:
space:
mode:
authorClément Lassieur <clement@lassieur.org>2017-02-28 01:44:03 +0100
committerClément Lassieur <clement@lassieur.org>2017-03-12 19:09:32 +0100
commit720cb10c15a4606fe0dc3511db4fef325f3d9dc6 (patch)
treeb11a2ea3bba52b3e8a79810b22e12e3dfc15b732 /gnu/services/kerberos.scm
parent56aef188a2a014e254d3c93c8a79cd1fb5a1ece6 (diff)
downloadgnu-guix-720cb10c15a4606fe0dc3511db4fef325f3d9dc6.tar
gnu-guix-720cb10c15a4606fe0dc3511db4fef325f3d9dc6.tar.gz
services: Move configuration functions that shouldn't be factorized.
* gnu/services/configuration.scm (serialize-field, serialize-string) (serialize-space-separated-string-list, space-separated-string-list?) (serialize-file-name, file-name?, serialize-boolean): Move these functions... * gnu/services/cups.scm: ...to this file. * gnu/services/kerberos.scm: ...to this file. Configuration syntaxes are very specific to services. Some services may have the same configuration syntax, but none of them is common enough to be abstracted in configuration.scm. Signed-off-by: Clément Lassieur <clement@lassieur.org>
Diffstat (limited to 'gnu/services/kerberos.scm')
-rw-r--r--gnu/services/kerberos.scm15
1 files changed, 15 insertions, 0 deletions
diff --git a/gnu/services/kerberos.scm b/gnu/services/kerberos.scm
index cb33a7c53d..f09f47893c 100644
--- a/gnu/services/kerberos.scm
+++ b/gnu/services/kerberos.scm
@@ -96,6 +96,12 @@ trailing '?' removed."
(unless (eq? val unset-field)
(serialize-field* field-name (string-join val " "))))
+(define (space-separated-string-list? val)
+ (and (list? val)
+ (and-map (lambda (x)
+ (and (string? x) (not (string-index x #\space))))
+ val)))
+
(define space-separated-string-list/unset?
(predicate/unset space-separated-string-list?))
@@ -118,10 +124,19 @@ trailing '?' removed."
(lambda (val)
(string-prefix? "/" val))))
+(define (serialize-field field-name val)
+ (format #t "~a ~a\n" (uglify-field-name field-name) val))
+
+(define (serialize-string field-name val)
+ (serialize-field field-name val))
+
(define (serialize-file-name field-name val)
(unless (eq? val unset-field)
(serialize-string field-name val)))
+(define (serialize-space-separated-string-list field-name val)
+ (serialize-field field-name (string-join val " ")))
+
(define (non-negative-integer? val)
(and (exact-integer? val) (not (negative? val))))