aboutsummaryrefslogtreecommitdiff
path: root/guix/build/profiles.scm
diff options
context:
space:
mode:
authorLeo Famulari <leo@famulari.name>2018-09-13 13:32:39 -0400
committerLeo Famulari <leo@famulari.name>2018-09-13 13:32:39 -0400
commitd7639407110a584c18bb362c942eeb0933188c66 (patch)
tree8068d0737e2a65f8f9f7080b7f9fb36a74e58e2c /guix/build/profiles.scm
parent36e8185667c41740786d9b2eb3672a0f8b902ed8 (diff)
parent7d1cc612938565d935c53bd7a429f41d1f048dae (diff)
downloadgnu-guix-d7639407110a584c18bb362c942eeb0933188c66.tar
gnu-guix-d7639407110a584c18bb362c942eeb0933188c66.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'guix/build/profiles.scm')
-rw-r--r--guix/build/profiles.scm15
1 files changed, 12 insertions, 3 deletions
diff --git a/guix/build/profiles.scm b/guix/build/profiles.scm
index df785c85a7..0c23cd300e 100644
--- a/guix/build/profiles.scm
+++ b/guix/build/profiles.scm
@@ -94,12 +94,20 @@ definitions for all the SEARCH-PATHS."
(for-each (write-environment-variable-definition port)
(map (abstract-profile output) variables))))))
-(define (ensure-writable-directory directory)
+(define* (ensure-writable-directory directory
+ #:key (symlink symlink))
"Ensure DIRECTORY exists and is writable. If DIRECTORY is currently a
symlink (to a read-only directory in the store), then delete the symlink and
instead make DIRECTORY a \"real\" directory containing symlinks."
+ (define (absolute? file)
+ (string-prefix? "/" file))
+
(define (unsymlink link)
- (let* ((target (readlink link))
+ (let* ((target (match (readlink link)
+ ((? absolute? target)
+ target)
+ ((? string? relative)
+ (string-append (dirname link) "/" relative))))
;; TARGET might itself be a symlink, so append "/" to make sure
;; 'scandir' enters it.
(files (scandir (string-append target "/")
@@ -149,7 +157,8 @@ SEARCH-PATHS."
;; Make sure we can write to 'OUTPUT/etc'. 'union-build' above could have
;; made 'etc' a symlink to a read-only sub-directory in the store so we need
;; to work around that.
- (ensure-writable-directory (string-append output "/etc"))
+ (ensure-writable-directory (string-append output "/etc")
+ #:symlink symlink)
;; Write 'OUTPUT/etc/profile'.
(build-etc/profile output search-paths))