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.
This commit is contained in:
Robert Helgesson 2017-07-22 00:23:36 +02:00
parent 5862a05fb1
commit d807a5c314
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)"