change CRLF to LF (#1069)

This commit is contained in:
Mikhail Timofeev
2020-06-18 08:32:52 +03:00
committed by GitHub
parent 80a48cfd45
commit e0a9c9eddb
2 changed files with 137 additions and 137 deletions

View File

@@ -1,43 +1,43 @@
#!/bin/bash #!/bin/bash
################################################################################ ################################################################################
## File: azpowershell.sh ## File: azpowershell.sh
## Desc: Installed Azure PowerShell ## Desc: Installed Azure PowerShell
################################################################################ ################################################################################
# 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
source $HELPER_SCRIPTS/os.sh source $HELPER_SCRIPTS/os.sh
# List of versions # List of versions
if isUbuntu20 ; then if isUbuntu20 ; then
versions=$(pwsh -Command '(Find-Module -Name Az).Version') versions=$(pwsh -Command '(Find-Module -Name Az).Version')
else else
versions=(1.0.0 1.6.0 2.3.2 2.6.0 2.8.0 3.1.0 3.5.0 3.8.0) versions=(1.0.0 1.6.0 2.3.2 2.6.0 2.8.0 3.1.0 3.5.0 3.8.0)
fi fi
# Install Azure CLI (instructions taken from https://docs.microsoft.com/en-us/cli/azure/install-azure-cli) # Install Azure CLI (instructions taken from https://docs.microsoft.com/en-us/cli/azure/install-azure-cli)
for version in ${versions[@]}; do for version in ${versions[@]}; do
pwsh -Command "Save-Module -Name Az -LiteralPath /usr/share/az_$version -RequiredVersion $version -Force" pwsh -Command "Save-Module -Name Az -LiteralPath /usr/share/az_$version -RequiredVersion $version -Force"
done done
# 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"
for version in ${versions[@]}; do for version in ${versions[@]}; do
modulePath="/usr/share/az_$version" modulePath="/usr/share/az_$version"
pwsh -Command " pwsh -Command "
\$env:PSModulePath = '${modulePath}:' + \$env:PSModulePath; \$env:PSModulePath = '${modulePath}:' + \$env:PSModulePath;
if ( -not (Get-Module -ListAvailable -Name Az.Accounts)) { if ( -not (Get-Module -ListAvailable -Name Az.Accounts)) {
Write-Host 'Az Module was not installed' Write-Host 'Az Module was not installed'
exit 1 exit 1
}" }"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Az version $version is not installed" echo "Az version $version is not installed"
exit 1 exit 1
fi fi
done done
# Document what was added to the image # Document what was added to the image
echo "Lastly, documenting what we added to the metadata file" echo "Lastly, documenting what we added to the metadata file"
for version in ${versions[@]}; do for version in ${versions[@]}; do
DocumentInstalledItem "Az Module ($version)" DocumentInstalledItem "Az Module ($version)"
done done

View File

@@ -1,95 +1,95 @@
#!/bin/bash #!/bin/bash
################################################################################ ################################################################################
## File: pypy.sh ## File: pypy.sh
## Desc: Installs PyPy ## Desc: Installs PyPy
################################################################################ ################################################################################
# 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
source $HELPER_SCRIPTS/install.sh source $HELPER_SCRIPTS/install.sh
# This function installs PyPy using the specified arguments: # This function installs PyPy using the specified arguments:
# $1=PACKAGE_URL # $1=PACKAGE_URL
function InstallPyPy function InstallPyPy
{ {
PACKAGE_URL=$1 PACKAGE_URL=$1
PACKAGE_TAR_NAME=$(echo $PACKAGE_URL | awk -F/ '{print $NF}') PACKAGE_TAR_NAME=$(echo $PACKAGE_URL | awk -F/ '{print $NF}')
echo "Downloading tar archive '$PACKAGE_TAR_NAME' - '$PACKAGE_URL'" echo "Downloading tar archive '$PACKAGE_TAR_NAME' - '$PACKAGE_URL'"
PACKAGE_TAR_TEMP_PATH="/tmp/$PACKAGE_TAR_NAME" PACKAGE_TAR_TEMP_PATH="/tmp/$PACKAGE_TAR_NAME"
download_with_retries $PACKAGE_URL "/tmp" $PACKAGE_TAR_NAME download_with_retries $PACKAGE_URL "/tmp" $PACKAGE_TAR_NAME
echo "Expand '$PACKAGE_TAR_NAME' to the /tmp folder" echo "Expand '$PACKAGE_TAR_NAME' to the /tmp folder"
tar xf $PACKAGE_TAR_TEMP_PATH -C /tmp tar xf $PACKAGE_TAR_TEMP_PATH -C /tmp
# Get Python version # Get Python version
PACKAGE_NAME=${PACKAGE_TAR_NAME/.tar.bz2/} PACKAGE_NAME=${PACKAGE_TAR_NAME/.tar.bz2/}
MAJOR_VERSION=$(echo ${PACKAGE_NAME/pypy/} | cut -d. -f1) MAJOR_VERSION=$(echo ${PACKAGE_NAME/pypy/} | cut -d. -f1)
PYTHON_MAJOR="python$MAJOR_VERSION" PYTHON_MAJOR="python$MAJOR_VERSION"
if [ $MAJOR_VERSION != 2 ]; then if [ $MAJOR_VERSION != 2 ]; then
PYPY_MAJOR="pypy$MAJOR_VERSION" PYPY_MAJOR="pypy$MAJOR_VERSION"
else else
PYPY_MAJOR="pypy" PYPY_MAJOR="pypy"
fi fi
PACKAGE_TEMP_FOLDER="/tmp/$PACKAGE_NAME" PACKAGE_TEMP_FOLDER="/tmp/$PACKAGE_NAME"
PYTHON_FULL_VERSION=$("$PACKAGE_TEMP_FOLDER/bin/$PYPY_MAJOR" -c "import sys;print('{}.{}.{}'.format(sys.version_info[0],sys.version_info[1],sys.version_info[2]))") PYTHON_FULL_VERSION=$("$PACKAGE_TEMP_FOLDER/bin/$PYPY_MAJOR" -c "import sys;print('{}.{}.{}'.format(sys.version_info[0],sys.version_info[1],sys.version_info[2]))")
# PyPy folder structure # PyPy folder structure
PYPY_TOOLCACHE_PATH=$AGENT_TOOLSDIRECTORY/PyPy PYPY_TOOLCACHE_PATH=$AGENT_TOOLSDIRECTORY/PyPy
PYPY_TOOLCACHE_VERSION_PATH=$PYPY_TOOLCACHE_PATH/$PYTHON_FULL_VERSION PYPY_TOOLCACHE_VERSION_PATH=$PYPY_TOOLCACHE_PATH/$PYTHON_FULL_VERSION
PYPY_TOOLCACHE_VERSION_ARCH_PATH=$PYPY_TOOLCACHE_VERSION_PATH/x64 PYPY_TOOLCACHE_VERSION_ARCH_PATH=$PYPY_TOOLCACHE_VERSION_PATH/x64
echo "Check if PyPy hostedtoolcache folder exist..." echo "Check if PyPy hostedtoolcache folder exist..."
if [ ! -d $PYPY_TOOLCACHE_PATH ]; then if [ ! -d $PYPY_TOOLCACHE_PATH ]; then
mkdir -p $PYPY_TOOLCACHE_PATH mkdir -p $PYPY_TOOLCACHE_PATH
fi fi
echo "Create PyPy '$PYPY_TOOLCACHE_VERSION_PATH' folder" echo "Create PyPy '$PYPY_TOOLCACHE_VERSION_PATH' folder"
mkdir $PYPY_TOOLCACHE_VERSION_PATH mkdir $PYPY_TOOLCACHE_VERSION_PATH
echo "Move PyPy '$PACKAGE_TEMP_FOLDER' binaries to '$PYPY_TOOLCACHE_VERSION_ARCH_PATH' folder" echo "Move PyPy '$PACKAGE_TEMP_FOLDER' binaries to '$PYPY_TOOLCACHE_VERSION_ARCH_PATH' folder"
mv $PACKAGE_TEMP_FOLDER $PYPY_TOOLCACHE_VERSION_ARCH_PATH mv $PACKAGE_TEMP_FOLDER $PYPY_TOOLCACHE_VERSION_ARCH_PATH
echo "Create additional symlinks (Required for UsePythonVersion Azure DevOps task)" echo "Create additional symlinks (Required for UsePythonVersion Azure DevOps task)"
cd $PYPY_TOOLCACHE_VERSION_ARCH_PATH/bin cd $PYPY_TOOLCACHE_VERSION_ARCH_PATH/bin
ln -s $PYPY_MAJOR $PYTHON_MAJOR ln -s $PYPY_MAJOR $PYTHON_MAJOR
ln -s $PYTHON_MAJOR python ln -s $PYTHON_MAJOR python
chmod +x ./python ./$PYTHON_MAJOR chmod +x ./python ./$PYTHON_MAJOR
echo "Install latest Pip" echo "Install latest Pip"
./python -m ensurepip ./python -m ensurepip
./python -m pip install --ignore-installed pip ./python -m pip install --ignore-installed pip
echo "Create complete file" echo "Create complete file"
touch $PYPY_TOOLCACHE_VERSION_PATH/x64.complete touch $PYPY_TOOLCACHE_VERSION_PATH/x64.complete
echo "Remove '$PACKAGE_TAR_TEMP_PATH'" echo "Remove '$PACKAGE_TAR_TEMP_PATH'"
rm -f $PACKAGE_TAR_TEMP_PATH rm -f $PACKAGE_TAR_TEMP_PATH
} }
# Installation PyPy # Installation PyPy
uri="https://downloads.python.org/pypy/" uri="https://downloads.python.org/pypy/"
download_with_retries $uri "/tmp" "pypyUrls.html" download_with_retries $uri "/tmp" "pypyUrls.html"
pypyVersions="$(cat /tmp/pypyUrls.html | grep 'linux64' | awk -v uri="$uri" -F'>|<' '{print uri$5}')" pypyVersions="$(cat /tmp/pypyUrls.html | grep 'linux64' | awk -v uri="$uri" -F'>|<' '{print uri$5}')"
toolsetJson="$INSTALLER_SCRIPT_FOLDER/toolset.json" toolsetJson="$INSTALLER_SCRIPT_FOLDER/toolset.json"
toolsetVersions=$(cat $toolsetJson | jq -r '.toolcache[] | select(.name | contains("PyPy")) | .versions[]') toolsetVersions=$(cat $toolsetJson | jq -r '.toolcache[] | select(.name | contains("PyPy")) | .versions[]')
# Fail out if any setups fail # Fail out if any setups fail
set -e set -e
for toolsetVersion in $toolsetVersions; do for toolsetVersion in $toolsetVersions; do
latestMajorPyPyVersion=$(echo "${pypyVersions}" | grep -E "pypy${toolsetVersion}-v[0-9]+\.[0-9]+\.[0-9]+-" | head -1) latestMajorPyPyVersion=$(echo "${pypyVersions}" | grep -E "pypy${toolsetVersion}-v[0-9]+\.[0-9]+\.[0-9]+-" | head -1)
if [[ -z "$latestMajorPyPyVersion" ]]; then if [[ -z "$latestMajorPyPyVersion" ]]; then
echo "Failed to get PyPy version '$toolsetVersion'" echo "Failed to get PyPy version '$toolsetVersion'"
exit 1 exit 1
fi fi
InstallPyPy $latestMajorPyPyVersion InstallPyPy $latestMajorPyPyVersion
done done
chown -R "$SUDO_USER:$SUDO_USER" "$AGENT_TOOLSDIRECTORY/PyPy" chown -R "$SUDO_USER:$SUDO_USER" "$AGENT_TOOLSDIRECTORY/PyPy"