2021-12-08 14:34:17 +01:00
|
|
|
(define-module (glicid services file-systems)
|
|
|
|
#:use-module (gnu services)
|
|
|
|
#:use-module (gnu services shepherd)
|
|
|
|
#:use-module (guix)
|
2021-12-08 15:08:54 +01:00
|
|
|
#:use-module (guix gexp)
|
2021-12-08 14:34:17 +01:00
|
|
|
#:use-module (guix records)
|
|
|
|
#:use-module (ice-9 match)
|
|
|
|
#:use-module (gnu packages file-systems)
|
|
|
|
#:export (
|
|
|
|
%default-autofs-conf
|
|
|
|
autofs-configuration
|
|
|
|
autofs-configuration?
|
|
|
|
autofs-service
|
|
|
|
autofs-service-type
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
(define %default-autofs-conf
|
|
|
|
(plain-file "autofs" "
|
|
|
|
# Empty file as we do nothing by default
|
|
|
|
")
|
|
|
|
)
|
|
|
|
|
|
|
|
(define-record-type* <autofs-configuration>
|
|
|
|
autofs-configuration make-autofs-configuration
|
|
|
|
autofs-configuration?
|
2021-12-08 15:14:47 +01:00
|
|
|
(autofs autofs-configuration-autofs
|
|
|
|
(default autofs)
|
|
|
|
)
|
2021-12-08 14:34:17 +01:00
|
|
|
(config-file autofs-config-file
|
|
|
|
(default %default-autofs-conf)
|
|
|
|
)
|
|
|
|
(log-file autofs-log-file
|
|
|
|
(default "/var/log/autofs.log")
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
(define autofs-service
|
|
|
|
(match-lambda
|
2021-12-08 16:18:33 +01:00
|
|
|
(($ <autofs-configuration> autofs config-file log-file)
|
2021-12-08 14:34:17 +01:00
|
|
|
(list
|
|
|
|
(shepherd-service
|
|
|
|
(provision '(autofs) )
|
|
|
|
(documentation "Run autofs.")
|
|
|
|
(requirement '(user-processes))
|
2021-12-08 15:06:56 +01:00
|
|
|
(respawn? #t)
|
2021-12-08 14:34:17 +01:00
|
|
|
(start #~(make-forkexec-constructor
|
|
|
|
(list
|
|
|
|
#$(file-append autofs "/sbin/automount")
|
|
|
|
"-d" "-f"
|
|
|
|
)
|
|
|
|
#:log-file #$log-file
|
|
|
|
))
|
|
|
|
(stop #~(make-kill-destructor))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
(define autofs-service-type
|
|
|
|
(service-type (name 'autofs)
|
|
|
|
(extensions
|
|
|
|
(list (
|
|
|
|
service-extension
|
|
|
|
shepherd-root-service-type
|
|
|
|
autofs-service
|
|
|
|
))
|
|
|
|
)
|
|
|
|
(description "Run autofs")
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|