From b694217d91fe84458d0f1babd96e7ad9496c4d6c Mon Sep 17 00:00:00 2001 From: illuminatus Date: Wed, 15 Nov 2023 08:14:04 -0800 Subject: [PATCH] mkdir in generate for existing guild environments --- scripts/cnode-helper-scripts/mithril-client.sh | 7 +++++++ scripts/cnode-helper-scripts/mithril-signer.sh | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/scripts/cnode-helper-scripts/mithril-client.sh b/scripts/cnode-helper-scripts/mithril-client.sh index 728261746..d74ba9c5d 100755 --- a/scripts/cnode-helper-scripts/mithril-client.sh +++ b/scripts/cnode-helper-scripts/mithril-client.sh @@ -15,6 +15,9 @@ # Do NOT modify code below # ###################################### +U_ID=$(id -u) +G_ID=$(id -g) + ##################### # Functions # ##################### @@ -34,6 +37,10 @@ usage() { generate_environment_file() { + if [[ ! -d "${CNODE_HOME}/mithril/data-stores" ]]; then + sudo mkdir -p "${CNODE_HOME}"/mithril/data-stores + sudo chown -R "$U_ID":"$G_ID" "${CNODE_HOME}"/mithril 2>/dev/null + fi if [[ -n "${POOL_NAME}" ]] && [[ "${POOL_NAME}" != "CHANGE_ME" ]]; then export ERA_READER_ADDRESS=https://raw.githubusercontent.com/input-output-hk/mithril/main/mithril-infra/configuration/${RELEASE}-${NETWORK_NAME,,}/era.addr export ERA_READER_VKEY=https://raw.githubusercontent.com/input-output-hk/mithril/main/mithril-infra/configuration/${RELEASE}-${NETWORK_NAME,,}/era.vkey diff --git a/scripts/cnode-helper-scripts/mithril-signer.sh b/scripts/cnode-helper-scripts/mithril-signer.sh index cd5090743..dd93187de 100755 --- a/scripts/cnode-helper-scripts/mithril-signer.sh +++ b/scripts/cnode-helper-scripts/mithril-signer.sh @@ -16,6 +16,9 @@ # Do NOT modify code below # ###################################### +U_ID=$(id -u) +G_ID=$(id -g) + ##################### # Functions # ##################### @@ -71,6 +74,10 @@ get_relay_endpoint() { } generate_environment_file() { + if [[ ! -d "${CNODE_HOME}/mithril/data-stores" ]]; then + sudo mkdir -p "${CNODE_HOME}"/mithril/data-stores + sudo chown -R "$U_ID":"$G_ID" "${CNODE_HOME}"/mithril 2>/dev/null + fi # Inquire about the relay endpoint read -r -p "Are you using a relay endpoint? (y/n, press Enter to use default y): " ENABLE_RELAY_ENDPOINT ENABLE_RELAY_ENDPOINT=${ENABLE_RELAY_ENDPOINT:-y}