aboutsummaryrefslogtreecommitdiff
path: root/gnu/services/base.scm
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2024-04-09 16:44:22 +0100
committerChristopher Baines <mail@cbaines.net>2024-04-09 16:46:34 +0100
commit6cae1db889f62051580d5a365f62585412a53a8c (patch)
tree4d3db074d50ca3e2109cced17bec77f207a0c1fd /gnu/services/base.scm
parent410e699e0933653e69d03a4cdadf11854c6723f4 (diff)
parent35e1d9247e39f3c91512cf3d9ef1467962389e35 (diff)
downloadguix-6cae1db889f62051580d5a365f62585412a53a8c.tar.gz
guix-6cae1db889f62051580d5a365f62585412a53a8c.zip
Merge remote-tracking branch 'savannah/master' into mesa-updates
Change-Id: Iad185e2ced97067b3dff8fd722435a6c5e2c00e5
Diffstat (limited to 'gnu/services/base.scm')
-rw-r--r--gnu/services/base.scm15
1 files changed, 8 insertions, 7 deletions
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 5104b3d104..3f912225a0 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -1790,13 +1790,14 @@ archive' public keys, with GUIX."
;; If MACHINES-FILE already exists, move it out of the way.
;; Create a backup if it's a regular file: it's likely that the
;; user manually updated it.
- (if (file-exists? machines-file)
- (if (and (symbolic-link? machines-file)
- (store-file-name? (readlink machines-file)))
- (delete-file machines-file)
- (rename-file machines-file
- (string-append machines-file ".bak")))
- (mkdir-p (dirname machines-file)))
+ (let ((stat (false-if-exception (lstat machines-file))))
+ (if stat
+ (if (and (eq? 'symlink (stat:type stat))
+ (store-file-name? (readlink machines-file)))
+ (delete-file machines-file)
+ (rename-file machines-file
+ (string-append machines-file ".bak")))
+ (mkdir-p (dirname machines-file))))
;; Installed the declared machines file.
(symlink #+(scheme-file "machines.scm"