summaryrefslogtreecommitdiff
path: root/gnu/services
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2025-07-01 23:13:29 +0200
committerLudovic Courtès <ludo@gnu.org>2025-07-01 23:40:09 +0200
commitc33bc8008090bafda228e475dedc71cd06f56e4f (patch)
treed61c51e5f0fbcc17c59c0f50c97512d8eb864ba6 /gnu/services
parent04e80066a2ecb90b3cd75200e758aa071222fcd3 (diff)
services: guix: ‘guix-ownership’ changes store ownership last.
Fixes <https://issues.guix.gnu.org/78355>. * 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 <rutherther@ditigal.xyz> Change-Id: I55189f8bb82bf0c9e030aa042aa928f6f552569e
Diffstat (limited to 'gnu/services')
-rw-r--r--gnu/services/base.scm11
1 files changed, 7 insertions, 4 deletions
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 88dbcbf72a6..cfebfcda0f2 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -1997,10 +1997,9 @@ of Guix to the given UID and GID."
1997 lstat)) 1997 lstat))
1998 1998
1999 (define (claim-data-ownership uid gid) 1999 (define (claim-data-ownership uid gid)
2000 (format #t "Changing file ownership for /gnu/store \ 2000 (format #t "Changing file ownership for ~a \
2001and data directories to ~a:~a...~%" 2001and data directories to ~a:~a...~%"
2002 uid gid) 2002 #$(%store-prefix) uid gid)
2003 (change-ownership #$(%store-prefix) uid gid)
2004 (let ((excluded '("." ".." "profiles" "userpool"))) 2003 (let ((excluded '("." ".." "profiles" "userpool")))
2005 (for-each (lambda (directory) 2004 (for-each (lambda (directory)
2006 (change-ownership (in-vicinity "/var/guix" directory) 2005 (change-ownership (in-vicinity "/var/guix" directory)
@@ -2012,7 +2011,11 @@ and data directories to ~a:~a...~%"
2012 (chown "/var/guix" uid gid) 2011 (chown "/var/guix" uid gid)
2013 (change-ownership "/etc/guix" uid gid) 2012 (change-ownership "/etc/guix" uid gid)
2014 (mkdir-p "/var/log/guix") 2013 (mkdir-p "/var/log/guix")
2015 (change-ownership "/var/log/guix" uid gid)) 2014 (change-ownership "/var/log/guix" uid gid)
2015
2016 ;; Change the store last so that, if this service is interrupted,
2017 ;; ownership appears as having yet to be changed.
2018 (change-ownership #$(%store-prefix) uid gid))
2016 2019
2017 (match (command-line) 2020 (match (command-line)
2018 ((_ (= string->number (? integer? uid)) 2021 ((_ (= string->number (? integer? uid))