diff options
| author | Hilton Chain <hako@ultrarare.space> | 2026-02-05 22:49:10 +0800 |
|---|---|---|
| committer | Hilton Chain <hako@ultrarare.space> | 2026-02-06 19:14:46 +0800 |
| commit | 4d1966c37526a94e5d5e73fa7f772d9d5edd8bfb (patch) | |
| tree | ee01c28b9eb691992ebe069fd309c0936fa7ed55 /gnu/build/activation.scm | |
| parent | 689ee928a61fe95f3d9fca1a40bd81173b1c2e25 (diff) | |
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
Diffstat (limited to 'gnu/build/activation.scm')
| -rw-r--r-- | gnu/build/activation.scm | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/gnu/build/activation.scm b/gnu/build/activation.scm index e2d1734367d..53844c0990e 100644 --- a/gnu/build/activation.scm +++ b/gnu/build/activation.scm | |||
| @@ -141,12 +141,13 @@ and bits are set according to the default behaviour of 'mkdir'." | |||
| 141 | #:key | 141 | #:key |
| 142 | (directory %skeleton-directory) | 142 | (directory %skeleton-directory) |
| 143 | uid gid) | 143 | uid gid) |
| 144 | "Copy the account skeletons from DIRECTORY to HOME. When UID is an integer, | 144 | "Copy the account skeletons from DIRECTORY to HOME and make them writable. |
| 145 | make it the owner of all the files created except the home directory; likewise | 145 | When UID is an integer, make it the owner of all the files created except the |
| 146 | for GID." | 146 | home directory; likewise for GID." |
| 147 | (define (set-owner file) | 147 | (define (set-permission file) |
| 148 | (when (or uid gid) | 148 | (when (or uid gid) |
| 149 | (chown file (or uid -1) (or gid -1)))) | 149 | (chown file (or uid -1) (or gid -1))) |
| 150 | (make-file-writable file)) | ||
| 150 | 151 | ||
| 151 | (let ((files (scandir directory (negate dot-or-dot-dot?) | 152 | (let ((files (scandir directory (negate dot-or-dot-dot?) |
| 152 | string<?))) | 153 | string<?))) |
| @@ -156,10 +157,9 @@ for GID." | |||
| 156 | (copy-recursively (string-append directory "/" file) | 157 | (copy-recursively (string-append directory "/" file) |
| 157 | target | 158 | target |
| 158 | #:log (%make-void-port "w")) | 159 | #:log (%make-void-port "w")) |
| 159 | (for-each set-owner | 160 | (for-each set-permission |
| 160 | (find-files target (const #t) | 161 | (find-files target (const #t) |
| 161 | #:directories? #t)) | 162 | #:directories? #t)))) |
| 162 | (make-file-writable target))) | ||
| 163 | files))) | 163 | files))) |
| 164 | 164 | ||
| 165 | (define* (make-skeletons-writable home | 165 | (define* (make-skeletons-writable home |
