guix-commits
[Top][All Lists]
Advanced

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

08/15: system: guix: Use config's ACL file location.


From: guix-commits
Subject: 08/15: system: guix: Use config's ACL file location.
Date: Sun, 30 Apr 2023 17:22:13 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 9f09903aff038533450a134a3c12e0e3e29c4ce6
Author: Josselin Poiret <dev@jpoiret.xyz>
AuthorDate: Mon Apr 24 21:59:03 2023 +0200

    system: guix: Use config's ACL file location.
    
    * gnu/services/base.scm (substitute-key-authorization): Use %acl-file 
instead of
    hardcoded "/etc/guix/acl".
    
    Signed-off-by: Ludovic Courtès <ludo@gnu.org>
---
 gnu/services/base.scm | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index e8eae72aa2..4adb551796 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -83,6 +83,7 @@
   #:use-module (guix gexp)
   #:use-module (guix records)
   #:use-module (guix modules)
+  #:use-module (guix pki)
   #:use-module ((guix self) #:select (make-config.scm))
   #:use-module (guix diagnostics)
   #:use-module (guix i18n)
@@ -1727,19 +1728,19 @@ archive' public keys, with GUIX."
   (with-imported-modules '((guix build utils))
     #~(begin
         (use-modules (guix build utils))
-
+        (define acl-file #$%acl-file)
         ;; If the ACL already exists, move it out of the way.  Create a backup
         ;; if it's a regular file: it's likely that the user manually updated
         ;; it with 'guix archive --authorize'.
-        (if (file-exists? "/etc/guix/acl")
-            (if (and (symbolic-link? "/etc/guix/acl")
-                     (store-file-name? (readlink "/etc/guix/acl")))
-                (delete-file "/etc/guix/acl")
-                (rename-file "/etc/guix/acl" "/etc/guix/acl.bak"))
-            (mkdir-p "/etc/guix"))
+        (if (file-exists? acl-file)
+            (if (and (symbolic-link? acl-file)
+                     (store-file-name? (readlink acl-file)))
+                (delete-file acl-file)
+                (rename-file acl-file (string-append acl-file ".bak")))
+            (mkdir-p (dirname acl-file)))
 
         ;; Installed the declared ACL.
-        (symlink #+default-acl "/etc/guix/acl"))))
+        (symlink #+default-acl acl-file))))
 
 (define %default-authorized-guix-keys
   ;; List of authorized substitute keys.



reply via email to

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