aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Allen <[email protected]>2016-05-11 14:09:44 -0500
committerMark Allen <[email protected]>2016-05-11 14:09:44 -0500
commit1f7543f617a592c639ea60f0226575dabc676f80 (patch)
tree847a6382f30c5459e187d9e2a679a7e2fa92370e
parent0154d1fe54a68ca2443d959317f7601e57c2bf76 (diff)
downloadkerl-1f7543f617a592c639ea60f0226575dabc676f80.tar.gz
kerl-1f7543f617a592c639ea60f0226575dabc676f80.tar.bz2
kerl-1f7543f617a592c639ea60f0226575dabc676f80.zip
Canonicalize during deletes too
-rwxr-xr-xkerl7
1 files changed, 5 insertions, 2 deletions
diff --git a/kerl b/kerl
index 15390c4..154ec2a 100755
--- a/kerl
+++ b/kerl
@@ -864,13 +864,16 @@ is_valid_install_path()
maybe_remove()
{
- if [ "$1" = "$HOME" ]; then
+ candidate=$(realpath "$1")
+ canonical_home=$(realpath "$HOME")
+
+ if [ "$candidate" = "$canonical_home" ]; then
echo "WARNING: You cannot remove an install from $HOME; it's your home directory."
return 0
fi
ACTIVE_PATH="$(get_active_path)"
- if [ "$1" = "$ACTIVE_PATH" ]; then
+ if [ "$candidate" = "$ACTIVE_PATH" ]; then
echo "ERROR: You cannot delete the active installation. Deactivate it first."
exit 1
fi