From 5bb5389192fc1abf55409c61d66cfbef1586457e Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Sat, 27 Oct 2018 14:45:14 +0800 Subject: [PATCH] Make uninstallation more robust For an incomplete installation, we still want to remove what is left over, so don't fail on non-existing symlinks in $BIN_LOCATION. --- ghcup | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ghcup b/ghcup index 988b158..ee7a7ef 100755 --- a/ghcup +++ b/ghcup @@ -872,9 +872,13 @@ rm_ghc() { if ghc_already_installed "${myghcver}" ; then for f in "${BIN_LOCATION}"/*-"${myghcver}" ; do # https://tanguy.ortolo.eu/blog/article113/test-symlink - [ ! -e "${f}" ] && [ ! -h "${f}" ] && die "Something went wrong, ${f} does not exist!" + [ ! -e "${f}" ] && [ ! -h "${f}" ] && { + warning_message "No existing symlinks for ${myghcver} in ${BIN_LOCATION}, skipping" + break + } edo rm "${f}" done + [ -z "${inst_location}" ] && die "internal error: inst_location empty!" edo rm -r "${inst_location}"