Skip to content

Commit

Permalink
Testing if keys are being created from scratch or defaults are being …
Browse files Browse the repository at this point in the history
…used
  • Loading branch information
JoshuaSBrown committed Feb 22, 2024
1 parent d9d19e0 commit ffce97b
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions scripts/install_core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,24 @@ set -euf -o pipefail

SCRIPT=$(realpath "$0")
SOURCE=$(dirname "$SCRIPT")
PROJECT_ROOT=$(realpath ${SOURCE}/..)
source ${PROJECT_ROOT}/config/datafed.sh
PROJECT_ROOT=$(realpath "${SOURCE}/..")
source "${PROJECT_ROOT}/config/datafed.sh"

# Make sure paths exist
mkdir -p ${DATAFED_INSTALL_PATH}/core
mkdir -p ${DATAFED_INSTALL_PATH}/keys
mkdir -p ${DATAFED_DEFAULT_LOG_PATH}
mkdir -p "${DATAFED_INSTALL_PATH}/core"
mkdir -p "${DATAFED_INSTALL_PATH}/keys"
mkdir -p "${DATAFED_DEFAULT_LOG_PATH}"

# Copy configuration files
cp "$PROJECT_ROOT/config/datafed-core.cfg" ${DATAFED_INSTALL_PATH}/core
cp "$PROJECT_ROOT/config/datafed-core.cfg" "${DATAFED_INSTALL_PATH}/core"


# Move keys to Default:/opt/datafed/keys if they do not already exist
if [ ! -f ${DATAFED_INSTALL_PATH}/keys/datafed-core-key.priv ]
if [ ! -f "${DATAFED_INSTALL_PATH}/keys/datafed-core-key.priv" ]
then
# Generate keys
${DATAFED_INSTALL_PATH}/core/datafed-core --gen-keys
mv datafed-core-key.pub ${DATAFED_INSTALL_PATH}/keys/
mv datafed-core-key.priv ${DATAFED_INSTALL_PATH}/keys/
echo "No keys for core server were detected in ${DATAFED_INSTALL_PATH}/keys/ creating them"
"${DATAFED_INSTALL_PATH}/core/datafed-core" --gen-keys
mv datafed-core-key.pub "${DATAFED_INSTALL_PATH}/keys/"
mv datafed-core-key.priv "${DATAFED_INSTALL_PATH}/keys/"
fi

0 comments on commit ffce97b

Please sign in to comment.