#!/bin/bash

[ -z "$1" ] && echo "Run dt-install-sandbox-software to call this script" && exit 1


# This script is called via the dt-install-sandbox-software command.
# Do not run it directly.

if [ "$1" != "--env-loaded" ]; then
	[ -z "$2" ] && echo "Run dt-install-sandbox-software (version 1) to call this script" && exit 1
	export CS_BROADCASTER_SANDBOX=$1  # root of the sandbox
	export CS_BROADCASTER_TOP=$2      # root of the primary git project
	SB_ENV_FILE=$3            # name of the environment file to use
	export CS_BROADCASTER_NAME=`dirname $CS_BROADCASTER_SANDBOX`
	[ -z "$SB_ENV_FILE" ] && SB_ENV_FILE=defaults.sh
	. $CS_BROADCASTER_TOP/sandbox/$SB_ENV_FILE
fi

# Install node if specified with CS_BROADCASTER_NODE_VER
[ -n "$CS_BROADCASTER_NODE_VER" -a ! -L $CS_BROADCASTER_SANDBOX/node ] && dt-get-software -V $CS_BROADCASTER_NODE_VER node $CS_BROADCASTER_SANDBOX

# Install yarn if specified with CS_BROADCASTER_YARN_VER
# [ -n "$CS_BROADCASTER_YARN_VER" -a ! -L $CS_BROADCASTER_SANDBOX/yarn ] && dt-get-software -V $CS_BROADCASTER_YARN_VER yarn $CS_BROADCASTER_SANDBOX


# Put custom one-time only software installations here (such as git clones of additional repos,
# other software packages that will live in the sandbox, etc...).
#
# Note that there is no sandbox process, other than a first time install, that exeutes this hook.


exit 0
