From 1f7543f617a592c639ea60f0226575dabc676f80 Mon Sep 17 00:00:00 2001 From: Mark Allen Date: Wed, 11 May 2016 14:09:44 -0500 Subject: Canonicalize during deletes too --- kerl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'kerl') 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 -- cgit v1.2.3