diff mbox series

[bug#73393,2/2] services: sane-service-type: create lock path for plustek backend

Message ID 3ad4ed8a692d86a9bef0b2ea56921ae2bf882957.1726827449.git.neox@gnu.org
State New
Headers show
Series SANE: fix a locking bug for plustek backend | expand

Commit Message

Adrien 'neox' Bourmault Sept. 20, 2024, 7:03 p.m. UTC
From: Adrien 'neox' Bourmault <neox@gnu.org>

* gnu/services/desktop.scm (sane-service-type): extend with an activation
 service to create the lockpath and give the right permissions


Change-Id: I187886d12b5f0b4fe21b03de178ea2187205387a
Signed-off-by: Adrien 'neox' Bourmault <neox@gnu.org>
---
 gnu/services/desktop.scm | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Adrien 'neox' Bourmault Sept. 22, 2024, 8:55 a.m. UTC | #1
Sorry for all that noise, that's my first time using Debbugs and I got
a little lost here, trying to obtain a clear merge...
diff mbox series

Patch

diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm
index 274aeeef9b..9eae4178fb 100644
--- a/gnu/services/desktop.scm
+++ b/gnu/services/desktop.scm
@@ -1408,6 +1408,17 @@  (define %sane-accounts
   ;; The '60-libsane.rules' udev rules refers to the "scanner" group.
   (list (user-group (name "scanner") (system? #t))))
 
+(define %sane-activation
+  #~(begin
+      (use-modules (guix build utils))
+      (let ((lockpath "/var/lock/sane")
+            (gid (vector-ref (getgrnam "scanner") 2)))
+        ;; Create the lock directory at runtime and give right perms
+        (mkdir-p lockpath)
+        (chown lockpath -1 gid)
+        (chmod lockpath #o770))
+      #t))
+
 (define sane-service-type
   (service-type
    (name 'sane)
@@ -1418,6 +1429,8 @@  (define sane-service-type
    (default-value sane-backends-minimal)
    (extensions
     (list (service-extension udev-service-type list)
+          (service-extension activation-service-type
+                             (const %sane-activation))
           (service-extension account-service-type
                              (const %sane-accounts))))))