services: dicod: Rewrite using 'least-authority-wrapper'.
* gnu/services/dict.scm (dicod-shepherd-service): Rewrite using 'least-authority-wrapper' plus 'make-forkexec-constructor' instead of 'make-forkexec-constructor/container'.master
parent
3682bd4003
commit
002bcb7eb0
|
@ -1,6 +1,6 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; GNU Guix --- Functional package management for GNU
|
||||||
;;; Copyright © 2016 Sou Bunnbu <iyzsong@gmail.com>
|
;;; Copyright © 2016 Sou Bunnbu <iyzsong@gmail.com>
|
||||||
;;; Copyright © 2016, 2017, 2018, 2020 Ludovic Courtès <ludo@gnu.org>
|
;;; Copyright © 2016, 2017, 2018, 2020, 2022 Ludovic Courtès <ludo@gnu.org>
|
||||||
;;; Copyright © 2017 Huang Ying <huang.ying.caritas@gmail.com>
|
;;; Copyright © 2017 Huang Ying <huang.ying.caritas@gmail.com>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
|
@ -22,12 +22,15 @@
|
||||||
#:use-module (guix gexp)
|
#:use-module (guix gexp)
|
||||||
#:use-module (guix records)
|
#:use-module (guix records)
|
||||||
#:use-module (guix modules)
|
#:use-module (guix modules)
|
||||||
|
#:use-module (guix least-authority)
|
||||||
#:use-module (gnu services)
|
#:use-module (gnu services)
|
||||||
#:use-module (gnu services shepherd)
|
#:use-module (gnu services shepherd)
|
||||||
#:use-module (gnu system shadow)
|
#:use-module (gnu system shadow)
|
||||||
#:use-module ((gnu packages admin) #:select (shadow))
|
#:use-module ((gnu packages admin) #:select (shadow))
|
||||||
#:use-module (gnu packages dico)
|
#:use-module (gnu packages dico)
|
||||||
#:use-module (gnu packages dictionaries)
|
#:use-module (gnu packages dictionaries)
|
||||||
|
#:autoload (gnu build linux-container) (%namespaces)
|
||||||
|
#:autoload (gnu system file-systems) (file-system-mapping)
|
||||||
#:use-module (srfi srfi-1)
|
#:use-module (srfi srfi-1)
|
||||||
#:use-module (srfi srfi-26)
|
#:use-module (srfi srfi-26)
|
||||||
#:use-module (ice-9 match)
|
#:use-module (ice-9 match)
|
||||||
|
@ -142,27 +145,31 @@ database {
|
||||||
(chown rundir (passwd:uid user) (passwd:gid user)))))
|
(chown rundir (passwd:uid user) (passwd:gid user)))))
|
||||||
|
|
||||||
(define (dicod-shepherd-service config)
|
(define (dicod-shepherd-service config)
|
||||||
(let ((dicod (file-append (dicod-configuration-dico config)
|
(let* ((dicod.conf (dicod-configuration-file config))
|
||||||
"/bin/dicod"))
|
(dicod (least-authority-wrapper
|
||||||
(dicod.conf (dicod-configuration-file config)))
|
(file-append (dicod-configuration-dico config)
|
||||||
(with-imported-modules (source-module-closure
|
"/bin/dicod")
|
||||||
'((gnu build shepherd)
|
#:name "dicod"
|
||||||
(gnu system file-systems)))
|
#:mappings (list (file-system-mapping
|
||||||
(list (shepherd-service
|
(source "/var/run/dicod")
|
||||||
(provision '(dicod))
|
(target source)
|
||||||
(requirement '(user-processes))
|
(writable? #t))
|
||||||
(documentation "Run the dicod daemon.")
|
(file-system-mapping
|
||||||
(modules '((gnu build shepherd)
|
(source "/dev/log")
|
||||||
(gnu system file-systems)))
|
(target source))
|
||||||
(start #~(make-forkexec-constructor/container
|
(file-system-mapping
|
||||||
(list #$dicod "--foreground"
|
(source dicod.conf)
|
||||||
(string-append "--config=" #$dicod.conf))
|
(target source)))
|
||||||
#:user "dicod" #:group "dicod"
|
#:namespaces (delq 'net %namespaces))))
|
||||||
#:mappings (list (file-system-mapping
|
(list (shepherd-service
|
||||||
(source "/var/run/dicod")
|
(provision '(dicod))
|
||||||
(target source)
|
(requirement '(user-processes))
|
||||||
(writable? #t)))))
|
(documentation "Run the dicod daemon.")
|
||||||
(stop #~(make-kill-destructor)))))))
|
(start #~(make-forkexec-constructor
|
||||||
|
(list #$dicod "--foreground"
|
||||||
|
(string-append "--config=" #$dicod.conf))
|
||||||
|
#:user "dicod" #:group "dicod"))
|
||||||
|
(stop #~(make-kill-destructor))))))
|
||||||
|
|
||||||
(define dicod-service-type
|
(define dicod-service-type
|
||||||
(service-type
|
(service-type
|
||||||
|
|
Reference in New Issue