Created
September 14, 2018 13:20
-
-
Save blendsdk/b496034bf1c54157b8c69d2475f9706e to your computer and use it in GitHub Desktop.
.NET Core project setup.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | |
DOTNET_ROOT=${SCRIPT_DIR}/.dotnet | |
BIN_DIR=${SCRIPT_DIR}/bin | |
DOTNET_INSTALL=${BIN_DIR}/dotnet-install.sh | |
DOTNET=${DOTNET_ROOT}/dotnet | |
CAKE=${BIN_DIR}/dotnet-cake | |
export DOTNET_CLI_TELEMETRY_OPTOUT=1 | |
export DOTNET_ROOT | |
if [ ! -d ${BIN_DIR} ]; then | |
echo "Creating ${BIN_DIR}"; | |
mkdir -p ${BIN_DIR} | |
fi | |
if [ ! -d ${DOTNET_ROOT} ]; then | |
echo "Installing .NET Core" | |
mkdir -p ${DOTNET_ROOT} | |
wget -q -O ${DOTNET_INSTALL} https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain/dotnet-install.sh | |
chmod +x ${DOTNET_INSTALL} | |
${DOTNET_INSTALL} --channel Current --install-dir ${DOTNET_ROOT} | |
cd ${BIN_DIR} && ln -s ../.dotnet/dotnet && cd .. | |
fi | |
if [ ! -f ${CAKE} ]; then | |
echo "Installing Cake Build" | |
${DOTNET} tool install --tool-path=${BIN_DIR} Cake.Tool --version 0.30.0 | |
printf "#!/bin/bash\nexport DOTNET_ROOT=${DOTNET_ROOT}\nSCRIPT_DIR=\$( cd \"\$( dirname \"\${BASH_SOURCE[0]}\" )\" && pwd )\n\${SCRIPT_DIR}/dotnet-cake \"\$@\"" > ${BIN_DIR}/cake | |
chmod +x ${BIN_DIR}/cake | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment