mirror of
https://github.com/oceanprotocol/barge.git
synced 2024-11-22 09:47:04 +01:00
Warn user if ~/.ocean is owned by root (#122)
* Warn user if ~/.ocean is owned by root Reminder that #100 is not yet fixed * Updates start_ocean.sh Adds copyright notice (per @ttmc) Changes function name for file ownership to check_if_owned_by_root (per @aaitor) - adds a check for the KEEPER_ARTIFACTS_FOLDER (as required by --purge) Signed-off-by: Tom Marble <tmarble@info9.net>
This commit is contained in:
parent
4bfd9b0cee
commit
530f0d56ca
@ -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=""
|
||||
|
Loading…
Reference in New Issue
Block a user