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.
This commit is contained in:
parent
eb79e39074
commit
5bb5389192
6
ghcup
6
ghcup
@ -872,9 +872,13 @@ rm_ghc() {
|
|||||||
if ghc_already_installed "${myghcver}" ; then
|
if ghc_already_installed "${myghcver}" ; then
|
||||||
for f in "${BIN_LOCATION}"/*-"${myghcver}" ; do
|
for f in "${BIN_LOCATION}"/*-"${myghcver}" ; do
|
||||||
# https://tanguy.ortolo.eu/blog/article113/test-symlink
|
# 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}"
|
edo rm "${f}"
|
||||||
done
|
done
|
||||||
|
|
||||||
[ -z "${inst_location}" ] && die "internal error: inst_location empty!"
|
[ -z "${inst_location}" ] && die "internal error: inst_location empty!"
|
||||||
edo rm -r "${inst_location}"
|
edo rm -r "${inst_location}"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user