3 source="${BASH_SOURCE[0]}"
5 versionEndpoint
='https://maestro-prod.westus2.cloudapp.azure.com/api/assets/darc-version?api-version=2019-01-16'
9 opt
="$(echo "$1" | awk '{print tolower($0)}')"
28 echo "Invalid argument: $1"
37 # resolve $source until the file is no longer a symlink
38 while [[ -h "$source" ]]; do
39 scriptroot
="$( cd -P "$
( dirname "$source" )" && pwd )"
40 source="$(readlink "$source")"
41 # if $source was a relative symlink, we need to resolve it relative to the path where the
42 # symlink file was located
43 [[ $source != /* ]] && source="$scriptroot/$source"
45 scriptroot
="$( cd -P "$
( dirname "$source" )" && pwd )"
47 .
"$scriptroot/tools.sh"
49 if [ -z "$darcVersion" ]; then
50 darcVersion
=$
(curl
-X GET
"$versionEndpoint" -H "accept: text/plain")
53 function InstallDarcCli
{
54 local darc_cli_package_name
="microsoft.dotnet.darc"
57 local dotnet_root
=$_InitializeDotNetCli
59 if [ -z "$toolpath" ]; then
60 local tool_list
=$
($dotnet_root/dotnet tool list
-g)
61 if [[ $tool_list = *$darc_cli_package_name* ]]; then
62 echo $
($dotnet_root/dotnet tool uninstall
$darc_cli_package_name -g)
65 local tool_list
=$
($dotnet_root/dotnet tool list
--tool-path "$toolpath")
66 if [[ $tool_list = *$darc_cli_package_name* ]]; then
67 echo $
($dotnet_root/dotnet tool uninstall
$darc_cli_package_name --tool-path "$toolpath")
71 local arcadeServicesSource
="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json"
73 echo "Installing Darc CLI version $darcVersion..."
74 echo "You may need to restart your command shell if this is the first dotnet tool you have installed."
75 if [ -z "$toolpath" ]; then
76 echo $
($dotnet_root/dotnet tool
install $darc_cli_package_name --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity -g)
78 echo $
($dotnet_root/dotnet tool
install $darc_cli_package_name --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity --tool-path "$toolpath")