mirror of
https://gitlab.com/nonguix/nonguix.git
synced 2025-01-14 17:55:58 +01:00
services: zerotier-one: Display output of actions to the user.
Fixes https://gitlab.com/nonguix/nonguix/-/issues/117. * nongnu/services/vpn.scm (%zerotier-action-join): call command via open-input-pipe and print exit code. (%zerotier-action-leave): dito. Signed-off-by: Jonathan Brielmaier <jonathan.brielmaier@web.de>
This commit is contained in:
parent
5dfa6bfb48
commit
3246eac4fe
1 changed files with 14 additions and 4 deletions
|
@ -29,16 +29,26 @@
|
|||
(name 'join)
|
||||
(documentation "Join a network")
|
||||
(procedure #~(lambda (running network)
|
||||
(let ((zerotier-cli (string-append #$zerotier "/sbin/zerotier-cli")))
|
||||
(invoke zerotier-cli "join" network))))))
|
||||
(let* ((zerotier-cli (string-append #$zerotier "/sbin/zerotier-cli"))
|
||||
(cmd (string-join (list zerotier-cli "join" network)))
|
||||
(port (open-input-pipe cmd))
|
||||
(str (get-string-all port)))
|
||||
(display str)
|
||||
(status:exit-val (close-pipe port)))))))
|
||||
|
||||
(define %zerotier-action-leave
|
||||
(shepherd-action
|
||||
(name 'leave)
|
||||
(documentation "Leave a network")
|
||||
(procedure #~(lambda (running network)
|
||||
(let ((zerotier-cli (string-append #$zerotier "/sbin/zerotier-cli")))
|
||||
(invoke zerotier-cli "leave" network))))))
|
||||
(let* ((zerotier-cli (string-append #$zerotier "/sbin/zerotier-cli"))
|
||||
(cmd (string-join (list zerotier-cli "leave" network)))
|
||||
(port (open-input-pipe cmd))
|
||||
(str (get-string-all port)))
|
||||
(display str)
|
||||
(status:exit-val (close-pipe port)))))))
|
||||
|
||||
|
||||
|
||||
(define zerotier-one-shepherd-service
|
||||
(lambda (config)
|
||||
|
|
Loading…
Reference in a new issue