guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#54561] [PATCH 4/4] services: Add wsdd service.


From: Simon Streit
Subject: [bug#54561] [PATCH 4/4] services: Add wsdd service.
Date: Thu, 24 Mar 2022 22:14:05 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

* gnu/services/samba.scm (<wsdd-configuration>): New record.
(wsdd-service-type): New variable.
(wsdd-shepherd-services): New procedure.
---
 gnu/services/samba.scm | 107 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 107 insertions(+)

diff --git a/gnu/services/samba.scm b/gnu/services/samba.scm
index ffbf20fdbc..3058ed9d47 100644
--- a/gnu/services/samba.scm
+++ b/gnu/services/samba.scm
@@ -171,3 +171,110 @@ (define samba-service-type
           (service-extension activation-service-type
                              samba-activation)))
    (default-value (samba-configuration))))
+
+
+;;;
+;;; WSDD
+;;;
+
+(define-record-type* <wsdd-configuration>
+  wsdd-configuration
+  make-wsdd-configuration
+  wsdd-configuration?
+  (package        wsdd-configuration-package
+                  (default wsdd))
+  (ipv4only?      wsdd-configuration-ipv4only?
+                  (default #f))
+  (ipv6only?      wsdd-configuration-ipv6only?
+                  (default #f))
+  (chroot         wsdd-configuration-chroot
+                  (default #f))
+  (hoplimit       wsdd-configuration-hoplimit
+                  (default 1))
+  (interfaces     wsdd-configuration-interfaces
+                  (default '()))
+  (uuid-device    wsdd-configuration-uuid-device
+                  (default #f))
+  (domain         wsdd-configuration-domain
+                  (default #f))
+  (hostname       wsdd-configuration-hostname
+                  (default #f))
+  (preserve-case? wsdd-configuration-preserve-case?
+                  (default #f))
+  (workgroup      wsdd-configuration-workgroup
+                  (default "WORKGROUP")))
+
+(define wsdd-accounts
+  (list
+   (user-group (name "wsdd"))
+   (user-account (name "wsdd")
+                 (group "wsdd")
+                 (comment "Web Service Discovery user")
+                 (home-directory "/var/empty")
+                 (shell (file-append shadow "/sbin/nologin")))))
+
+(define wsdd-shepherd-service
+  (match-lambda
+    (($ <wsdd-configuration> package
+                             ipv4only?
+                             ipv6only?
+                             chroot
+                             hoplimit
+                             interfaces
+                             uuid-device
+                             domain
+                             hostname
+                             preserve-case?
+                             workgroup
+                             )
+     (list (shepherd-service
+            (documentation "Run a Web Service Discovery service")
+            (provision '(wsdd))
+            (requirement '(networking))
+            (start #~(make-forkexec-constructor
+                      (list #$(file-append package "/bin/wsdd")
+                            #$@(if ipv4only?
+                                   #~("--ipv4only")
+                                   '())
+                            #$@(if ipv6only?
+                                   #~("--ipv6only")
+                                   '())
+                            #$@(if chroot
+                                   #~("--chroot" #$chroot)
+                                   '())
+                            #$@(if hoplimit
+                                   #~("--hoplimit" #$(number->string hoplimit))
+                                   '())
+                            #$@(map (lambda (interfaces)
+                                      (string-append "--interface=" 
interfaces))
+                                    interfaces)
+                            #$@(if uuid-device
+                                   #~("--uuid" #$uuid-device)
+                                   '())
+                            #$@(if domain
+                                   #~("--domain" #$domain)
+                                   '())
+                            #$@(if hostname
+                                   #~("--hostname" #$hostname)
+                                   '())
+                            #$@(if preserve-case?
+                                   #~("--preserve-case")
+                                   '())
+                            #$@(if workgroup
+                                   #~("--workgroup" #$workgroup)
+                                   '()))
+                      #:user "wsdd"
+                      #:group "wsdd"
+                      #:log-file "/var/log/wsdd.log"))
+            (stop #~(make-kill-destructor)))))))
+
+(define wsdd-service-type
+  (service-type
+   (name 'wsdd)
+   (description "Web Service Discovery Daemon")
+   (extensions
+    (list (service-extension shepherd-root-service-type
+                             wsdd-shepherd-service)
+          (service-extension account-service-type
+                             (const wsdd-accounts))))
+   (default-value (wsdd-configuration))))
-- 
2.34.0






reply via email to

[Prev in Thread] Current Thread [Next in Thread]