diff --git a/start_ocean.sh b/start_ocean.sh index e678c60..e4cc40e 100755 --- a/start_ocean.sh +++ b/start_ocean.sh @@ -1,4 +1,7 @@ #!/usr/bin/env bash +# start_ocean.sh +# Copyright (c) 2019 Ocean Protocol contributors +# SPDX-License-Identifier: Apache-2.0 set -e @@ -12,10 +15,13 @@ COMPOSE_DIR="${DIR}/compose-files" export PROJECT_NAME="ocean" export FORCEPULL="false" +# Ocean filesystem artifacts +export OCEAN_HOME="${HOME}/.ocean" + # keeper options export KEEPER_OWNER_ROLE_ADDRESS="${KEEPER_OWNER_ROLE_ADDRESS}" export KEEPER_DEPLOY_CONTRACTS="false" -export KEEPER_ARTIFACTS_FOLDER="${HOME}/.ocean/keeper-contracts/artifacts" +export KEEPER_ARTIFACTS_FOLDER="${OCEAN_HOME}/keeper-contracts/artifacts" # Specify which ethereum client to run or connect to: development, kovan, spree or nile export KEEPER_NETWORK_NAME="nile" export NODE_COMPOSE_FILE="${COMPOSE_DIR}/nodes/nile_node.yml" @@ -63,6 +69,21 @@ function show_banner { echo "" } +function check_if_owned_by_root { + if [ -d "$OCEAN_HOME" ]; then + uid=$(ls -nd "$OCEAN_HOME" | awk '{print $3;}') + if [ "$uid" = "0" ]; then + printf $COLOR_R"WARN: $OCEAN_HOME is owned by root\n"$COLOR_RESET >&2 + else + uid=$(ls -nd "$KEEPER_ARTIFACTS_FOLDER" | awk '{print $3;}') + if [ "$uid" = "0" ]; then + printf $COLOR_R"WARN: $KEEPER_ARTIFACTS_FOLDER is owned by root\n"$COLOR_RESET >&2 + fi + fi + fi +} + +check_if_owned_by_root show_banner COMPOSE_FILES=""