home-environment: fix cleanup of user replaced directories

We must only follow the symbolic link once (i.e., not use the `-e`
option) since otherwise the pattern will not match when
`home.file.xyz.source` is a directory.

(cherry picked from commit d807a5c314)
This commit is contained in:
Robert Helgesson 2017-07-22 00:23:36 +02:00
parent 7f2eacfe49
commit ee28f76369
No known key found for this signature in database
GPG key ID: C3DB11069E65DC86

View file

@ -310,7 +310,7 @@ in
targetPath="$HOME/$relativePath"
if [[ -e "$newGenFiles/$relativePath" ]] ; then
$VERBOSE_ECHO "Checking $targetPath exists"
elif [[ ! "$(readlink -e "$targetPath")" =~ "${pattern}" ]] ; then
elif [[ ! "$(readlink "$targetPath")" =~ "${pattern}" ]] ; then
warnEcho "Path '$targetPath' not link into Home Manager generation. Skipping delete."
else
echo "Checking $targetPath gone (deleting)"