diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2022-04-27 18:35:21 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2022-05-01 21:30:36 +0200 |
| commit | fee06d5aaa71a965ea0bc06c1ff15c138a8bb2c8 (patch) | |
| tree | 93a7342f9011719da92ac2c3caf30f031d0bc56c /gnu/services | |
| parent | dac4efc466fd459912d6dd85a0be7c96cd3e35e1 (diff) | |
services: opendht: Use 'least-authority-wrapper'.
* gnu/services/networking.scm (opendht-configuration->command-line-arguments):
Use 'least-authority-wrapper'.
(opendht-shepherd-service): Use 'make-forkexec-constructor'.
Diffstat (limited to 'gnu/services')
| -rw-r--r-- | gnu/services/networking.scm | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm index 069034a61dc..399cd03c1dd 100644 --- a/gnu/services/networking.scm +++ b/gnu/services/networking.scm | |||
| @@ -796,7 +796,19 @@ CONFIG, an <opendht-configuration> object." | |||
| 796 | (match-record config <opendht-configuration> | 796 | (match-record config <opendht-configuration> |
| 797 | (opendht bootstrap-host enable-logging? port debug? peer-discovery? | 797 | (opendht bootstrap-host enable-logging? port debug? peer-discovery? |
| 798 | proxy-server-port proxy-server-port-tls) | 798 | proxy-server-port proxy-server-port-tls) |
| 799 | (let ((dhtnode #~(string-append #$opendht:tools "/bin/dhtnode"))) | 799 | (let ((dhtnode (least-authority-wrapper |
| 800 | ;; XXX: Work around lack of support for multiple outputs | ||
| 801 | ;; in 'file-append'. | ||
| 802 | (computed-file "dhtnode" | ||
| 803 | #~(symlink | ||
| 804 | (string-append #$opendht:tools | ||
| 805 | "/bin/dhtnode") | ||
| 806 | #$output)) | ||
| 807 | #:name "dhtnode" | ||
| 808 | #:mappings (list (file-system-mapping | ||
| 809 | (source "/dev/log") ;for syslog | ||
| 810 | (target source))) | ||
| 811 | #:namespaces (delq 'net %namespaces)))) | ||
| 800 | `(,dhtnode | 812 | `(,dhtnode |
| 801 | "--service" ;non-forking mode | 813 | "--service" ;non-forking mode |
| 802 | ,@(if (string? bootstrap-host) | 814 | ,@(if (string? bootstrap-host) |
| @@ -822,23 +834,15 @@ CONFIG, an <opendht-configuration> object." | |||
| 822 | 834 | ||
| 823 | (define (opendht-shepherd-service config) | 835 | (define (opendht-shepherd-service config) |
| 824 | "Return a <shepherd-service> running OpenDHT." | 836 | "Return a <shepherd-service> running OpenDHT." |
| 825 | (with-imported-modules (source-module-closure | 837 | (shepherd-service |
| 826 | '((gnu build shepherd) | 838 | (documentation "Run an OpenDHT node.") |
| 827 | (gnu system file-systems))) | 839 | (provision '(opendht dhtnode dhtproxy)) |
| 828 | (shepherd-service | 840 | (requirement '(networking syslogd)) |
| 829 | (documentation "Run an OpenDHT node.") | 841 | (start #~(make-forkexec-constructor |
| 830 | (provision '(opendht dhtnode dhtproxy)) | 842 | (list #$@(opendht-configuration->command-line-arguments config)) |
| 831 | (requirement '(networking syslogd)) | 843 | #:user "opendht" |
| 832 | (modules '((gnu build shepherd) | 844 | #:group "opendht")) |
| 833 | (gnu system file-systems))) | 845 | (stop #~(make-kill-destructor)))) |
| 834 | (start #~(make-forkexec-constructor/container | ||
| 835 | (list #$@(opendht-configuration->command-line-arguments config)) | ||
| 836 | #:mappings (list (file-system-mapping | ||
| 837 | (source "/dev/log") ;for syslog | ||
| 838 | (target source))) | ||
| 839 | #:user "opendht" | ||
| 840 | #:group "opendht")) | ||
| 841 | (stop #~(make-kill-destructor))))) | ||
| 842 | 846 | ||
| 843 | (define opendht-service-type | 847 | (define opendht-service-type |
| 844 | (service-type | 848 | (service-type |
