From c33bc8008090bafda228e475dedc71cd06f56e4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 1 Jul 2025 23:13:29 +0200 Subject: [PATCH] =?UTF-8?q?services:=20guix:=20=E2=80=98guix-ownership?= =?UTF-8?q?=E2=80=99=20changes=20store=20ownership=20last.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes . * gnu/services/base.scm (guix-ownership-change-program)[claim-data-ownership]: Replace hard-coded “/gnu/store” with #$(store-prefix). Change store ownership last. Reported-by: Rutherther Change-Id: I55189f8bb82bf0c9e030aa042aa928f6f552569e --- gnu/services/base.scm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 88dbcbf72a..cfebfcda0f 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -1997,10 +1997,9 @@ of Guix to the given UID and GID." lstat)) (define (claim-data-ownership uid gid) - (format #t "Changing file ownership for /gnu/store \ + (format #t "Changing file ownership for ~a \ and data directories to ~a:~a...~%" - uid gid) - (change-ownership #$(%store-prefix) uid gid) + #$(%store-prefix) uid gid) (let ((excluded '("." ".." "profiles" "userpool"))) (for-each (lambda (directory) (change-ownership (in-vicinity "/var/guix" directory) @@ -2012,7 +2011,11 @@ and data directories to ~a:~a...~%" (chown "/var/guix" uid gid) (change-ownership "/etc/guix" uid gid) (mkdir-p "/var/log/guix") - (change-ownership "/var/log/guix" uid gid)) + (change-ownership "/var/log/guix" uid gid) + + ;; Change the store last so that, if this service is interrupted, + ;; ownership appears as having yet to be changed. + (change-ownership #$(%store-prefix) uid gid)) (match (command-line) ((_ (= string->number (? integer? uid))