pretify script a bit

This commit is contained in:
Mikhail Timofeev
2020-07-02 11:11:56 +03:00
parent b12baea320
commit 9de5dfef44

View File

@@ -2,29 +2,31 @@
################################################################################ ################################################################################
## File: aws-sam-cli.sh ## File: aws-sam-cli.sh
## Desc: Installs AWS SAM CLI ## Desc: Installs AWS SAM CLI
## Must be run after toolset installation ## Requires Pyton >=3.6, must be run after toolset installation
################################################################################ ################################################################################
# Source the helpers for use with the script # Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh source $HELPER_SCRIPTS/document.sh
# Install aws sam cli # Download latest aws sam cli sources
TarballUrl=$(curl -s https://api.github.com/repos/awslabs/aws-sam-cli/releases/latest | jq -r '.tarball_url') TarballUrl=$(curl -s https://api.github.com/repos/awslabs/aws-sam-cli/releases/latest | jq -r '.tarball_url')
TarballPath="/tmp/aws-sam-cli.tar.gz" TarballPath="/tmp/aws-sam-cli.tar.gz"
wget $TarballUrl -O $TarballPath wget $TarballUrl -O $TarballPath
tar -xzvf $TarballPath -C /tmp tar -xzvf $TarballPath -C /tmp
cd /tmp/awslabs-aws-sam-cli* SourcesDir=$(echo /tmp/awslabs-aws-sam-cli*)
# Use python 3.7 from toolcache to install aws sam, setuptools module required for the installation # Use python 3.7 from toolcache to install aws sam, setuptools module required for the installation
Python3Dir=$(echo ${AGENT_TOOLSDIRECTORY}/Python/3.7*/x64) Python3Dir=$(echo ${AGENT_TOOLSDIRECTORY}/Python/3.7*/x64)
Python3BinDir=$(echo ${Python3Dir}/bin) Python3BinDir=$(echo ${Python3Dir}/bin)
export PATH="$Python3Dir:$Python3BinDir:$PATH" export PATH="$Python3Dir:$Python3BinDir:$PATH"
python3 -m pip install setuptools python3 -m pip install setuptools
cd $SourcesDir
python3 setup.py install python3 setup.py install
sudo ln -sf ${Python3BinDir}/sam /usr/local/bin/sam sudo ln -sf ${Python3BinDir}/sam /usr/local/bin/sam
# Cleanup downloaded files # Cleanup downloaded files
rm -rf $TarballPath rm -rf $TarballPath
rm -rf /tmp/awslabs-aws-sam-cli* rm -rf $SourcesDir
# Run tests to determine that the software installed as expected # Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work" echo "Testing to make sure that script performed as expected, and basic scenarios work"