unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Amin Bandali <mab@gnu.org>
To: 39308@debbugs.gnu.org
Subject: [bug#39308] [PATCH] gnu: Install the udev rules for light to its output.
Date: Mon, 27 Jan 2020 12:54:33 -0500	[thread overview]
Message-ID: <87a768kco6.fsf@gnu.org> (raw)
In-Reply-To: <20200127145247.4327-1-mab@gnu.org>


[-- Attachment #1.1: Type: text/plain, Size: 123 bytes --]


Please find v2 attached below, fixing my oversight of forgetting to
substitute in the correct paths for chgrp and chmod.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-gnu-Install-udev-rules-for-light-to-allow-sudo-less-.patch --]
[-- Type: text/x-patch, Size: 1815 bytes --]

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


[-- Attachment #1.3: Type: text/plain, Size: 363 bytes --]


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))

-- 
Amin Bandali
Free Software activist | GNU maintainer & webmaster
GPG: BE62 7373 8E61 6D6D 1B3A  08E8 A21A 0202 4881 6103
https://bandali.eu.org

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  reply	other threads:[~2020-01-27 17:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-27 14:52 [bug#39308] [PATCH] gnu: Install the udev rules for light to its output Amin Bandali
2020-01-27 17:54 ` Amin Bandali [this message]
2020-01-27 18:01   ` bug#39308: " Efraim Flashner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a768kco6.fsf@gnu.org \
    --to=mab@gnu.org \
    --cc=39308@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).