#!/usr/bin/env bash

#
#	MetaCall Dependencies Bash Script by Parra Studios
#	Remove all packages and unused data from MetaCall building and testing.
#
#	Copyright (C) 2016 - 2021 Vicente Eduardo Ferrer Garcia <vic798@gmail.com>
#
#	Licensed under the Apache License, Version 2.0 (the "License");
#	you may not use this file except in compliance with the License.
#	You may obtain a copy of the License at
#
#		http://www.apache.org/licenses/LICENSE-2.0
#
#	Unless required by applicable law or agreed to in writing, software
#	distributed under the License is distributed on an "AS IS" BASIS,
#	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#	See the License for the specific language governing permissions and
#	limitations under the License.
#

NETCORE_INSTALL_DIR=/usr/share/dotnet

# TODO: NetCore 2

# Download and install NetCore
if [ ! -f $NETCORE_INSTALL_DIR/dotnet ]; then
	curl -s https://dot.net/v1/dotnet-install.sh &> dotnet-install.sh \
		&& chmod +x dotnet-install.sh \
		&& ./dotnet-install.sh --runtime dotnet --channel 1.0 --version 1.1.10 --install-dir $NETCORE_INSTALL_DIR \
		&& ln -s $NETCORE_INSTALL_DIR/dotnet /usr/bin/dotnet \
		&& rm dotnet-install.sh
fi
