# Select and initialise exactly one MongoDB server mode. # # Source this file from the extension's top-level source directory: # # source ./SETUP.bash # # The active installation is selected by the presence of exactly one of: # # _mongodb_standalone_setup.bash # _mongodb_cluster_setup.bash if [ ! -f ./_mongodb_os_dist_ver.bash ] || \ [ ! -d ./STANDALONE-SERVER ] || \ [ ! -d ./CLUSTER-SERVER ]; then echo "SETUP.bash must be sourced from the top-level MongoDB extension directory." >&2 return 1 2>/dev/null || exit 1 fi GS_MONGODB_STANDALONE_SETUP_FILE="./_mongodb_standalone_setup.bash" GS_MONGODB_CLUSTER_SETUP_FILE="./_mongodb_cluster_setup.bash" if [ -f "$GS_MONGODB_STANDALONE_SETUP_FILE" ] && \ [ -f "$GS_MONGODB_CLUSTER_SETUP_FILE" ]; then cat >&2 <<'EOF' Error: both MongoDB server setup files are active: _mongodb_standalone_setup.bash _mongodb_cluster_setup.bash There can be only one active MongoDB server setup in a working copy. Remove or rename one of these files, then source ./SETUP.bash again. EOF return 1 2>/dev/null || exit 1 fi if [ ! -f "$GS_MONGODB_STANDALONE_SETUP_FILE" ] && \ [ ! -f "$GS_MONGODB_CLUSTER_SETUP_FILE" ]; then cat >&2 <<'EOF' No active MongoDB server setup was found. For a standalone MongoDB server, run: cp _mongodb_standalone_setup.bash.in _mongodb_standalone_setup.bash The standalone defaults will normally work without editing. Review the copied file if you need a different port, bind address, or storage location. For a sharded MongoDB cluster, run: cp _mongodb_cluster_setup.bash.in _mongodb_cluster_setup.bash Then edit the copied file to set the router, config-server and shard hostnames. Only one of the two active setup files may exist in this working copy. EOF return 1 2>/dev/null || exit 1 fi if [ -f "$GS_MONGODB_STANDALONE_SETUP_FILE" ]; then . ./SETUP-STANDALONE-SERVER.bash || { unset GS_MONGODB_STANDALONE_SETUP_FILE unset GS_MONGODB_CLUSTER_SETUP_FILE return 1 2>/dev/null || exit 1 } else . ./SETUP-CLUSTER-SERVER.bash || { unset GS_MONGODB_STANDALONE_SETUP_FILE unset GS_MONGODB_CLUSTER_SETUP_FILE return 1 2>/dev/null || exit 1 } fi unset GS_MONGODB_STANDALONE_SETUP_FILE unset GS_MONGODB_CLUSTER_SETUP_FILE