From patchwork Mon Apr 24 19:59:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josselin Poiret X-Patchwork-Id: 49471 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 3498427BBE9; Mon, 24 Apr 2023 21:00:15 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 5EFB527BBE2 for ; Mon, 24 Apr 2023 21:00:14 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pr2M3-0006v5-HK; Mon, 24 Apr 2023 16:00:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pr2Lz-0006ue-Ps for guix-patches@gnu.org; Mon, 24 Apr 2023 16:00:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pr2Lz-0008S8-EB for guix-patches@gnu.org; Mon, 24 Apr 2023 16:00:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pr2Lz-0007tG-AJ for guix-patches@gnu.org; Mon, 24 Apr 2023 16:00:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#63057] [PATCH core-updates 1/3] system: guix: Use config's ACL file location. Resent-From: Josselin Poiret Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 24 Apr 2023 20:00:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63057 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Josselin Poiret , 63057@debbugs.gnu.org Received: via spool by 63057-submit@debbugs.gnu.org id=B63057.168236635330225 (code B ref 63057); Mon, 24 Apr 2023 20:00:03 +0000 Received: (at 63057) by debbugs.gnu.org; 24 Apr 2023 19:59:13 +0000 Received: from localhost ([127.0.0.1]:50379 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pr2LA-0007rP-Mw for submit@debbugs.gnu.org; Mon, 24 Apr 2023 15:59:12 -0400 Received: from jpoiret.xyz ([206.189.101.64]:41696) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pr2L5-0007qr-HY for 63057@debbugs.gnu.org; Mon, 24 Apr 2023 15:59:08 -0400 Received: from authenticated-user (jpoiret.xyz [206.189.101.64]) by jpoiret.xyz (Postfix) with ESMTPA id EDA7C184F2B; Mon, 24 Apr 2023 19:59:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpoiret.xyz; s=dkim; t=1682366346; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4vE2XcZmzCpTIDMKXHZawYsrDmHqomCzVu2gmPtuH8s=; b=goMrD0QQRf2oJvN2BluzVPWW2Z+8pzzoCPkgAxILnvUGFIidVR/oXbsGYyZM/HwkHvHBeO 9Geat1sevXQvbY09TJ8BIXGavfKn+euJKlIYB3nhAa49FRTlq1fMLpBGH4QZ7F0bxZBiSb BPkCATbwbTzis9iWZazOcg0jBblQ+K+e1FjLMnR3H9AqfPWJPekjLipsJ5FuLyJmXrFfh1 4I71pgP2ZgsZKLrlMKku6Hz8TolcDwK4qbevGGsvCmXIFnedtIZ9sFnJVrQ1cVzqNU6OCK XTRlYpJRZvaK8qVVS0a8rTdUt2rJObqXr3IeZTiSBFQ+6WRacV4xrVqRjc5VsQ== Date: Mon, 24 Apr 2023 21:59:03 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Spamd-Bar: / Authentication-Results: jpoiret.xyz; auth=pass smtp.auth=jpoiret@jpoiret.xyz smtp.mailfrom=dev@jpoiret.xyz X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Josselin Poiret X-ACL-Warn: , Josselin Poiret via Guix-patches X-Patchwork-Original-From: Josselin Poiret via Guix-patches via From: Josselin Poiret Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/services/base.scm (substitute-key-authorization): Use %acl-file instead of hardcoded "/etc/guix/acl". --- 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 @@ (define-module (gnu services base) #: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 @@ (define keys (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.