files: improve 'target not in $HOME' check
Check for prefix instead of inclusion.
This commit is contained in:
parent
8759a5a63e
commit
f6900f0689
|
@ -217,7 +217,7 @@ in
|
||||||
target="$(realpath -m "$out/$relTarget")"
|
target="$(realpath -m "$out/$relTarget")"
|
||||||
|
|
||||||
# Target path must be within $HOME.
|
# Target path must be within $HOME.
|
||||||
if [[ ! $target =~ $out ]] ; then
|
if [[ ! $target == $out* ]] ; then
|
||||||
echo "Error installing file '$relTarget' outside \$HOME" >&2
|
echo "Error installing file '$relTarget' outside \$HOME" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue