From 5121646050d7e7601e2b4411673bc29ac27bc5ec 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 728261746e..70cd3189b6 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 # ##################### @@ -35,6 +38,10 @@ usage() { generate_environment_file() { if [[ -n "${POOL_NAME}" ]] && [[ "${POOL_NAME}" != "CHANGE_ME" ]]; then + 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 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 bash -c "cat <<-'EOF' > ${CNODE_HOME}/mithril/mithril.env diff --git a/scripts/cnode-helper-scripts/mithril-signer.sh b/scripts/cnode-helper-scripts/mithril-signer.sh index cd50907433..62487e1290 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 # ##################### @@ -81,6 +84,10 @@ generate_environment_file() { fi # Generate the full set of environment variables required by Mithril signer use case + 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 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 sudo bash -c "cat <<-'EOF' > ${CNODE_HOME}/mithril/mithril.env