1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-04-06 21:20:33 +02:00

activation: copy-account-skeletons: Make all copied skeletons writable.

Previously, copying skeleton ‘.config/nano/nanorc’ to user home won't make
‘~/.config/nano/nanorc’ writable.

* gnu/build/activation.scm (copy-account-skeletons)
[set-owner]: Make all copied skeleton writable.
Rename procedure to ‘set-permission’.

Change-Id: I24a2bda42bc5af803857dc090e487b6a040b58be
Signed-off-by: Hilton Chain <hako@ultrarare.space>
Merges: #6149
This commit is contained in:
Hilton Chain
2026-02-05 22:49:10 +08:00
parent 689ee928a6
commit 4d1966c375

View File

@@ -141,12 +141,13 @@ and bits are set according to the default behaviour of 'mkdir'."
#:key #:key
(directory %skeleton-directory) (directory %skeleton-directory)
uid gid) uid gid)
"Copy the account skeletons from DIRECTORY to HOME. When UID is an integer, "Copy the account skeletons from DIRECTORY to HOME and make them writable.
make it the owner of all the files created except the home directory; likewise When UID is an integer, make it the owner of all the files created except the
for GID." home directory; likewise for GID."
(define (set-owner file) (define (set-permission file)
(when (or uid gid) (when (or uid gid)
(chown file (or uid -1) (or gid -1)))) (chown file (or uid -1) (or gid -1)))
(make-file-writable file))
(let ((files (scandir directory (negate dot-or-dot-dot?) (let ((files (scandir directory (negate dot-or-dot-dot?)
string<?))) string<?)))
@@ -156,10 +157,9 @@ for GID."
(copy-recursively (string-append directory "/" file) (copy-recursively (string-append directory "/" file)
target target
#:log (%make-void-port "w")) #:log (%make-void-port "w"))
(for-each set-owner (for-each set-permission
(find-files target (const #t) (find-files target (const #t)
#:directories? #t)) #:directories? #t))))
(make-file-writable target)))
files))) files)))
(define* (make-skeletons-writable home (define* (make-skeletons-writable home