forked from vmware-tanzu/tanzu-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.bat
executable file
·37 lines (29 loc) · 1.09 KB
/
install.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
:: Copyright 2021 VMware Tanzu Community Edition contributors. All Rights Reserved.
:: SPDX-License-Identifier: Apache-2.0
:: Inspired by - https://github.com/vmware-tanzu/community-edition/blob/main/hack/install.bat
:: Script to install tanzu framework
:: Usage: .\hack\install.bat \path\to\tanzu-framework\core\binary
@echo off
:: start copy tanzu cli
SET TANZU_CLI_DIR=%ProgramFiles%\tanzu
mkdir "%TANZU_CLI_DIR%" || goto :error
copy /B /Y %1 "%TANZU_CLI_DIR%\tanzu.exe" || goto :error
:: set cli path
set PATH=%PATH%;%TANZU_CLI_DIR%
:: setx /M path "%path%;%TANZU_CLI_DIR%"
:: end copy tanzu cli
:: set plugin path
SET PLUGIN_DIR="%LocalAppData%\tanzu-cli"
SET TANZU_CACHE_DIR="%LocalAppData%\.cache\tanzu"
mkdir %PLUGIN_DIR% || goto :error
:: delete the plugin cache if it exists, before installing new plugins
rmdir /Q /S %TANZU_CACHE_DIR%
:: install plugins
tanzu plugin sync || goto :error
tanzu plugin list || goto :error
echo "Installation complete!"
echo "Please add %TANZU_CLI_DIR% permanently into your system's PATH."
goto :EOF
:error
echo Failed with error #%errorlevel%.
exit /b %errorlevel%