diff mbox series

[bug#39308] gnu: Install the udev rules for light to its output.

Message ID 87a768kco6.fsf@gnu.org
State Accepted
Headers show
Series [bug#39308] gnu: Install the udev rules for light to its output. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch fail View Laminar job

Commit Message

Amin Bandali Jan. 27, 2020, 5:54 p.m. UTC
Please find v2 attached below, fixing my oversight of forgetting to
substitute in the correct paths for chgrp and chmod.
The patch works fine for me after adding light to udev-service-type in
my system configuration, as suggested in the manual, like so:

  (simple-service 'light-udev-rules udev-service-type (list light))

Comments

Efraim Flashner Jan. 27, 2020, 6:01 p.m. UTC | #1
Looks good to me! Patch pushed.
diff mbox series

Patch

From 3f9beb0385c03d5c6d34cde76ad7bf2bc2e0c465 Mon Sep 17 00:00:00 2001
From: Amin Bandali <mab@gnu.org>
Date: Mon, 27 Jan 2020 09:33:37 -0500
Subject: [PATCH v2] gnu: Install udev rules for light to allow sudo-less
 invocations.

* gnu/packages/linux.scm (light): Substitute out the absolute paths of chgrp
and chmod in 90-backlight.rules, and install the rules file to the special
lib/udev/rules.d/ directory of the out output.  This allows for any member of
the video group to set brightness using light without using sudo.
---
 gnu/packages/linux.scm | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 9b0dfd8eb7..5162dfff18 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -5042,6 +5042,21 @@  monitoring tools for Linux.  These include @code{mpstat}, @code{iostat},
         (base32 "0zrjipd392bzjvxx0rjrb0cgi0ix1d83fwgw1mcy8kc4d16cgyjg"))
        (file-name (git-file-name name version))))
     (build-system gnu-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch-udev-rules-absolute-path-bins
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* "90-backlight.rules"
+               (("/bin/chgrp") (which "chgrp"))
+               (("/bin/chmod") (which "chmod")))
+             #t))
+         (add-after 'install 'install-udev-rules
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (install-file
+                "90-backlight.rules" (string-append out "/lib/udev/rules.d"))
+               #t))))))
     (native-inputs
      `(("autoconf" ,autoconf)
        ("automake" ,automake)))
-- 
2.25.0