files: improve 'target not in $HOME' check

Check for prefix instead of inclusion.
This commit is contained in:
Cornelius Mika 2017-12-01 11:15:50 +01:00 committed by Robert Helgesson
parent 8759a5a63e
commit f6900f0689
No known key found for this signature in database
GPG key ID: C3DB11069E65DC86

View file

@ -217,7 +217,7 @@ in
target="$(realpath -m "$out/$relTarget")"
# Target path must be within $HOME.
if [[ ! $target =~ $out ]] ; then
if [[ ! $target == $out* ]] ; then
echo "Error installing file '$relTarget' outside \$HOME" >&2
exit 1
fi