Skip to content

Commit

Permalink
Add switch between testnet/mainnet feature
Browse files Browse the repository at this point in the history
  • Loading branch information
coincashew committed Jun 21, 2024
1 parent f8489a8 commit 9731a77
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 6 deletions.
3 changes: 2 additions & 1 deletion ethereum-metrics-exporter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
13 changes: 11 additions & 2 deletions ethpillar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
)
Expand Down Expand Up @@ -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
;;
Expand Down Expand Up @@ -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
}
Expand Down
9 changes: 7 additions & 2 deletions install-nimbus-nethermind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
20 changes: 19 additions & 1 deletion uninstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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(){
Expand Down

0 comments on commit 9731a77

Please sign in to comment.