diff --git a/spells/menu/bitcoin/uninstall-bitcoin b/spells/menu/bitcoin/uninstall-bitcoin index 9ea7f1c..144e476 100755 --- a/spells/menu/bitcoin/uninstall-bitcoin +++ b/spells/menu/bitcoin/uninstall-bitcoin @@ -20,8 +20,9 @@ uninstall_bitcoin_from_source() { echo "Attempting to uninstall Bitcoin Core installed from source..." make_directory=$(dirname "$(find / -name "Makefile.in" 2>/dev/null | grep "bitcoin")") if [ -n "$make_directory" ]; then - cd "$make_directory" && sudo make uninstall > /dev/null 2>&1 + cd "$make_directory" && sudo make uninstall > /dev/null 2>&1 && return 0 fi + return 1 } # Remove Bitcoin binaries explicitly @@ -41,28 +42,25 @@ uninstall_bitcoin_package() { # Detect the operating system's package manager if command -v apt &> /dev/null; then if is_deb_package_installed bitcoin; then - sudo apt remove -y bitcoin - return 0 + sudo apt remove -y bitcoin && return 0 fi elif command -v dnf &> /dev/null; then if is_rpm_package_installed bitcoin; then - sudo dnf remove -y bitcoin - return 0 + sudo dnf remove -y bitcoin && return 0 fi elif command -v pacman &> /dev/null; then if is_arch_package_installed bitcoin; then - sudo pacman -Rns bitcoin --noconfirm - return 0 + sudo pacman -Rns bitcoin --noconfirm && return 0 fi elif command -v brew &> /dev/null; then if brew list --cask bitcoin-core; then - brew uninstall --cask bitcoin-core - return 0 + brew uninstall --cask bitcoin-core && return 0 fi else echo "Unsupported package manager" return 1 fi + return 1 } # Uninstall Bitcoin @@ -70,8 +68,10 @@ uninstall_bitcoin() { read -p "This will uninstall Bitcoin Core and might delete your wallet data. Are you sure? (Y/n) " yn case $yn in [Yy]* ) - if ! uninstall_bitcoin_package && ! uninstall_bitcoin_from_source; then - remove_bitcoin_binaries + if ! uninstall_bitcoin_package; then + if ! uninstall_bitcoin_from_source; then + remove_bitcoin_binaries + fi fi ;; [Nn]* )