2021-04-27 20:46:24 +00:00
|
|
|
#!/usr/bin/env bash
|
2024-03-26 21:47:42 +00:00
|
|
|
# beacon_chain
|
|
|
|
# Copyright (c) 2020-2024 Status Research & Development GmbH
|
|
|
|
# Licensed and distributed under either of
|
|
|
|
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
|
|
|
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
|
|
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
2019-08-21 12:45:24 +00:00
|
|
|
|
2019-08-24 19:56:35 +00:00
|
|
|
# We use ${BASH_SOURCE[0]} instead of $0 to allow sourcing this file
|
|
|
|
# and we fall back to a Zsh-specific special var to also support Zsh.
|
|
|
|
REL_PATH="$(dirname ${BASH_SOURCE[0]:-${(%):-%x}})"
|
2024-03-26 21:47:42 +00:00
|
|
|
ABS_PATH="$(cd "${REL_PATH}"; pwd)"
|
2020-05-25 18:55:07 +00:00
|
|
|
|
|
|
|
# Activate nvm only when this file is sourced without arguments:
|
|
|
|
if [ -z "$*" ]; then
|
2022-10-15 01:46:30 +00:00
|
|
|
if ! command -v ganache-cli > /dev/null; then
|
|
|
|
if command -v nvm > /dev/null; then
|
|
|
|
nvm use
|
|
|
|
npm install -g ganache-cli
|
|
|
|
else
|
|
|
|
echo <<EOF
|
|
|
|
In order to use Ganache (a development ETH1 chain), please install NVM with:
|
|
|
|
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
|
2020-05-25 18:55:07 +00:00
|
|
|
|
2022-10-15 01:46:30 +00:00
|
|
|
For more info:
|
|
|
|
https://github.com/nvm-sh/nvm
|
2020-05-25 18:55:07 +00:00
|
|
|
EOF
|
2022-10-15 01:46:30 +00:00
|
|
|
fi
|
2020-05-25 18:55:07 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2020-11-24 21:21:47 +00:00
|
|
|
# The user env file allows you to specify personal overrides for some
|
|
|
|
# settings such as WEB3_URL, CPU_LIMIT, etc:
|
|
|
|
USER_ENV_FILE="${ABS_PATH}/.env"
|
|
|
|
if [ -f "${USER_ENV_FILE}" ]; then
|
2021-10-19 15:00:41 +00:00
|
|
|
set -o allexport
|
2020-11-24 21:21:47 +00:00
|
|
|
source "${USER_ENV_FILE}"
|
2021-10-19 15:00:41 +00:00
|
|
|
set +o allexport
|
2020-11-24 21:21:47 +00:00
|
|
|
fi
|
|
|
|
|
2024-03-26 21:47:42 +00:00
|
|
|
source "${ABS_PATH}/vendor/nimbus-build-system/scripts/env.sh"
|