From 70b2b4ca466582e62bbc15ac09e7b77059aa6c03 Mon Sep 17 00:00:00 2001 From: Yorick Date: Mon, 19 Feb 2024 12:42:29 +0000 Subject: [PATCH] Reth DB change cleanup --- ethd | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/ethd b/ethd index 2fb78ce3..8b54b89d 100755 --- a/ethd +++ b/ethd @@ -698,12 +698,12 @@ delete_reth() { return 0 fi -# Check Reth version, only continue if on that version +# Check Reth version, only continue if not on alpha var="RETH_DOCKER_TAG" value=$(sed -n -e "s/^${var}=\(.*\)/\1/p" "${ENV_FILE}" || true) # I do mean to match literally # shellcheck disable=SC2076 - if [[ ! ("${value}" =~ "beta" || "${value}" = "latest") ]]; then + if [[ "${value}" =~ "alpha" ]]; then return 0 fi @@ -720,13 +720,15 @@ delete_reth() { echo "Detected Reth. For Reth beta, it will need to be re-synced from scratch." echo - while true; do - read -rp "WARNING - About to delete the Reth database. Do you wish to continue? (Y/n) " yn - case $yn in - [Nn]o | [Nn] ) echo "Aborting, no changes made"; exit 130;; - * ) break;; - esac - done + if [ "${__non_interactive:-0}" -eq 0 ]; then + while true; do + read -rp "WARNING - About to delete the Reth database. Do you wish to continue? (Y/n) " yn + case $yn in + [Nn]o | [Nn] ) echo "No changes made"; return 0;; + * ) break;; + esac + done + fi echo "Stopping Reth container" docompose stop execution && docompose rm -f execution