This commit is contained in:
Jean-François GUILLAUME 2021-12-02 21:30:43 +01:00
parent b9553b913f
commit deb424e698
2 changed files with 17 additions and 9 deletions

View file

@ -20,10 +20,10 @@
(openldap openldap-configuration-openldap ;<package> (openldap openldap-configuration-openldap ;<package>
(default openldap) (default openldap)
) )
(arguments openldap-configuration-arguments ;list of strings (extra-args openldap-configuration-arguments ;list of strings
(default '()) (default '())
) )
(logflags openldap-configuration-logflags ;number (log-flags openldap-configuration-logflags ;number
(default "0") (default "0")
) )
(log-file openldap-configuration-log-file ; string (log-file openldap-configuration-log-file ; string
@ -35,17 +35,16 @@
(config-file openldap-configuration-config-file ; string (config-file openldap-configuration-config-file ; string
(default %default-slapd.conf) (default %default-slapd.conf)
) )
(schema-dir openldap-configuration-schema-dir ; string
(default '())
)
) )
(define %default-slapd.conf (define %default-slapd.conf
(plain-file "slapd.conf" " (plain-file "slapd.conf" "
# Empty file for test # Empty file for test
")) "))
(define openldap-shepherd-service (define openldap-shepherd-service
(match-lambda (match-lambda
(($ <openldap-configuration> openldap arguments logflags log-file pid-file config-file schema-dir) (($ <openldap-configuration> openldap extra-args log-flags log-file pid-file config-file)
(list (list
(shepherd-service (shepherd-service
(provision '(slapd) ) (provision '(slapd) )
@ -54,12 +53,15 @@
(respawn? #f) (respawn? #f)
(start #~(make-forkexec-constructor (start #~(make-forkexec-constructor
(list (list
; We do not set the uri in the service definition because if we do, we need a way to
; escape double quotes. You should use slapd.conf to set the uri
#$(file-append openldap "/libexec/slapd") #$(file-append openldap "/libexec/slapd")
"-h 'ldap:/// ldaps:///'" "-d" #$log-flags
"-d" #$logflags
"-f" #$config-file "-f" #$config-file
#$extra-args
) )
#:pid-file #$pid-file #:pid-file #$pid-file
#:log-file #$log-file
)) ))
(stop #~(make-kill-destructor)) (stop #~(make-kill-destructor))
) )
@ -67,6 +69,7 @@
) )
) )
) )
(define openldap-service-type (define openldap-service-type
(service-type (name 'slapd) (service-type (name 'slapd)
(extensions (extensions

View file

@ -23,9 +23,12 @@
(define-record-type* <rc-local-configuration> (define-record-type* <rc-local-configuration>
rc-local-configuration make-rc-local-configuration rc-local-configuration make-rc-local-configuration
rc-local-configuration? rc-local-configuration?
(config-file rc-local-config-file ; string (config-file rc-local-config-file
(default %default-rc-local-conf) (default %default-rc-local-conf)
) )
(log-file rc-local-log-file
(default "/var/log/rc-local.log")
)
) )
(define rc-local-service (define rc-local-service
@ -37,12 +40,14 @@
(documentation "Run rc-local.") (documentation "Run rc-local.")
(requirement '(user-processes)) (requirement '(user-processes))
(respawn? #f) (respawn? #f)
(one-shot? #t)
(start #~(make-forkexec-constructor (start #~(make-forkexec-constructor
(list (list
#$(file-append bash "/bin/bash") #$(file-append bash "/bin/bash")
"-l" "-l"
#$config-file #$config-file
) )
#:log-file #$log-file
)) ))
(stop #~(make-kill-destructor)) (stop #~(make-kill-destructor))
) )