mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-25 22:08:16 -05:00
services: pagekite: Use ‘least-authority-wrapper’.
* gnu/services/networking.scm (pagekite-shepherd-service): Define ‘config-file’ and ‘mappings’; define ‘pagekite’ in terms of ‘least-authority-wrapper’. Remove now-unneeded ‘with-imported-modules’ form and ‘modules’ field. Use ‘make-forkexec-constructor’ instead of ‘make-forkexec-constructor/container’. Change-Id: I7c6c6266785f6a0f81a69d85f070779a0d6edd91
This commit is contained in:
parent
11a454f9da
commit
43acd98e41
1 changed files with 20 additions and 15 deletions
|
@ -1918,29 +1918,34 @@ (define (pagekite-configuration-file config)
|
||||||
(define (pagekite-shepherd-service config)
|
(define (pagekite-shepherd-service config)
|
||||||
(match-record config <pagekite-configuration>
|
(match-record config <pagekite-configuration>
|
||||||
(package kitename kitesecret frontend kites extra-file)
|
(package kitename kitesecret frontend kites extra-file)
|
||||||
(with-imported-modules (source-module-closure
|
(let* ((config-file (pagekite-configuration-file config))
|
||||||
'((gnu build shepherd)
|
(mappings (cons (file-system-mapping
|
||||||
(gnu system file-systems)))
|
(source config-file)
|
||||||
|
(target source))
|
||||||
|
(if extra-file
|
||||||
|
(list (file-system-mapping
|
||||||
|
(source extra-file)
|
||||||
|
(target source)))
|
||||||
|
'())))
|
||||||
|
(pagekite (least-authority-wrapper
|
||||||
|
(file-append package "/bin/pagekite")
|
||||||
|
#:name "pagekite"
|
||||||
|
#:mappings mappings
|
||||||
|
;; 'pagekite' changes user IDs to it needs to run in the
|
||||||
|
;; global user namespace.
|
||||||
|
#:namespaces (fold delq %namespaces '(net user)))))
|
||||||
(shepherd-service
|
(shepherd-service
|
||||||
(documentation "Run the PageKite service.")
|
(documentation "Run the PageKite service.")
|
||||||
(provision '(pagekite))
|
(provision '(pagekite))
|
||||||
(requirement '(networking))
|
(requirement '(networking))
|
||||||
(modules '((gnu build shepherd)
|
(start #~(make-forkexec-constructor
|
||||||
(gnu system file-systems)))
|
(list #$pagekite
|
||||||
(start #~(make-forkexec-constructor/container
|
|
||||||
(list #$(file-append package "/bin/pagekite")
|
|
||||||
"--clean"
|
"--clean"
|
||||||
"--nullui"
|
"--nullui"
|
||||||
"--nocrashreport"
|
"--nocrashreport"
|
||||||
"--runas=pagekite:pagekite"
|
"--runas=pagekite:pagekite"
|
||||||
(string-append "--optfile="
|
(string-append "--optfile=" #$config-file))
|
||||||
#$(pagekite-configuration-file config)))
|
#:log-file "/var/log/pagekite.log"))
|
||||||
#:log-file "/var/log/pagekite.log"
|
|
||||||
#:mappings #$(if extra-file
|
|
||||||
#~(list (file-system-mapping
|
|
||||||
(source #$extra-file)
|
|
||||||
(target source)))
|
|
||||||
#~'())))
|
|
||||||
;; SIGTERM doesn't always work for some reason.
|
;; SIGTERM doesn't always work for some reason.
|
||||||
(stop #~(make-kill-destructor SIGINT))))))
|
(stop #~(make-kill-destructor SIGINT))))))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue