Browse Source

fixed progression

main
deicidus 1 year ago
parent
commit
148ef7e3ed
  1. 14
      spells/menu/bitcoin/uninstall-bitcoin

14
spells/menu/bitcoin/uninstall-bitcoin

@ -21,8 +21,6 @@ uninstall_bitcoin_from_source() {
make_directory=$(dirname "$(find / -name "Makefile.in" 2>/dev/null | grep "bitcoin")") make_directory=$(dirname "$(find / -name "Makefile.in" 2>/dev/null | grep "bitcoin")")
if [ -n "$make_directory" ]; then 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
else
return 1
fi fi
} }
@ -43,23 +41,27 @@ uninstall_bitcoin_package() {
# Detect the operating system's package manager # Detect the operating system's package manager
if command -v apt &> /dev/null; then if command -v apt &> /dev/null; then
if is_deb_package_installed bitcoin; then if is_deb_package_installed bitcoin; then
sudo apt-get remove -y bitcoin sudo apt remove -y bitcoin
return 0
fi fi
elif command -v dnf &> /dev/null; then elif command -v dnf &> /dev/null; then
if is_rpm_package_installed bitcoin; then if is_rpm_package_installed bitcoin; then
sudo dnf remove -y bitcoin sudo dnf remove -y bitcoin
return 0
fi fi
elif command -v pacman &> /dev/null; then elif command -v pacman &> /dev/null; then
if is_arch_package_installed bitcoin; then if is_arch_package_installed bitcoin; then
sudo pacman -Rns bitcoin --noconfirm sudo pacman -Rns bitcoin --noconfirm
return 0
fi fi
elif command -v brew &> /dev/null; then elif command -v brew &> /dev/null; then
if brew list --cask bitcoin-core; then if brew list --cask bitcoin-core; then
brew uninstall --cask bitcoin-core brew uninstall --cask bitcoin-core
return 0
fi fi
else else
echo "Unsupported package manager" echo "Unsupported package manager"
exit 1 return 1
fi fi
} }
@ -68,7 +70,9 @@ uninstall_bitcoin() {
read -p "This will uninstall Bitcoin Core and might delete your wallet data. Are you sure? (Y/n) " yn read -p "This will uninstall Bitcoin Core and might delete your wallet data. Are you sure? (Y/n) " yn
case $yn in case $yn in
[Yy]* ) [Yy]* )
uninstall_bitcoin_package || uninstall_bitcoin_from_source || remove_bitcoin_binaries if ! uninstall_bitcoin_package && ! uninstall_bitcoin_from_source; then
remove_bitcoin_binaries
fi
;; ;;
[Nn]* ) [Nn]* )
echo "Uninstallation cancelled" echo "Uninstallation cancelled"

Loading…
Cancel
Save