|
|
|
@ -15,45 +15,50 @@ is_arch_package_installed() {
|
|
|
|
|
pacman -Q "$1" &> /dev/null |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# Uninstall Bitcoin from source |
|
|
|
|
# Function to uninstall Bitcoin from source |
|
|
|
|
uninstall_bitcoin_from_source() { |
|
|
|
|
say "Uninstalling Bitcoin Core installed from source" |
|
|
|
|
# Find the path to the bitcoin binary |
|
|
|
|
bitcoin_bin=$(which bitcoin) |
|
|
|
|
|
|
|
|
|
if [ -z "$bitcoin_bin" ]; then |
|
|
|
|
say "Could not find Bitcoin installed from source" |
|
|
|
|
return 1 |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
# Assume the parent directory of the binary is the source directory |
|
|
|
|
bitcoin_src_dir=$(dirname "$bitcoin_bin") |
|
|
|
|
|
|
|
|
|
say "Uninstalling Bitcoin Core installed from source in $bitcoin_src_dir" |
|
|
|
|
cd "$bitcoin_src_dir" |
|
|
|
|
sudo make uninstall |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# Uninstall Bitcoin package |
|
|
|
|
# Function to uninstall Bitcoin package |
|
|
|
|
uninstall_bitcoin_package() { |
|
|
|
|
say "Uninstalling Bitcoin Core package" |
|
|
|
|
|
|
|
|
|
# Detect the operating system's package manager |
|
|
|
|
if command -v apt &> /dev/null; then |
|
|
|
|
if is_deb_package_installed bitcoin; then |
|
|
|
|
# Detect the operating system's package manager and uninstall |
|
|
|
|
if command -v apt &> /dev/null && is_deb_package_installed bitcoin; then |
|
|
|
|
say "Uninstalling Bitcoin Core package installed with apt" |
|
|
|
|
sudo apt-get remove -y bitcoin |
|
|
|
|
fi |
|
|
|
|
elif command -v dnf &> /dev/null; then |
|
|
|
|
if is_rpm_package_installed bitcoin; then |
|
|
|
|
elif command -v dnf &> /dev/null && is_rpm_package_installed bitcoin; then |
|
|
|
|
say "Uninstalling Bitcoin Core package installed with dnf" |
|
|
|
|
sudo dnf remove -y bitcoin |
|
|
|
|
fi |
|
|
|
|
elif command -v pacman &> /dev/null; then |
|
|
|
|
if is_arch_package_installed bitcoin; then |
|
|
|
|
elif command -v pacman &> /dev/null && is_arch_package_installed bitcoin; then |
|
|
|
|
say "Uninstalling Bitcoin Core package installed with pacman" |
|
|
|
|
sudo pacman -Rns bitcoin --noconfirm |
|
|
|
|
fi |
|
|
|
|
elif command -v brew &> /dev/null; then |
|
|
|
|
if brew list --cask bitcoin-core; then |
|
|
|
|
elif command -v brew &> /dev/null && brew list --cask bitcoin-core; then |
|
|
|
|
say "Uninstalling Bitcoin Core package installed with brew" |
|
|
|
|
brew uninstall --cask bitcoin-core |
|
|
|
|
fi |
|
|
|
|
else |
|
|
|
|
say "Unsupported package manager" |
|
|
|
|
exit 1 |
|
|
|
|
# If no package manager is found, assume it was installed from source |
|
|
|
|
uninstall_bitcoin_from_source |
|
|
|
|
fi |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# Uninstall Bitcoin |
|
|
|
|
# Function to uninstall Bitcoin |
|
|
|
|
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]* ) |
|
|
|
|
uninstall_bitcoin_from_source |
|
|
|
|
uninstall_bitcoin_package |
|
|
|
|
;; |
|
|
|
|
[Nn]* ) |
|
|
|
|