guix: home: Do not relink correct link.

Julien LepillerSat Jul 25 23:44:34+0200 2020

04608ae

guix: home: Do not relink correct link. * guix/scripts/home.scm (ensure-home-profile): Do not relink when $HOME is already correctly linked.

guix/scripts/home.scm

160160
report an error."
161161
  (ensure-profile-directory)
162162
163-
  (when %home %current-home
163+
  (when (and %home %current-home)
164164
    (let ((home (false-if-exception (lstat %home))))
165165
      (cond
166166
        ((equal? (stat:type home) 'symlink)
167-
         (delete-file %home)
168-
         (symlink %current-home %home))
167+
         (unless (equal? (readlink %home) %current-home)
168+
           (delete-file %home)
169+
           (symlink %current-home %home)))
169170
        ((false-if-exception (lstat data-directory))
170171
         (leave (G_ "Your $HOME directory (~a) is not a symlink to the home
171172
profile, and it cannot be moved as ~a already exists on the filesystem.~%")