diff --git a/ethereum-metrics-exporter.sh b/ethereum-metrics-exporter.sh index 01f47b5..805ba2c 100755 --- a/ethereum-metrics-exporter.sh +++ b/ethereum-metrics-exporter.sh @@ -75,7 +75,8 @@ function removeAll() { sudo systemctl disable grafana-server prometheus prometheus-node-exporter sudo systemctl stop grafana-server prometheus prometheus-node-exporter sudo apt remove -y grafana prometheus prometheus-node-exporter - whiptail --title "Uninstall finished" --msgbox "You have uninstalled all monitoring tools." 8 78 + sudo rm /etc/apt/sources.list.d/grafana.list + whiptail --title "Uninstall finished" --msgbox "You have uninstalled all monitoring tools." 8 78 fi } diff --git a/ethpillar.sh b/ethpillar.sh index 4d85d3e..b395528 100755 --- a/ethpillar.sh +++ b/ethpillar.sh @@ -12,7 +12,7 @@ # 🙌 Ask questions on Discord: # * https://discord.gg/dEpAVWgFNB -VERSION="1.7.2" +VERSION="1.7.3" BASE_DIR=$HOME/git/ethpillar # Load functions @@ -403,6 +403,7 @@ while true; do - "" 20 "Configure autostart" 21 "Uninstall node" + 22 "Change Network: Switch between Testnet/Mainnet" - "" 99 "Back to main menu" ) @@ -471,6 +472,14 @@ while true; do 21) runScript uninstall.sh ;; + 22) + if whiptail --title "Switch Networks" --defaultno --yesno "Are you sure you want to switch networks?\nAll current node data will be removed." 9 78; then + if runScript uninstall.sh; then + runScript install-nimbus-nethermind.sh true + whiptail --title "Switch Networks" --msgbox "Completed network switching process." 8 78 + fi + fi + ;; 99) break ;; @@ -953,7 +962,7 @@ function checkV1StakingSetup(){ function askInstallNode(){ if [[ ! -f /etc/systemd/system/consensus.service ]]; then if whiptail --title "Install Node" --yesno "Would you like to install an Ethereum node (Nimbus CL & Nethermind EL)?" 8 78; then - runScript install-nimbus-nethermind.sh + runScript install-nimbus-nethermind.sh true fi fi } diff --git a/install-nimbus-nethermind.sh b/install-nimbus-nethermind.sh index 171b83d..8977ad1 100755 --- a/install-nimbus-nethermind.sh +++ b/install-nimbus-nethermind.sh @@ -14,6 +14,11 @@ set -o history -o histexpand python="python3" +skip_prompt="" +if [[ $# -eq 1 ]]; then + skip_prompt="$1" +fi + abort() { printf "%s\n" "$1" exit 1 @@ -109,7 +114,7 @@ linux_update_pip() { linux_install_validator-install() { ohai "Cloning ethpillar into ~/git/ethpillar" mkdir -p ~/git/ethpillar - git clone https://github.com/coincashew/ethpillar.git ~/git/ethpillar 2> /dev/null || (cd ~/git/ethpillar ; git fetch origin master ; git checkout master ; git pull --ff-only ; git reset --hard) + git clone https://github.com/coincashew/ethpillar.git ~/git/ethpillar 2> /dev/null || (cd ~/git/ethpillar ; git fetch origin master ; git checkout master ; git pull) ohai "Installing validator-install" $python ~/git/ethpillar/deploy-nimbus-nethermind.py ohai "Allowing user to view journalctl logs" @@ -144,7 +149,7 @@ if [[ "$OS" == "Linux" ]]; then echo "python3-tk python3-pip python3-venv" echo "validator-install" - wait_for_user + if [[ -z $skip_prompt ]]; then wait_for_user; fi linux_install_pre linux_install_python linux_update_pip diff --git a/uninstall.sh b/uninstall.sh index e5e095f..cfef2d1 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -12,8 +12,26 @@ function promptYesNo(){ uninstallEL uninstallVC uninstallMevboost + cleanupMisc whiptail --title "Uninstall finished" --msgbox "You have uninstalled this staking node and all validator keys." 8 78 - fi + else + echo "Cancelled uninstall." && return 1 + fi +} + +function cleanupMisc(){ + if [[ -f /etc/systemd/system/ethereum-metrics-exporter.service ]]; then + sudo rm /etc/apt/sources.list.d/grafana.list + sudo systemctl disable ethereum-metrics-exporter + sudo systemctl stop ethereum-metrics-exporter + sudo rm /etc/systemd/system/ethereum-metrics-exporter.service + sudo rm /usr/local/bin/ethereum-metrics-exporter + sudo systemctl disable grafana-server prometheus prometheus-node-exporter + sudo systemctl stop grafana-server prometheus prometheus-node-exporter + sudo apt remove -y grafana prometheus prometheus-node-exporter + fi + if [[ -f /usr/local/bin/eth-duties ]]; then sudo rm /usr/local/bin/eth-duties; fi + if [[ -f /usr/local/bin/ethdo ]]; then sudo rm /usr/local/bin/ethdo; fi } function uninstallCL(){