Script to maintain dontet core SDK with the current latest LTS versions
#!/bin/sh | |
# Get the MSFT uninstall script from GitHub: | |
# | |
# curl -sSL https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain/uninstall/dotnet-uninstall-pkgs.sh | sudo tee /usr/local/bin/dotnet-uninstall-pkgs > /dev/null | |
# sudo chmod +x /usr/local/bin/dotnet-uninstall-pkgs | |
# | |
uninstall_cmd=dotnet-uninstall-pkgs | |
# MSFT install script documented on docs.microsoft.com | |
# https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script | |
# | |
# curl -sSL https://dot.net/v1/dotnet-install.sh | sudo tee /usr/local/bin/dotnet-install > /dev/null | |
# chmod +x /usr/local/bin/dotnet-install | |
# | |
install_cmd=dotnet-install | |
# also set within dotnet-uninstall-pkgs.sh | |
dotnet_install_root="/usr/local/share/dotnet" | |
dotnet_path_file="/etc/paths.d/dotnet" | |
dotnet_tool_path_file="/etc/paths.d/dotnet-cli-tools" | |
current_userid=$(id -u) | |
if [ $current_userid -ne 0 ]; then | |
echo "$(basename "$0") requires superuser privileges to run" >&2 | |
exit 1 | |
fi | |
${uninstall_cmd} | |
${install_cmd} --install-dir ${dotnet_install_root} --no-path --channel 2.1 # old LTS Channel | |
${install_cmd} --install-dir ${dotnet_install_root} --no-path --channel LTS # current LTS Channel | |
echo adding dotnet and tools to path. | |
# created by pkg installers but not the install script | |
echo ${dotnet_install_root} > ${dotnet_path_file} | |
echo "~/.dotnet/tools" > ${dotnet_tool_path_file} | |
eval $(/usr/libexec/path_helper -s) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
Set up.