Inital commit.

This commit is contained in:
Shady Ibraheem
2019-11-15 15:23:41 -05:00
parent a8289fbefa
commit f396818e23
208 changed files with 10770 additions and 95 deletions

View File

@@ -0,0 +1,145 @@
#!/bin/bash
################################################################################
## File: android.sh
## Desc: Installs Android SDK
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/apt.sh
# Set env variable for SDK Root (https://developer.android.com/studio/command-line/variables)
ANDROID_ROOT=/usr/local/lib/android
ANDROID_SDK_ROOT=${ANDROID_ROOT}/sdk
echo "ANDROID_SDK_ROOT=${ANDROID_SDK_ROOT}" | tee -a /etc/environment
# ANDROID_HOME is deprecated, but older versions of Gradle rely on it
echo "ANDROID_HOME=${ANDROID_SDK_ROOT}" | tee -a /etc/environment
# Download the latest command line tools so that we can accept all of the licenses.
# See https://developer.android.com/studio/#command-tools
wget -O android-sdk.zip https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
unzip android-sdk.zip -d ${ANDROID_ROOT}
rm -f android-sdk.zip
# Install the following SDKs and build tools, passing in "y" to accept licenses.
echo "y" | ${ANDROID_ROOT}/tools/bin/sdkmanager --sdk_root=${ANDROID_SDK_ROOT} \
"ndk-bundle" \
"platform-tools" \
"platforms;android-29" \
"platforms;android-28" \
"platforms;android-27" \
"platforms;android-26" \
"platforms;android-25" \
"platforms;android-24" \
"platforms;android-23" \
"platforms;android-22" \
"platforms;android-21" \
"platforms;android-19" \
"platforms;android-17" \
"platforms;android-15" \
"platforms;android-10" \
"build-tools;29.0.2" \
"build-tools;29.0.0" \
"build-tools;28.0.3" \
"build-tools;28.0.2" \
"build-tools;28.0.1" \
"build-tools;28.0.0" \
"build-tools;27.0.3" \
"build-tools;27.0.2" \
"build-tools;27.0.1" \
"build-tools;27.0.0" \
"build-tools;26.0.3" \
"build-tools;26.0.2" \
"build-tools;26.0.1" \
"build-tools;26.0.0" \
"build-tools;25.0.3" \
"build-tools;25.0.2" \
"build-tools;25.0.1" \
"build-tools;25.0.0" \
"build-tools;24.0.3" \
"build-tools;24.0.2" \
"build-tools;24.0.1" \
"build-tools;24.0.0" \
"build-tools;23.0.3" \
"build-tools;23.0.2" \
"build-tools;23.0.1" \
"build-tools;22.0.1" \
"build-tools;21.1.2" \
"build-tools;20.0.0" \
"build-tools;19.1.0" \
"build-tools;17.0.0" \
"extras;android;m2repository" \
"extras;google;m2repository" \
"extras;google;google_play_services" \
"extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.2" \
"extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.1" \
"extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2" \
"extras;m2repository;com;android;support;constraint;constraint-layout;1.0.1" \
"add-ons;addon-google_apis-google-24" \
"add-ons;addon-google_apis-google-23" \
"add-ons;addon-google_apis-google-22" \
"add-ons;addon-google_apis-google-21" \
"cmake;3.6.4111459" \
"patcher;v4"
# Document what was added to the image
echo "Lastly, document what was added to the metadata file"
DocumentInstalledItem "Google Repository $(cat ${ANDROID_SDK_ROOT}/extras/google/m2repository/source.properties 2>&1 | grep Pkg.Revision | cut -d '=' -f 2)"
DocumentInstalledItem "Google Play services $(cat ${ANDROID_SDK_ROOT}/extras/google/google_play_services/source.properties 2>&1 | grep Pkg.Revision | cut -d '=' -f 2)"
DocumentInstalledItem "Google APIs 24"
DocumentInstalledItem "Google APIs 23"
DocumentInstalledItem "Google APIs 22"
DocumentInstalledItem "Google APIs 21"
DocumentInstalledItem "CMake $(ls ${ANDROID_SDK_ROOT}/cmake 2>&1)"
DocumentInstalledItem "Android Support Repository 47.0.0"
DocumentInstalledItem "Android Solver for ConstraintLayout 1.0.2"
DocumentInstalledItem "Android Solver for ConstraintLayout 1.0.1"
DocumentInstalledItem "Android SDK Platform-Tools $(cat ${ANDROID_SDK_ROOT}/platform-tools/source.properties 2>&1 | grep Pkg.Revision | cut -d '=' -f 2)"
DocumentInstalledItem "Android SDK Platform 29"
DocumentInstalledItem "Android SDK Platform 28"
DocumentInstalledItem "Android SDK Platform 27"
DocumentInstalledItem "Android SDK Platform 26"
DocumentInstalledItem "Android SDK Platform 25"
DocumentInstalledItem "Android SDK Platform 24"
DocumentInstalledItem "Android SDK Platform 23"
DocumentInstalledItem "Android SDK Platform 22"
DocumentInstalledItem "Android SDK Platform 21"
DocumentInstalledItem "Android SDK Platform 19"
DocumentInstalledItem "Android SDK Platform 17"
DocumentInstalledItem "Android SDK Platform 15"
DocumentInstalledItem "Android SDK Platform 10"
DocumentInstalledItem "Android SDK Patch Applier v4"
DocumentInstalledItem "Android SDK Build-Tools 29.0.2"
DocumentInstalledItem "Android SDK Build-Tools 29.0.0"
DocumentInstalledItem "Android SDK Build-Tools 28.0.3"
DocumentInstalledItem "Android SDK Build-Tools 28.0.2"
DocumentInstalledItem "Android SDK Build-Tools 28.0.1"
DocumentInstalledItem "Android SDK Build-Tools 28.0.0"
DocumentInstalledItem "Android SDK Build-Tools 27.0.3"
DocumentInstalledItem "Android SDK Build-Tools 27.0.2"
DocumentInstalledItem "Android SDK Build-Tools 27.0.1"
DocumentInstalledItem "Android SDK Build-Tools 27.0.0"
DocumentInstalledItem "Android SDK Build-Tools 26.0.3"
DocumentInstalledItem "Android SDK Build-Tools 26.0.2"
DocumentInstalledItem "Android SDK Build-Tools 26.0.1"
DocumentInstalledItem "Android SDK Build-Tools 26.0.0"
DocumentInstalledItem "Android SDK Build-Tools 25.0.3"
DocumentInstalledItem "Android SDK Build-Tools 25.0.2"
DocumentInstalledItem "Android SDK Build-Tools 25.0.1"
DocumentInstalledItem "Android SDK Build-Tools 25.0.0"
DocumentInstalledItem "Android SDK Build-Tools 24.0.3"
DocumentInstalledItem "Android SDK Build-Tools 24.0.2"
DocumentInstalledItem "Android SDK Build-Tools 24.0.1"
DocumentInstalledItem "Android SDK Build-Tools 24.0.0"
DocumentInstalledItem "Android SDK Build-Tools 23.0.3"
DocumentInstalledItem "Android SDK Build-Tools 23.0.2"
DocumentInstalledItem "Android SDK Build-Tools 23.0.1"
DocumentInstalledItem "Android SDK Build-Tools 22.0.1"
DocumentInstalledItem "Android SDK Build-Tools 21.1.2"
DocumentInstalledItem "Android SDK Build-Tools 20.0.0"
DocumentInstalledItem "Android SDK Build-Tools 19.1.0"
DocumentInstalledItem "Android SDK Build-Tools 17.0.0"
DocumentInstalledItem "Android NDK $(cat ${ANDROID_SDK_ROOT}/ndk-bundle/source.properties 2>&1 | grep Pkg.Revision | cut -d ' ' -f 3)"
DocumentInstalledItem "Android ConstraintLayout 1.0.2"
DocumentInstalledItem "Android ConstraintLayout 1.0.1"

View File

@@ -0,0 +1,46 @@
#!/bin/bash
################################################################################
## File: azpowershell.sh
## Desc: Installed Azure PowerShell
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Install Azure CLI (instructions taken from https://docs.microsoft.com/en-us/cli/azure/install-azure-cli)
sudo pwsh -Command 'Save-Module -Name Az -LiteralPath /usr/share/az_1.0.0 -RequiredVersion 1.0.0 -Force'
sudo pwsh -Command 'Save-Module -Name Az -LiteralPath /usr/share/az_1.6.0 -RequiredVersion 1.6.0 -Force'
sudo pwsh -Command 'Save-Module -Name Az -LiteralPath /usr/share/az_2.3.2 -RequiredVersion 2.3.2 -Force'
sudo pwsh -Command 'Save-Module -Name Az -LiteralPath /usr/share/az_2.6.0 -RequiredVersion 2.6.0 -Force'
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
if ! pwsh -Command '$actualPSModulePath = $env:PSModulePath ; $env:PSModulePath = "/usr/share/az_1.0.0:" + $env:PSModulePath;
if (!(get-module -listavailable -name Az.accounts)) {
Write-Host "Az Module was not installed"; $env:PSModulePath = $actualPSModulePath; exit 1
}
$env:PSModulePath = $actualPSModulePath
$actualPSModulePath = $env:PSModulePath ; $env:PSModulePath = "/usr/share/az_1.6.0:" + $env:PSModulePath;
if (!(get-module -listavailable -name Az.accounts)) {
Write-Host "Az Module was not installed"; $env:PSModulePath = $actualPSModulePath; exit 1
}
$env:PSModulePath = $actualPSModulePath
$actualPSModulePath = $env:PSModulePath ; $env:PSModulePath = "/usr/share/az_2.3.2:" + $env:PSModulePath;
if (!(get-module -listavailable -name Az.accounts)) {
Write-Host "Az Module was not installed"; $env:PSModulePath = $actualPSModulePath; exit 1
}
$env:PSModulePath = $actualPSModulePath
$actualPSModulePath = $env:PSModulePath ; $env:PSModulePath = "/usr/share/az_2.6.0:" + $env:PSModulePath;
if (!(get-module -listavailable -name Az.accounts)) {
Write-Host "Az Module was not installed"; $env:PSModulePath = $actualPSModulePath; exit 1
}
$env:PSModulePath = $actualPSModulePath'; then
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Az Module (1.0.0)"
DocumentInstalledItem "Az Module (1.6.0)"
DocumentInstalledItem "Az Module (2.3.2)"
DocumentInstalledItem "Az Module (2.6.0)"

View File

@@ -0,0 +1,88 @@
#!/bin/bash
################################################################################
## File: basic.sh
## Desc: Installs basic command line utilities and dev packages
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/apt.sh
set -e
# Install basic command-line utilities
apt-fast install -y --no-install-recommends \
curl \
dnsutils \
file \
ftp \
iproute2 \
iputils-ping \
jq \
libcurl3 \
libicu55 \
libunwind8 \
locales \
netcat \
openssh-client \
rsync \
shellcheck \
sudo \
telnet \
time \
unzip \
wget \
zip \
tzdata
# Electron / VSCode / GitHub Desktop prereqs
apt-fast install -y --no-install-recommends \
libxkbfile-dev \
pkg-config \
libsecret-1-dev \
libxss1 \
libgconf-2-4 \
dbus \
xvfb \
libgtk-3-0 \
fakeroot \
dpkg \
rpm \
xz-utils \
xorriso \
zsync
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
for cmd in curl file ftp jq netcat ssh rsync shellcheck sudo telnet time unzip wget zip; do
if ! command -v $cmd; then
echo "$cmd was not installed"
exit 1
fi
done
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Basic CLI:"
DocumentInstalledItemIndent "curl"
DocumentInstalledItemIndent "dnsutils"
DocumentInstalledItemIndent "file"
DocumentInstalledItemIndent "ftp"
DocumentInstalledItemIndent "iproute2"
DocumentInstalledItemIndent "iputils-ping"
DocumentInstalledItemIndent "jq"
DocumentInstalledItemIndent "libcurl3"
DocumentInstalledItemIndent "libicu55"
DocumentInstalledItemIndent "libunwind8"
DocumentInstalledItemIndent "locales"
DocumentInstalledItemIndent "netcat"
DocumentInstalledItemIndent "openssh-client"
DocumentInstalledItemIndent "rsync"
DocumentInstalledItemIndent "shellcheck"
DocumentInstalledItemIndent "sudo"
DocumentInstalledItemIndent "telnet"
DocumentInstalledItemIndent "time"
DocumentInstalledItemIndent "unzip"
DocumentInstalledItemIndent "wget"
DocumentInstalledItemIndent "zip"
DocumentInstalledItemIndent "tzdata"

View File

@@ -0,0 +1,94 @@
#!/bin/bash
################################################################################
## File: dotnetcore-sdk.sh
## Desc: Installs .NET Core SDK
################################################################################
source $HELPER_SCRIPTS/apt.sh
source $HELPER_SCRIPTS/document.sh
LATEST_DOTNET_PACKAGE=dotnet-sdk-3.0
LSB_RELEASE=$(lsb_release -rs)
mksamples()
{
sdk=$1
sample=$2
mkdir "$sdk"
cd "$sdk" || exit
set -e
dotnet help
dotnet new globaljson --sdk-version "$sdk"
dotnet new "$sample"
dotnet restore
dotnet build
set +e
cd .. || exit
rm -rf "$sdk"
}
set -e
echo "Determing if .NET Core ($LATEST_DOTNET_PACKAGE) is installed"
if ! IsInstalled $LATEST_DOTNET_PACKAGE; then
echo "Could not find .NET Core ($LATEST_DOTNET_PACKAGE), installing..."
wget -q https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
dpkg -i packages-microsoft-prod.deb
apt-get update
apt-get install apt-transport-https
apt-get update
apt-get install $LATEST_DOTNET_PACKAGE
else
echo ".NET Core ($LATEST_DOTNET_PACKAGE) is already installed"
fi
# Get list of all released SDKs from channels which are not end-of-life or preview
release_urls=("https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/2.1/releases.json" "https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/2.2/releases.json" "https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/2.1/releases.json")
sdks=()
for release_url in ${release_urls[@]}; do
echo "${release_url}"
releases=$(curl "${release_url}")
sdks=("${sdks[@]}" $(echo "${releases}" | jq '.releases[]' | jq '.sdk.version'))
sdks=("${sdks[@]}" $(echo "${releases}" | jq '.releases[]' | jq '.sdks[]?' | jq '.version'))
done
sortedSdks=$(echo ${sdks[@]} | tr ' ' '\n' | grep -v preview | grep -v rc | grep -v display | cut -d\" -f2 | sort -u -r)
for sdk in $sortedSdks; do
url="https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$sdk/dotnet-sdk-$sdk-linux-x64.tar.gz"
echo "$url" >> urls
echo "Adding $url to list to download later"
done
# Download additional SDKs
echo "Downloading release tarballs..."
cat urls | xargs -n 1 -P 16 wget -q
for tarball in *.tar.gz; do
dest="./tmp-$(basename -s .tar.gz $tarball)"
echo "Extracting $tarball to $dest"
mkdir "$dest" && tar -C "$dest" -xzf "$tarball"
rsync -qav "$dest/shared/" /usr/share/dotnet/shared/
rsync -qav "$dest/host/" /usr/share/dotnet/host/
rsync -qav "$dest/sdk/" /usr/share/dotnet/sdk/
rm -rf "$dest"
rm "$tarball"
done
rm urls
DocumentInstalledItem ".NET Core SDK:"
# Smoke test each SDK
for sdk in $sortedSdks; do
mksamples "$sdk" "console"
mksamples "$sdk" "mstest"
mksamples "$sdk" "xunit"
mksamples "$sdk" "web"
mksamples "$sdk" "mvc"
mksamples "$sdk" "webapi"
DocumentInstalledItemIndent "$sdk"
done
# NuGetFallbackFolder at /usr/share/dotnet/sdk/NuGetFallbackFolder is warmed up by smoke test
# Additional FTE will just copy to ~/.dotnet/NuGet which provides no benefit on a fungible machine
echo "DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1" | tee -a /etc/environment
echo "PATH=\"\$HOME/.dotnet/tools:\$PATH\"" | tee -a /etc/skel/.profile

View File

@@ -0,0 +1,36 @@
#!/bin/bash
################################################################################
## File: go.sh
## Desc: Installs go, configures GOROOT, and adds go to the path
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# This function installs Go using the specified arguments:
# $1=MajorVersion (1.11)
# $2=MajorAndMinorVersion (1.11.1)
# $3=IsDefaultVersion (true or false)
function InstallGo () {
curl -sL https://dl.google.com/go/go$2.linux-amd64.tar.gz -o go$2.linux-amd64.tar.gz
mkdir -p /usr/local/go$1
tar -C /usr/local/go$1 -xzf go$2.linux-amd64.tar.gz --strip-components=1 go
rm go$2.linux-amd64.tar.gz
echo "GOROOT_${1//./_}_X64=/usr/local/go$1" | tee -a /etc/environment
DocumentInstalledItem "Go $1 ($(/usr/local/go$1/bin/go version))"
# If this version of Go is to be the default version,
# symlink it into the path and point GOROOT to it.
if [ $3 = true ]
then
ln -s /usr/local/go$1/bin/* /usr/bin/
echo "GOROOT=/usr/local/go$1" | tee -a /etc/environment
fi
}
# Install Go versions
InstallGo 1.9 1.9.7 false
InstallGo 1.10 1.10.8 false
InstallGo 1.11 1.11.12 false
InstallGo 1.12 1.12.7 true
InstallGo 1.13 1.13 false

View File

@@ -0,0 +1,40 @@
#!/bin/bash
################################################################################
## File: hosted-tool-cache.sh
## Desc: Downloads and installs hosted tools cache
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Fail out if any setups fail
set -e
# Download hosted tool cache
AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache
echo "AGENT_TOOLSDIRECTORY=$AGENT_TOOLSDIRECTORY" | tee -a /etc/environment
azcopy --recursive \
--source https://vstsagenttools.blob.core.windows.net/tools/hostedtoolcache/linux \
--destination $AGENT_TOOLSDIRECTORY
# Install tools from hosted tool cache
original_directory=$PWD
setups=$(find $AGENT_TOOLSDIRECTORY -name setup.sh)
for setup in $setups; do
chmod +x $setup;
cd $(dirname $setup);
./$(basename $setup);
cd $original_directory;
done;
DocumentInstalledItem "Python (available through the [setup-python](https://github.com/actions/setup-python/blob/master/README.md) task)"
pythons=$(ls $AGENT_TOOLSDIRECTORY/Python)
for python in $pythons; do
DocumentInstalledItemIndent "Python $python"
done;
DocumentInstalledItem "Ruby (available through the [setup-ruby](https://github.com/actions/setup-ruby/blob/master/README.md) task)"
rubys=$(ls $AGENT_TOOLSDIRECTORY/Ruby)
for ruby in $rubys; do
DocumentInstalledItemIndent "Ruby $ruby"
done;

View File

@@ -0,0 +1,40 @@
#!/bin/bash
################################################################################
## File: kubernetes-tools.sh
## Desc: Installs kubectl, helm
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/apt.sh
## Install kubectl
apt-get install -y apt-transport-https
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
touch /etc/apt/sources.list.d/kubernetes.list
echo "deb http://apt.kubernetes.io/ kubernetes-$(lsb_release -cs) main" | tee -a /etc/apt/sources.list.d/kubernetes.list
apt-get update
apt-get install -y kubectl
# Install Helm
curl -L https://git.io/get_helm.sh | bash
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
if ! command -v kubectl; then
echo "kubectl was not installed"
exit 1
fi
if ! command -v helm; then
echo "helm was not installed"
exit 1
fi
echo "Initializing helm"
helm init --client-only
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "kubectl ($(kubectl version --short |& head -n 1))"
DocumentInstalledItem "helm ($(helm version --short |& head -n 1))"

View File

@@ -0,0 +1,25 @@
#!/bin/bash
################################################################################
## File: mercurial.sh
## Desc: Installs Mercurial
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/apt.sh
# Install Mercurial from the mercurial-ppa/releases repository for the latest version.
# https://www.mercurial-scm.org/wiki/Download
add-apt-repository ppa:mercurial-ppa/releases -y
apt-get update
apt-get install -y --no-install-recommends mercurial
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
if ! command -v hg; then
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Mercurial ($(hg --version | head -n 1))"

View File

@@ -0,0 +1,268 @@
#!/bin/bash
################################################################################
## File: php.sh
## Desc: Installs php
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
LSB_RELEASE=$(lsb_release -rs)
set -e
apt-add-repository ppa:ondrej/php -y
# Install php5.6
apt-get update
apt-fast install -y --no-install-recommends \
php5.6 \
php5.6-amqp \
php5.6-bcmath \
php5.6-bz2 \
php5.6-cgi \
php5.6-cli \
php5.6-common \
php5.6-curl \
php5.6-dba \
php5.6-dev \
php5.6-enchant \
php5.6-fpm \
php5.6-gd \
php5.6-gmp \
php5.6-imap \
php5.6-interbase \
php5.6-intl \
php5.6-json \
php5.6-ldap \
php5.6-mbstring \
php5.6-mcrypt \
php5.6-mysql \
php5.6-odbc \
php5.6-opcache \
php5.6-pgsql \
php5.6-phpdbg \
php5.6-pspell \
php5.6-readline \
php5.6-recode \
php5.6-snmp \
php5.6-soap \
php5.6-sqlite3 \
php5.6-sybase \
php5.6-tidy \
php5.6-xml \
php5.6-xmlrpc \
php5.6-xsl \
php5.6-zip
apt-get remove --purge -yq php5.6-dev
# Install php7.0
apt-fast install -y --no-install-recommends \
php7.0 \
php7.0-amqp \
php7.0-bcmath \
php7.0-bz2 \
php7.0-cgi \
php7.0-cli \
php7.0-common \
php7.0-curl \
php7.0-dba \
php7.0-dev \
php7.0-enchant \
php7.0-fpm \
php7.0-gd \
php7.0-gmp \
php7.0-imap \
php7.0-interbase \
php7.0-intl \
php7.0-json \
php7.0-ldap \
php7.0-mbstring \
php7.0-mcrypt \
php7.0-mysql \
php7.0-odbc \
php7.0-opcache \
php7.0-pgsql \
php7.0-phpdbg \
php7.0-pspell \
php7.0-readline \
php7.0-recode \
php7.0-snmp \
php7.0-soap \
php7.0-sqlite3 \
php7.0-sybase \
php7.0-tidy \
php7.0-xml \
php7.0-xmlrpc \
php7.0-xsl \
php7.0-zip
apt-get remove --purge -yq php7.0-dev
# Install php7.1
apt-fast install -y --no-install-recommends \
php7.1 \
php7.1-amqp \
php7.1-bcmath \
php7.1-bz2 \
php7.1-cgi \
php7.1-cli \
php7.1-common \
php7.1-curl \
php7.1-dba \
php7.1-dev \
php7.1-enchant \
php7.1-fpm \
php7.1-gd \
php7.1-gmp \
php7.1-imap \
php7.1-interbase \
php7.1-intl \
php7.1-json \
php7.1-ldap \
php7.1-mbstring \
php7.1-mcrypt \
php7.1-mysql \
php7.1-odbc \
php7.1-opcache \
php7.1-pgsql \
php7.1-phpdbg \
php7.1-pspell \
php7.1-readline \
php7.1-recode \
php7.1-snmp \
php7.1-soap \
php7.1-sqlite3 \
php7.1-sybase \
php7.1-tidy \
php7.1-xml \
php7.1-xmlrpc \
php7.1-xsl \
php7.1-zip
apt-get remove --purge -yq php7.1-dev
# Install php7.2
apt-fast install -y --no-install-recommends \
php7.2 \
php7.2-apcu \
php7.2-amqp \
php7.2-bcmath \
php7.2-bz2 \
php7.2-cgi \
php7.2-cli \
php7.2-common \
php7.2-curl \
php7.2-dba \
php7.2-dev \
php7.2-enchant \
php7.2-fpm \
php7.2-gd \
php7.2-gmp \
php7.2-imap \
php7.2-interbase \
php7.2-intl \
php7.2-json \
php7.2-ldap \
php7.2-mbstring \
php7.2-mysql \
php7.2-odbc \
php7.2-opcache \
php7.2-pgsql \
php7.2-phpdbg \
php7.2-pspell \
php7.2-readline \
php7.2-recode \
php7.2-snmp \
php7.2-soap \
php7.2-sqlite3 \
php7.2-sybase \
php7.2-tidy \
php7.2-xml \
php7.2-xmlrpc \
php7.2-xsl \
php7.2-zip
# Install php7.3
apt-fast install -y --no-install-recommends \
php7.3 \
php7.3-apcu \
php7.3-amqp \
php7.3-bcmath \
php7.3-bz2 \
php7.3-cgi \
php7.3-cli \
php7.3-common \
php7.3-curl \
php7.3-dba \
php7.3-dev \
php7.3-enchant \
php7.3-fpm \
php7.3-gd \
php7.3-gmp \
php7.3-imap \
php7.3-interbase \
php7.3-intl \
php7.3-json \
php7.3-ldap \
php7.3-mbstring \
php7.3-mysql \
php7.3-odbc \
php7.3-opcache \
php7.3-pgsql \
php7.3-phpdbg \
php7.3-pspell \
php7.3-readline \
php7.3-recode \
php7.3-snmp \
php7.3-soap \
php7.3-sqlite3 \
php7.3-sybase \
php7.3-tidy \
php7.3-xml \
php7.3-xmlrpc \
php7.3-xsl \
php7.3-zip
apt-fast install -y --no-install-recommends \
php-igbinary \
php-memcache \
php-memcached \
php-mongodb \
php-redis \
php-xdebug \
php-yaml \
php-zmq
apt-get remove --purge -yq php7.2-dev
apt-fast install -y --no-install-recommends snmp
# Install composer
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'a5c698ffe4b8e849a443b120cd5ba38043260d5c4023dbf93e1558871f1f07f58274fc6f4c93bcfd858c6bd0775cd8d1') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
sudo mv composer.phar /usr/bin/composer
php -r "unlink('composer-setup.php');"
# Install phpunit (for PHP)
wget -q -O phpunit https://phar.phpunit.de/phpunit-7.phar
chmod +x phpunit
mv phpunit /usr/local/bin/phpunit
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
for cmd in php php5.6 php7.0 php7.1 php7.2 php7.3 composer phpunit; do
if ! command -v $cmd; then
echo "$cmd was not installed"
exit 1
fi
done
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "PHP 5.6 ($(php5.6 --version | head -n 1))"
DocumentInstalledItem "PHP 7.0 ($(php7.0 --version | head -n 1))"
DocumentInstalledItem "PHP 7.1 ($(php7.1 --version | head -n 1))"
DocumentInstalledItem "PHP 7.2 ($(php7.2 --version | head -n 1))"
DocumentInstalledItem "PHP 7.3 ($(php7.3 --version | head -n 1))"
DocumentInstalledItem "Composer ($(composer --version))"
DocumentInstalledItem "PHPUnit ($(phpunit --version))"

View File

@@ -0,0 +1,28 @@
#!/bin/bash
################################################################################
## File: powershellcore.sh
## Desc: Installs powershellcore
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
LSB_RELEASE=$(lsb_release -rs)
# Install Powershell
apt-get install -y powershell
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
if ! command -v pwsh; then
echo "pwsh was not installed"
exit 1
fi
if ! pwsh -c 'Write-Host Hello world'; then
echo "pwsh failed to run"
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Powershell ($(pwsh --version))"

View File

@@ -0,0 +1,12 @@
#!/bin/bash
################################################################################
## File: preparemetadata.sh
## Desc: This script adds a image title information to the metadata
## document
################################################################################
source $HELPER_SCRIPTS/document.sh
AddTitle "Hosted Ubuntu 1604 Image ($(lsb_release -ds))"
WriteItem "The following software is installed on machines in the Hosted Ubuntu 1604 ($IMAGE_VERSION) pool"
WriteItem "***"

View File

@@ -0,0 +1,133 @@
#!/bin/bash
################################################################################
## File: android.sh
## Desc: Installs Android SDK
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/apt.sh
# Set env variable for SDK Root (https://developer.android.com/studio/command-line/variables)
ANDROID_ROOT=/usr/local/lib/android
ANDROID_SDK_ROOT=${ANDROID_ROOT}/sdk
echo "ANDROID_SDK_ROOT=${ANDROID_SDK_ROOT}" | tee -a /etc/environment
# ANDROID_HOME is deprecated, but older versions of Gradle rely on it
echo "ANDROID_HOME=${ANDROID_SDK_ROOT}" | tee -a /etc/environment
# Download the latest command line tools so that we can accept all of the licenses.
# See https://developer.android.com/studio/#command-tools
wget -O android-sdk.zip https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
unzip android-sdk.zip -d ${ANDROID_ROOT}
rm -f android-sdk.zip
# Install the following SDKs and build tools, passing in "y" to accept licenses.
echo "y" | ${ANDROID_ROOT}/tools/bin/sdkmanager --sdk_root=${ANDROID_SDK_ROOT} \
"ndk-bundle" \
"platform-tools" \
"platforms;android-29" \
"platforms;android-28" \
"platforms;android-27" \
"platforms;android-26" \
"platforms;android-25" \
"platforms;android-24" \
"platforms;android-23" \
"platforms;android-22" \
"platforms;android-21" \
"platforms;android-19" \
"platforms;android-17" \
"build-tools;29.0.2" \
"build-tools;29.0.0" \
"build-tools;28.0.3" \
"build-tools;28.0.2" \
"build-tools;28.0.1" \
"build-tools;28.0.0" \
"build-tools;27.0.3" \
"build-tools;27.0.2" \
"build-tools;27.0.1" \
"build-tools;27.0.0" \
"build-tools;26.0.3" \
"build-tools;26.0.2" \
"build-tools;26.0.1" \
"build-tools;26.0.0" \
"build-tools;25.0.3" \
"build-tools;25.0.2" \
"build-tools;25.0.1" \
"build-tools;25.0.0" \
"build-tools;24.0.3" \
"build-tools;24.0.2" \
"build-tools;24.0.1" \
"build-tools;24.0.0" \
"build-tools;23.0.3" \
"build-tools;23.0.2" \
"build-tools;23.0.1" \
"build-tools;22.0.1" \
"build-tools;21.1.2" \
"build-tools;20.0.0" \
"build-tools;19.1.0" \
"build-tools;17.0.0" \
"extras;android;m2repository" \
"extras;google;m2repository" \
"extras;google;google_play_services" \
"add-ons;addon-google_apis-google-24" \
"add-ons;addon-google_apis-google-23" \
"add-ons;addon-google_apis-google-22" \
"add-ons;addon-google_apis-google-21" \
"cmake;3.6.4111459" \
"patcher;v4"
# Document what was added to the image
echo "Lastly, document what was added to the metadata file"
DocumentInstalledItem "Google Repository $(cat ${ANDROID_SDK_ROOT}/extras/google/m2repository/source.properties 2>&1 | grep Pkg.Revision | cut -d '=' -f 2)"
DocumentInstalledItem "Google Play services $(cat ${ANDROID_SDK_ROOT}/extras/google/google_play_services/source.properties 2>&1 | grep Pkg.Revision | cut -d '=' -f 2)"
DocumentInstalledItem "Google APIs 24"
DocumentInstalledItem "Google APIs 23"
DocumentInstalledItem "Google APIs 22"
DocumentInstalledItem "Google APIs 21"
DocumentInstalledItem "CMake $(ls ${ANDROID_SDK_ROOT}/cmake 2>&1)"
DocumentInstalledItem "Android Support Repository 47.0.0"
DocumentInstalledItem "Android SDK Platform-Tools $(cat ${ANDROID_SDK_ROOT}/platform-tools/source.properties 2>&1 | grep Pkg.Revision | cut -d '=' -f 2)"
DocumentInstalledItem "Android SDK Platform 29"
DocumentInstalledItem "Android SDK Platform 28"
DocumentInstalledItem "Android SDK Platform 27"
DocumentInstalledItem "Android SDK Platform 26"
DocumentInstalledItem "Android SDK Platform 25"
DocumentInstalledItem "Android SDK Platform 24"
DocumentInstalledItem "Android SDK Platform 23"
DocumentInstalledItem "Android SDK Platform 22"
DocumentInstalledItem "Android SDK Platform 21"
DocumentInstalledItem "Android SDK Platform 19"
DocumentInstalledItem "Android SDK Platform 17"
DocumentInstalledItem "Android SDK Patch Applier v4"
DocumentInstalledItem "Android SDK Build-Tools 29.0.2"
DocumentInstalledItem "Android SDK Build-Tools 29.0.0"
DocumentInstalledItem "Android SDK Build-Tools 28.0.3"
DocumentInstalledItem "Android SDK Build-Tools 28.0.2"
DocumentInstalledItem "Android SDK Build-Tools 28.0.1"
DocumentInstalledItem "Android SDK Build-Tools 28.0.0"
DocumentInstalledItem "Android SDK Build-Tools 27.0.3"
DocumentInstalledItem "Android SDK Build-Tools 27.0.2"
DocumentInstalledItem "Android SDK Build-Tools 27.0.1"
DocumentInstalledItem "Android SDK Build-Tools 27.0.0"
DocumentInstalledItem "Android SDK Build-Tools 26.0.3"
DocumentInstalledItem "Android SDK Build-Tools 26.0.2"
DocumentInstalledItem "Android SDK Build-Tools 26.0.1"
DocumentInstalledItem "Android SDK Build-Tools 26.0.0"
DocumentInstalledItem "Android SDK Build-Tools 25.0.3"
DocumentInstalledItem "Android SDK Build-Tools 25.0.2"
DocumentInstalledItem "Android SDK Build-Tools 25.0.1"
DocumentInstalledItem "Android SDK Build-Tools 25.0.0"
DocumentInstalledItem "Android SDK Build-Tools 24.0.3"
DocumentInstalledItem "Android SDK Build-Tools 24.0.2"
DocumentInstalledItem "Android SDK Build-Tools 24.0.1"
DocumentInstalledItem "Android SDK Build-Tools 24.0.0"
DocumentInstalledItem "Android SDK Build-Tools 23.0.3"
DocumentInstalledItem "Android SDK Build-Tools 23.0.2"
DocumentInstalledItem "Android SDK Build-Tools 23.0.1"
DocumentInstalledItem "Android SDK Build-Tools 22.0.1"
DocumentInstalledItem "Android SDK Build-Tools 21.1.2"
DocumentInstalledItem "Android SDK Build-Tools 20.0.0"
DocumentInstalledItem "Android SDK Build-Tools 19.1.0"
DocumentInstalledItem "Android SDK Build-Tools 17.0.0"
DocumentInstalledItem "Android NDK $(cat ${ANDROID_SDK_ROOT}/ndk-bundle/source.properties 2>&1 | grep Pkg.Revision | cut -d ' ' -f 3)"

View File

@@ -0,0 +1,46 @@
#!/bin/bash
################################################################################
## File: azpowershell.sh
## Desc: Installed Azure PowerShell
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Install Azure CLI (instructions taken from https://docs.microsoft.com/en-us/cli/azure/install-azure-cli)
sudo pwsh -Command 'Save-Module -Name Az -LiteralPath /usr/share/az_1.0.0 -RequiredVersion 1.0.0 -Force'
sudo pwsh -Command 'Save-Module -Name Az -LiteralPath /usr/share/az_1.6.0 -RequiredVersion 1.6.0 -Force'
sudo pwsh -Command 'Save-Module -Name Az -LiteralPath /usr/share/az_2.3.2 -RequiredVersion 2.3.2 -Force'
sudo pwsh -Command 'Save-Module -Name Az -LiteralPath /usr/share/az_2.6.0 -RequiredVersion 2.6.0 -Force'
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
if ! pwsh -Command '$actualPSModulePath = $env:PSModulePath ; $env:PSModulePath = "/usr/share/az_1.0.0:" + $env:PSModulePath;
if (!(get-module -listavailable -name Az.accounts)) {
Write-Host "Az Module was not installed"; $env:PSModulePath = $actualPSModulePath; exit 1
}
$env:PSModulePath = $actualPSModulePath
$actualPSModulePath = $env:PSModulePath ; $env:PSModulePath = "/usr/share/az_1.6.0:" + $env:PSModulePath;
if (!(get-module -listavailable -name Az.accounts)) {
Write-Host "Az Module was not installed"; $env:PSModulePath = $actualPSModulePath; exit 1
}
$env:PSModulePath = $actualPSModulePath
$actualPSModulePath = $env:PSModulePath ; $env:PSModulePath = "/usr/share/az_2.3.2:" + $env:PSModulePath;
if (!(get-module -listavailable -name Az.accounts)) {
Write-Host "Az Module was not installed"; $env:PSModulePath = $actualPSModulePath; exit 1
}
$env:PSModulePath = $actualPSModulePath
$actualPSModulePath = $env:PSModulePath ; $env:PSModulePath = "/usr/share/az_2.6.0:" + $env:PSModulePath;
if (!(get-module -listavailable -name Az.accounts)) {
Write-Host "Az Module was not installed"; $env:PSModulePath = $actualPSModulePath; exit 1
}
$env:PSModulePath = $actualPSModulePath'; then
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Az Module (1.0.0)"
DocumentInstalledItem "Az Module (1.6.0)"
DocumentInstalledItem "Az Module (2.3.2)"
DocumentInstalledItem "Az Module (2.6.0)"

View File

@@ -0,0 +1,154 @@
#!/bin/bash
################################################################################
## File: basic.sh
## Desc: Installs basic command line utilities and dev packages
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/apt.sh
set -e
echo "Install curl"
apt-get install -y --no-install-recommends curl
echo "Install dnsutils"
apt-get install -y --no-install-recommends dnsutils
echo "Install file"
apt-get install -y --no-install-recommends file
echo "Install ftp"
apt-get install -y --no-install-recommends ftp
echo "Install iproute2"
apt-get install -y --no-install-recommends iproute2
echo "Install iputils-ping"
apt-get install -y --no-install-recommends iputils-ping
echo "Install jq"
apt-get install -y --no-install-recommends jq
echo "Install libcurl3"
apt-get install -y --no-install-recommends libcurl3
echo "Install libunwind8"
apt-get install -y --no-install-recommends libunwind8
echo "Install locales"
apt-get install -y --no-install-recommends locales
echo "Install netcat"
apt-get install -y --no-install-recommends netcat
echo "Install openssh-client"
apt-get install -y --no-install-recommends openssh-client
echo "Install rsync"
apt-get install -y --no-install-recommends rsync
echo "Install shellcheck"
apt-get install -y --no-install-recommends shellcheck
echo "Install sudo"
apt-get install -y --no-install-recommends sudo
echo "Install telnet"
apt-get install -y --no-install-recommends telnet
echo "Install time"
apt-get install -y --no-install-recommends time
echo "Install unzip"
apt-get install -y --no-install-recommends unzip
echo "Install wget"
apt-get install -y --no-install-recommends wget
echo "Install zip"
apt-get install -y --no-install-recommends zip
echo "Install tzdata"
apt-get install -y --no-install-recommends tzdata
echo "Install libxkbfile"
apt-get install -y --no-install-recommends libxkbfile-dev
echo "Install pkg-config"
apt-get install -y --no-install-recommends pkg-config
echo "Install libsecret-1-dev"
apt-get install -y --no-install-recommends libsecret-1-dev
echo "Install libxss1"
apt-get install -y --no-install-recommends libxss1
echo "Install libgconf-2-4"
apt-get install -y --no-install-recommends libgconf-2-4
echo "Install dbus"
apt-get install -y --no-install-recommends dbus
echo "Install xvfb"
apt-get install -y --no-install-recommends xvfb
echo "Install libgtk"
apt-get install -y --no-install-recommends libgtk-3-0
echo "Install fakeroot"
apt-get install -y --no-install-recommends fakeroot
echo "Install dpkg"
apt-get install -y --no-install-recommends dpkg
echo "Install rpm"
apt-get install -y --no-install-recommends rpm
echo "Install xz-utils"
apt-get install -y --no-install-recommends xz-utils
echo "Install xorriso"
apt-get install -y --no-install-recommends xorriso
echo "Install zsync"
apt-get install -y --no-install-recommends zsync
echo "Install curl"
apt-get install -y --no-install-recommends curl
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
for cmd in curl file ftp jq netcat ssh rsync shellcheck sudo telnet time unzip wget zip; do
if ! command -v $cmd; then
echo "$cmd was not installed"
exit 1
fi
done
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Basic CLI:"
DocumentInstalledItemIndent "curl"
DocumentInstalledItemIndent "dnsutils"
DocumentInstalledItemIndent "file"
DocumentInstalledItemIndent "ftp"
DocumentInstalledItemIndent "iproute2"
DocumentInstalledItemIndent "iputils-ping"
DocumentInstalledItemIndent "jq"
DocumentInstalledItemIndent "libcurl3"
DocumentInstalledItemIndent "libicu55"
DocumentInstalledItemIndent "libunwind8"
DocumentInstalledItemIndent "locales"
DocumentInstalledItemIndent "netcat"
DocumentInstalledItemIndent "openssh-client"
DocumentInstalledItemIndent "rsync"
DocumentInstalledItemIndent "shellcheck"
DocumentInstalledItemIndent "sudo"
DocumentInstalledItemIndent "telnet"
DocumentInstalledItemIndent "time"
DocumentInstalledItemIndent "unzip"
DocumentInstalledItemIndent "wget"
DocumentInstalledItemIndent "zip"
DocumentInstalledItemIndent "tzdata"

View File

@@ -0,0 +1,95 @@
#!/bin/bash
################################################################################
## File: dotnetcore-sdk.sh
## Team: CI-Platform
## Desc: Installs .NET Core SDK
################################################################################
source $HELPER_SCRIPTS/apt.sh
source $HELPER_SCRIPTS/document.sh
LATEST_DOTNET_PACKAGE=dotnet-sdk-3.0
LSB_RELEASE=$(lsb_release -rs)
mksamples()
{
sdk=$1
sample=$2
mkdir "$sdk"
cd "$sdk" || exit
set -e
dotnet help
dotnet new globaljson --sdk-version "$sdk"
dotnet new "$sample"
dotnet restore
dotnet build
set +e
cd .. || exit
rm -rf "$sdk"
}
set -e
echo "Determing if .NET Core ($LATEST_DOTNET_PACKAGE) is installed"
if ! IsInstalled $LATEST_DOTNET_PACKAGE; then
echo "Could not find .NET Core ($LATEST_DOTNET_PACKAGE), installing..."
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-bionic-prod bionic main" > /etc/apt/sources.list.d/dotnetdev.list'
apt-get install apt-transport-https
apt-get update
apt-get install $LATEST_DOTNET_PACKAGE -y
else
echo ".NET Core ($LATEST_DOTNET_PACKAGE) is already installed"
fi
# Get list of all released SDKs from channels which are not end-of-life or preview
release_urls=("https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/2.1/releases.json" "https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/2.2/releases.json" "https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/3.0/releases.json")
sdks=()
for release_url in ${release_urls[@]}; do
echo "${release_url}"
releases=$(curl "${release_url}")
sdks=("${sdks[@]}" $(echo "${releases}" | jq '.releases[]' | jq '.sdk.version'))
sdks=("${sdks[@]}" $(echo "${releases}" | jq '.releases[]' | jq '.sdks[]?' | jq '.version'))
done
sortedSdks=$(echo ${sdks[@]} | tr ' ' '\n' | grep -v preview | grep -v rc | grep -v display | cut -d\" -f2 | sort -u -r)
for sdk in $sortedSdks; do
url="https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$sdk/dotnet-sdk-$sdk-linux-x64.tar.gz"
echo "$url" >> urls
echo "Adding $url to list to download later"
done
# Download additional SDKs
echo "Downloading release tarballs..."
cat urls | xargs -n 1 -P 16 wget -q
for tarball in *.tar.gz; do
dest="./tmp-$(basename -s .tar.gz $tarball)"
echo "Extracting $tarball to $dest"
mkdir "$dest" && tar -C "$dest" -xzf "$tarball"
rsync -qav "$dest/shared/" /usr/share/dotnet/shared/
rsync -qav "$dest/host/" /usr/share/dotnet/host/
rsync -qav "$dest/sdk/" /usr/share/dotnet/sdk/
rm -rf "$dest"
rm "$tarball"
done
rm urls
DocumentInstalledItem ".NET Core SDK:"
# Smoke test each SDK
for sdk in $sortedSdks; do
mksamples "$sdk" "console"
mksamples "$sdk" "mstest"
mksamples "$sdk" "xunit"
mksamples "$sdk" "web"
mksamples "$sdk" "mvc"
mksamples "$sdk" "webapi"
DocumentInstalledItemIndent "$sdk"
done
# NuGetFallbackFolder at /usr/share/dotnet/sdk/NuGetFallbackFolder is warmed up by smoke test
# Additional FTE will just copy to ~/.dotnet/NuGet which provides no benefit on a fungible machine
echo "DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1" | tee -a /etc/environment
echo "PATH=\"\$HOME/.dotnet/tools:\$PATH\"" | tee -a /etc/skel/.profile

View File

@@ -0,0 +1,34 @@
#!/bin/bash
################################################################################
## File: go.sh
## Desc: Installs go, configures GOROOT, and adds go to the path
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# This function installs Go using the specified arguments:
# $1=MajorVersion (1.11)
# $2=MajorAndMinorVersion (1.11.1)
# $3=IsDefaultVersion (true or false)
function InstallGo () {
curl -sL https://dl.google.com/go/go$2.linux-amd64.tar.gz -o go$2.linux-amd64.tar.gz
mkdir -p /usr/local/go$1
tar -C /usr/local/go$1 -xzf go$2.linux-amd64.tar.gz --strip-components=1 go
rm go$2.linux-amd64.tar.gz
echo "GOROOT_${1//./_}_X64=/usr/local/go$1" | tee -a /etc/environment
DocumentInstalledItem "Go $1 ($(/usr/local/go$1/bin/go version))"
# If this version of Go is to be the default version,
# symlink it into the path and point GOROOT to it.
if [ $3 = true ]
then
ln -s /usr/local/go$1/bin/* /usr/bin/
echo "GOROOT=/usr/local/go$1" | tee -a /etc/environment
fi
}
# Install Go versions
InstallGo 1.11 1.11.12 false
InstallGo 1.12 1.12.7 true
InstallGo 1.13 1.13 false

View File

@@ -0,0 +1,40 @@
#!/bin/bash
################################################################################
## File: hosted-tool-cache.sh
## Desc: Downloads and installs hosted tools cache
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Fail out if any setups fail
set -e
# Download hosted tool cache
AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache
echo "AGENT_TOOLSDIRECTORY=$AGENT_TOOLSDIRECTORY" | tee -a /etc/environment
azcopy --recursive \
--source https://vstsagenttools.blob.core.windows.net/tools/hostedtoolcache/ubuntu-1804 \
--destination $AGENT_TOOLSDIRECTORY
# Install tools from hosted tool cache
original_directory=$PWD
setups=$(find $AGENT_TOOLSDIRECTORY -name setup.sh)
for setup in $setups; do
chmod +x $setup;
cd $(dirname $setup);
./$(basename $setup);
cd $original_directory;
done;
DocumentInstalledItem "Python (available through the [setup-python](https://github.com/actions/setup-python/blob/master/README.md) task)"
pythons=$(ls $AGENT_TOOLSDIRECTORY/Python)
for python in $pythons; do
DocumentInstalledItemIndent "Python $python"
done;
DocumentInstalledItem "Ruby (available through the [setup-ruby](https://github.com/actions/setup-ruby/blob/master/README.md) task)"
rubys=$(ls $AGENT_TOOLSDIRECTORY/Ruby)
for ruby in $rubys; do
DocumentInstalledItemIndent "Ruby $ruby"
done;

View File

@@ -0,0 +1,42 @@
#!/bin/bash
################################################################################
## File: kubernetes-tools.sh
## Desc: Installs kubectl, helm
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/apt.sh
## Install kubectl
apt-get install -y apt-transport-https
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
touch /etc/apt/sources.list.d/kubernetes.list
# Based on https://kubernetes.io/docs/tasks/tools/install-kubectl/, package is still called xenial
echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | tee -a /etc/apt/sources.list.d/kubernetes.list
apt-get update
apt-get install -y kubectl
# Install Helm
curl -L https://git.io/get_helm.sh | bash
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
if ! command -v kubectl; then
echo "kubectl was not installed"
exit 1
fi
if ! command -v helm; then
echo "helm was not installed"
exit 1
fi
echo "Initializing helm"
helm init --client-only
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "kubectl ($(kubectl version --short |& head -n 1))"
DocumentInstalledItem "helm ($(helm version --short |& head -n 1))"

View File

@@ -0,0 +1,21 @@
#!/bin/bash
################################################################################
## File: mercurial.sh
## Desc: Installs Mercurial
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/apt.sh
apt-get install -y --no-install-recommends mercurial
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
if ! command -v hg; then
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Mercurial ($(hg --version | head -n 1))"

View File

@@ -0,0 +1,181 @@
#!/bin/bash
################################################################################
## File: php.sh
## Desc: Installs php
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
LSB_RELEASE=$(lsb_release -rs)
set -e
apt-add-repository ppa:ondrej/php -y
# Install php7.1
apt-fast install -y --no-install-recommends \
php7.1 \
php7.1-amqp \
php7.1-bcmath \
php7.1-bz2 \
php7.1-cgi \
php7.1-cli \
php7.1-common \
php7.1-curl \
php7.1-dba \
php7.1-dev \
php7.1-enchant \
php7.1-fpm \
php7.1-gd \
php7.1-gmp \
php7.1-imap \
php7.1-interbase \
php7.1-intl \
php7.1-json \
php7.1-ldap \
php7.1-mbstring \
php7.1-mcrypt \
php7.1-mysql \
php7.1-odbc \
php7.1-opcache \
php7.1-pgsql \
php7.1-phpdbg \
php7.1-pspell \
php7.1-readline \
php7.1-recode \
php7.1-snmp \
php7.1-soap \
php7.1-sqlite3 \
php7.1-sybase \
php7.1-tidy \
php7.1-xml \
php7.1-xmlrpc \
php7.1-xsl \
php7.1-zip
apt-get remove --purge -yq php7.1-dev
# Install php7.2
apt-fast install -y --no-install-recommends \
php7.2 \
php7.2-apcu \
php7.2-amqp \
php7.2-bcmath \
php7.2-bz2 \
php7.2-cgi \
php7.2-cli \
php7.2-common \
php7.2-curl \
php7.2-dba \
php7.2-dev \
php7.2-enchant \
php7.2-fpm \
php7.2-gd \
php7.2-gmp \
php7.2-imap \
php7.2-interbase \
php7.2-intl \
php7.2-json \
php7.2-ldap \
php7.2-mbstring \
php7.2-mysql \
php7.2-odbc \
php7.2-opcache \
php7.2-pgsql \
php7.2-phpdbg \
php7.2-pspell \
php7.2-readline \
php7.2-recode \
php7.2-snmp \
php7.2-soap \
php7.2-sqlite3 \
php7.2-sybase \
php7.2-tidy \
php7.2-xml \
php7.2-xmlrpc \
php7.2-xsl \
php7.2-zip
# Install php7.3
apt-fast install -y --no-install-recommends \
php7.3 \
php7.3-apcu \
php7.3-amqp \
php7.3-bcmath \
php7.3-bz2 \
php7.3-cgi \
php7.3-cli \
php7.3-common \
php7.3-curl \
php7.3-dba \
php7.3-dev \
php7.3-enchant \
php7.3-fpm \
php7.3-gd \
php7.3-gmp \
php7.3-imap \
php7.3-interbase \
php7.3-intl \
php7.3-json \
php7.3-ldap \
php7.3-mbstring \
php7.3-mysql \
php7.3-odbc \
php7.3-opcache \
php7.3-pgsql \
php7.3-phpdbg \
php7.3-pspell \
php7.3-readline \
php7.3-recode \
php7.3-snmp \
php7.3-soap \
php7.3-sqlite3 \
php7.3-sybase \
php7.3-tidy \
php7.3-xml \
php7.3-xmlrpc \
php7.3-xsl \
php7.3-zip
apt-fast install -y --no-install-recommends \
php-igbinary \
php-memcache \
php-memcached \
php-mongodb \
php-redis \
php-xdebug \
php-yaml \
php-zmq
apt-get remove --purge -yq php7.2-dev
apt-fast install -y --no-install-recommends snmp
# Install composer
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'a5c698ffe4b8e849a443b120cd5ba38043260d5c4023dbf93e1558871f1f07f58274fc6f4c93bcfd858c6bd0775cd8d1') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
sudo mv composer.phar /usr/bin/composer
php -r "unlink('composer-setup.php');"
# Install phpunit (for PHP)
wget -q -O phpunit https://phar.phpunit.de/phpunit-7.phar
chmod +x phpunit
mv phpunit /usr/local/bin/phpunit
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
for cmd in php php7.1 php7.2 php7.3 composer phpunit; do
if ! command -v $cmd; then
echo "$cmd was not installed"
exit 1
fi
done
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "PHP 7.1 ($(php7.1 --version | head -n 1))"
DocumentInstalledItem "PHP 7.2 ($(php7.2 --version | head -n 1))"
DocumentInstalledItem "PHP 7.3 ($(php7.3 --version | head -n 1))"
DocumentInstalledItem "Composer ($(composer --version))"
DocumentInstalledItem "PHPUnit ($(phpunit --version))"

View File

@@ -0,0 +1,31 @@
#!/bin/bash
################################################################################
## File: powershellcore.sh
## Desc: Installs powershellcore
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
LSB_RELEASE=$(lsb_release -rs)
# Install Powershell
apt-get install -y powershell
# Temp fix based on: https://github.com/PowerShell/PowerShell/issues/9746
sudo apt remove libicu64
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
if ! command -v pwsh; then
echo "pwsh was not installed"
exit 1
fi
if ! pwsh -c 'Write-Host Hello world'; then
echo "pwsh failed to run"
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Powershell ($(pwsh --version))"

View File

@@ -0,0 +1,12 @@
#!/bin/bash
################################################################################
## File: preparemetadata.sh
## Desc: This script adds a image title information to the metadata
## document
################################################################################
source $HELPER_SCRIPTS/document.sh
AddTitle "Hosted Ubuntu 1804 Image ($(lsb_release -ds))"
WriteItem "The following software is installed on machines in the Hosted Ubuntu 1804 (v$IMAGE_VERSION) pool"
WriteItem "***"

View File

@@ -0,0 +1,23 @@
#!/bin/bash
################################################################################
## File: 7-zip.sh
## Desc: Installs 7-zip
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Install 7-Zip
apt-get update -y
apt-get install -y p7zip p7zip-full p7zip-rar
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
if ! command -v 7z; then
echo "7-Zip was not installed"
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "7-Zip $(7z i | head --lines=2 | cut -d ' ' -f 3 | tr -d '\n')"

View File

@@ -0,0 +1,25 @@
#!/bin/bash
################################################################################
## File: ansible.sh
## Desc: Installs Ansible
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/apt.sh
# Install Ansible PPA and latest Ansible
add-apt-repository ppa:ansible/ansible
apt-get update
apt-get install -y --no-install-recommends ansible
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
if ! command -v ansible; then
echo "Ansible was not installed or found on PATH"
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Ansible ($(ansible --version |& head -n 1))"

View File

@@ -0,0 +1,26 @@
#!/bin/bash
################################################################################
## File: aws.sh
## Desc: Installs the AWS CLI
################################################################################
# Source the helpers
source $HELPER_SCRIPTS/document.sh
# Install the AWS CLI
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
unzip awscli-bundle.zip
./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
rm awscli-bundle.zip
rm -rf awscli-bundle
# Validate the installation
echo "Validate the installation"
if ! command -v aws; then
echo "aws was not installed"
exit 1
fi
# Document the installed version
echo "Document the installed version"
DocumentInstalledItem "AWS CLI ($(aws --version 2>&1))"

View File

@@ -0,0 +1,25 @@
#!/bin/bash
################################################################################
## File: azcopy.sh
## Desc: Installs AzCopy
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Install AzCopy
wget -O azcopy.tar.gz https://aka.ms/downloadazcopylinux64
tar -xf azcopy.tar.gz
rm azcopy.tar.gz
./install.sh
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
if ! command -v azcopy; then
echo "azcopy was not installed"
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "AzCopy ($(azcopy --version))"

View File

@@ -0,0 +1,26 @@
#!/bin/bash
################################################################################
## File: azure-cli.sh
## Desc: Installed Azure CLI (az)
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
LSB_CODENAME=$(lsb_release -cs)
# Install Azure CLI (instructions taken from https://docs.microsoft.com/en-us/cli/azure/install-azure-cli)
echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $LSB_CODENAME main" | tee /etc/apt/sources.list.d/azure-cli.list
apt-key adv --keyserver packages.microsoft.com --recv-keys B02C46DF417A0893
apt-get update
apt-get install -y --no-install-recommends apt-transport-https azure-cli
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
if ! command -v az; then
echo "azure-cli was not installed"
exit 1
fi
# Document what was added to the image
DocumentInstalledItem "Azure CLI ($(az -v | head -n 1))"

View File

@@ -0,0 +1,23 @@
#!/bin/bash
################################################################################
## File: azure-devops-cli.sh
## Desc: Installed Azure DevOps CLI (az devops)
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# install azure devops Cli extension
az extension add -n azure-devops
# check to determine if extension was installed or not
if [ $? -eq 0 ]
then
echo "azure DevOps Cli extension was installed"
else
echo "azure DevOps Cli extension was not installed"
exit 1
fi
# Document what was added to the image
DocumentInstalledItem "Azure CLI ($(az -v | grep azure-devops))"

View File

@@ -0,0 +1,31 @@
#!/bin/bash
################################################################################
## File: boost.sh
## Desc: Installs Boost C++ Libraries
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
BOOST_ZIP_PATH=/opt/hostedtoolcache/Boost
BOOST_LIB=/usr/local/share/boost
# Install Boost
for BOOST_VERSION in ${BOOST_VERSIONS//,/ }
do
BOOST_SYMLINK_VER=`echo "${BOOST_VERSION//[.]/_}"`
BOOST_ROOT="BOOST_ROOT_$BOOST_SYMLINK_VER"
BOOST_ZIP="boost_`echo $BOOST_VERSION`_gcc.zip"
unzip $BOOST_ZIP_PATH/$BOOST_ZIP -d $BOOST_LIB
echo "$BOOST_ROOT=$BOOST_LIB/$BOOST_VERSION" | tee -a /etc/environment
if [[ $BOOST_VERSION == $BOOST_DEFAULT ]]; then
echo "BOOST_ROOT=$BOOST_LIB/$BOOST_VERSION" | tee -a /etc/environment
fi
DocumentInstalledItem "Boost C++ Libraries $BOOST_VERSION"
done
# Deleting archives with Boost Libraries
rm -rf $BOOST_ZIP_PATH

View File

@@ -0,0 +1,24 @@
#!/bin/bash
################################################################################
## File: build-essential.sh
## Desc: Installs build-essential package
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/apt.sh
PACKAGE=build-essential
# Test to see if the software in question is already installed, if not install it
echo "Checking to see if the installer script has already been run"
if ! IsInstalled $PACKAGE; then
echo "Installing $PACKAGE"
apt-get install -y --no-install-recommends $PACKAGE
else
echo "$PACKAGE is already installed"
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "$PACKAGE"

View File

@@ -0,0 +1,31 @@
#!/bin/bash
################################################################################
## File: example.sh
## Desc: This is an example script that can be copied to add a new software
## installer to the image
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/apt.sh
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
apt-add-repository "deb http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-6.0 main"
apt-get update
apt-get install -y clang-6.0 lldb-6.0 lld-6.0
update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-6.0 100
update-alternatives --install /usr/bin/clang clang /usr/bin/clang-6.0 100
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
for cmd in clang clang++ clang-6.0 clang++-6.0; do
if ! command -v $cmd; then
echo "$cmd was not installed"
exit 1
fi
done
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Clang 6.0 ($(clang-6.0 --version | head -n 1))"

View File

@@ -0,0 +1,30 @@
#!/bin/bash
################################################################################
## File: cmake.sh
## Desc: Installs CMake
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Test to see if the software in question is already installed, if not install it
echo "Checking to see if the installer script has already been run"
if command -v cmake; then
echo "Example variable already set to $EXAMPLE_VAR"
else
curl -sL https://cmake.org/files/v3.12/cmake-3.12.4-Linux-x86_64.sh -o cmakeinstall.sh \
&& chmod +x cmakeinstall.sh \
&& ./cmakeinstall.sh --prefix=/usr/local --exclude-subdir \
&& rm cmakeinstall.sh
fi
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
if ! command -v cmake; then
echo "cmake was not installed"
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "CMake ($(cmake --version | head -n 1))"

View File

@@ -0,0 +1,26 @@
#!/bin/bash
################################################################################
## File: docker-compose.sh
## Desc: Installs Docker Compose
################################################################################
source $HELPER_SCRIPTS/apt.sh
source $HELPER_SCRIPTS/document.sh
version="1.22.0"
# Install latest docker-compose from releases
curl -L "https://github.com/docker/compose/releases/download/$version/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
if ! command -v docker-compose; then
echo "docker-compose was not installed"
exit 1
fi
## Add version information to the metadata file
echo "Documenting Docker Compose version"
docker_compose_version=$(docker-compose -v)
DocumentInstalledItem "Docker Compose (${docker_compose_version})"

View File

@@ -0,0 +1,43 @@
#!/bin/bash
################################################################################
## File: docker-ce.sh
## Desc: Installs docker onto the image, but does not pre-pull any images
################################################################################
source $HELPER_SCRIPTS/apt.sh
source $HELPER_SCRIPTS/document.sh
docker_package=moby
## Check to see if docker is already installed
echo "Determing if Docker ($docker_package) is installed"
if ! IsInstalled $docker_package; then
echo "Docker ($docker_package) was not found. Installing..."
apt-get remove -y moby-engine moby-cli
apt-get update
apt-get install -y apt-transport-https ca-certificates curl software-properties-common
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/microsoft-prod.list
apt-get update
apt-get install -y moby-engine moby-cli
else
echo "Docker ($docker_package) is already installed"
fi
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
if ! command -v docker; then
echo "docker was not installed"
exit 1
else
# Docker daemon takes time to come up after installing
sleep 10
set -e
docker info
set +e
fi
## Add version information to the metadata file
echo "Documenting Docker version"
docker_version=$(docker -v)
DocumentInstalledItem "Docker ($docker_version)"

View File

@@ -0,0 +1,34 @@
#!/bin/bash
################################################################################
## File: docker.sh
## Desc: Installs the correct version of docker onto the image, and pulls
## down the default docker image used for building on ubuntu
################################################################################
source $HELPER_SCRIPTS/apt.sh
source $HELPER_SCRIPTS/document.sh
DOCKER_PACKAGE=moby
apt-get remove -y moby-engine mobi-cli
apt-get update
apt-get install -y apt-transport-https ca-certificates curl software-properties-common
apt-get update
apt-get install -y moby-engine mobi-cli
docker pull node:10
docker pull node:12
docker pull buildpack-deps:stretch
docker pull node:10-alpine
docker pull node:12-alpine
docker pull debian:8
docker pull debian:9
docker pull alpine:3.7
docker pull alpine:3.8
docker pull alpine:3.9
docker pull alpine:3.10
## Add version information to the metadata file
echo "Documenting Docker version"
DOCKER_VERSION=`docker -v`
DocumentInstalledItem "Docker ($DOCKER_VERSION)"

View File

@@ -0,0 +1,39 @@
#!/bin/bash
################################################################################
## File: erlang.sh
## Desc: Installs erlang
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/apt.sh
source_list=/etc/apt/sources.list.d/eslerlang.list
# Install Erlang
echo "deb http://binaries.erlang-solutions.com/debian $(lsb_release -cs) contrib" > $source_list
wget -O - http://binaries.erlang-solutions.com/debian/erlang_solutions.asc | apt-key add -
apt-get update
apt-get install -y --no-install-recommends esl-erlang
# Install rebar3
wget -q -O rebar3 https://s3.amazonaws.com/rebar3/rebar3
chmod +x rebar3
mv rebar3 /usr/local/bin/rebar3
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
for cmd in erl erlc rebar3; do
if ! command -v $cmd; then
echo "$cmd was not installed or not found on PATH"
exit 1
fi
done
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
erlang_version="$(erl -version 2>&1 | tr -d '\n' | tr -d '\r')"
DocumentInstalledItem "Erlang ($erlang_version)"
# Clean up source list
rm $source_list

View File

@@ -0,0 +1,31 @@
#!/bin/bash
################################################################################
## File: example.sh
## Desc: This is an example script that can be copied to add a new software
## installer to the image
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/apt.sh
# Test to see if the software in question is already installed, if not install it
echo "Checking to see if the installer script has already been run"
if [ -z $EXAMPLE_VAR ]; then
$EXAMPLE_VAR=1.0.0
else
echo "Example variable already set to $EXAMPLE_VAR"
fi
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
if [ -z $EXAMPLE_VAR ]; then
echo "EXAMPLE_VAR variable was not set as expected"
exit 1
else
echo "EXAMPLE_VAR was set properly"
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Example Var ($EXAMPLE_VAR)"

View File

@@ -0,0 +1,25 @@
#!/bin/bash
################################################################################
## File: firefox.sh
## Desc: Installs Firefox
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/apt.sh
# Install Firefox
apt-get install -y firefox
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
if ! command -v firefox; then
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
# Resolves: Running Firefox as root in a regular user's session is not supported.
# ($HOME is /home/packer which is owned by packer.)
HOME=/root
DocumentInstalledItem "Firefox ($(firefox --version))"

View File

@@ -0,0 +1,25 @@
#!/bin/bash
################################################################################
## File: gcc.sh
## Desc: Installs GNU C++
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Install GNU C++ compiler
add-apt-repository ppa:ubuntu-toolchain-r/test -y
apt-get update -y
apt-get install g++-7 -y
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
if ! command -v g++-7; then
echo "GNU C++ was not installed"
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "GNU C++ $(g++-7 --version | head -n 1 | cut -d ' ' -f 4)"

View File

@@ -0,0 +1,37 @@
#!/bin/bash
################################################################################
## File: git.sh
## Desc: Installs Git
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
## Install git
add-apt-repository ppa:git-core/ppa -y
apt-get update
apt-get install git -y
git --version
# Install git-lfs
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
apt-get install -y --no-install-recommends git-lfs
# Run tests to determine that the software installed as expected
echo "Testing git installation"
if ! command -v git; then
echo "git was not installed"
exit 1
fi
echo "Testing git-lfs installation"
if ! command -v git-lfs; then
echo "git-lfs was not installed"
exit 1
fi
# Document what was added to the image
echo "Lastly, document the installed versions"
# git version 2.20.1
DocumentInstalledItem "Git ($(git --version 2>&1 | cut -d ' ' -f 3))"
# git-lfs/2.6.1 (GitHub; linux amd64; go 1.11.1)
DocumentInstalledItem "Git Large File Storage (LFS) ($(git-lfs --version 2>&1 | cut -d ' ' -f 1 | cut -d '/' -f 2))"

View File

@@ -0,0 +1,27 @@
#!/bin/bash
################################################################################
## File: google-chrome.sh
## Desc: Installs google-chrome
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
LSB_RELEASE=$(lsb_release -rs)
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee /etc/apt/sources.list.d/google-chrome.list
apt-get update
apt-get install -y google-chrome-stable
echo "CHROME_BIN=/usr/bin/google-chrome" | tee -a /etc/environment
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
if ! command -v google-chrome; then
echo "google-chrome was not installed"
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Google Chrome ($(google-chrome --version))"

View File

@@ -0,0 +1,25 @@
#!/bin/bash
################################################################################
## File: google-cloud-sdk.sh
## Desc: Installs the Google Cloud SDK
################################################################################
# Source the helpers
source $HELPER_SCRIPTS/document.sh
# Install the Google Cloud SDK
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
sudo apt-get update -y
sudo apt-get install -y google-cloud-sdk
# Validate the installation
echo "Validate the installation"
if ! command -v gcloud; then
echo "gcloud was not installed"
exit 1
fi
# Document the installed version
echo "Document the installed version"
DocumentInstalledItem "Google Cloud SDK ($(gcloud --version | head -n 1 | cut -d ' ' -f 4))"

View File

@@ -0,0 +1,64 @@
#!/bin/bash
################################################################################
## File: haskell.sh
## Desc: Installs Haskell
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/apt.sh
# Install Herbert V. Riedel's PPA for managing multiple version of ghc on ubuntu.
# https://launchpad.net/~hvr/+archive/ubuntu/ghc
apt-get install -y software-properties-common
add-apt-repository -y ppa:hvr/ghc
apt-get update
# Install various versions of ghc and cabal
apt-get install -y \
ghc-8.0.2 \
ghc-8.2.2 \
ghc-8.4.4 \
ghc-8.6.2 \
ghc-8.6.3 \
ghc-8.6.4 \
ghc-8.6.5 \
ghc-8.8.1 \
cabal-install-2.0 \
cabal-install-2.2 \
cabal-install-2.4 \
cabal-install-3.0
# Install haskell stack, pinned to v2.1.3
curl -sSL https://raw.githubusercontent.com/commercialhaskell/stack/v2.1.3/etc/scripts/get-stack.sh | sh
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
# Check all ghc versions
for version in 8.0.2 8.2.2 8.4.4 8.6.2 8.6.3 8.6.4 8.6.5 8.8.1; do
if ! command -v /opt/ghc/$version/bin/ghc; then
echo "ghc $version was not installed"
exit 1
fi
done
# Check all cabal versions
for version in 2.0 2.2 2.4 3.0; do
if ! command -v /opt/cabal/$version/bin/cabal; then
echo "cabal $version was not installed"
exit 1
fi
done
# Check stack
if ! command -v stack; then
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
for version in 2.0 2.2 2.4 3.0; do
DocumentInstalledItem "Haskell Cabal ($(/opt/cabal/$version/bin/cabal --version))"
done
for version in 8.0.2 8.2.2 8.4.4 8.6.2 8.6.3 8.6.4 8.6.5 8.8.1; do
DocumentInstalledItem "GHC ($(/opt/ghc/$version/bin/ghc --version))"
done
DocumentInstalledItem "Haskell Stack ($(stack --version))"

View File

@@ -0,0 +1,22 @@
#!/bin/bash
################################################################################
## File: heroku.sh
## Desc: Installs Heroku CLI
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/apt.sh
# Install Heroku CLI
curl https://cli-assets.heroku.com/install-ubuntu.sh | sh
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
if ! command -v heroku; then
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Heroku ($(heroku version))"

View File

@@ -0,0 +1,37 @@
#!/bin/bash
################################################################################
## File: hhvm.sh
## Desc: Installs hhvm
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/apt.sh
hhvm_package=hhvm
# Test to see if the software in question is already installed, if not install it
echo "Checking to see if the installer script has already been run"
if ! IsInstalled ${hhvm_package}; then
apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xB4112585D386EB94
add-apt-repository https://dl.hhvm.com/ubuntu
apt-get update
apt-get -qq install -y hhvm
else
echo "${hhvm_package} already installed"
fi
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
if ! IsInstalled ${hhvm_package}; then
echo "${hhvm_package} was not installed"
exit 1
fi
if ! command -v hhvm; then
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "HHVM ($(hhvm --version | head -n 1))"

View File

@@ -0,0 +1,20 @@
#!/bin/bash
################################################################################
## File: image-magick.sh
## Desc: Installs ImageMagick
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/apt.sh
# Install ImageMagick
apt-get install -y --no-install-recommends --fix-missing \
imagemagick \
libmagickcore-dev \
libmagickwand-dev \
libmagic-dev
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "ImageMagick"

View File

@@ -0,0 +1,78 @@
#!/bin/bash
################################################################################
## File: java-tools.sh
## Team: CI-Platform
## Desc: Installs Java and related tooling (Ant, Gradle, Maven)
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
DEFAULT_JDK_VERSION=8
set -e
# Install the Azul Systems Zulu JDKs
# See https://www.azul.com/downloads/azure-only/zulu/
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0xB1998361219BD9C9
apt-add-repository "deb http://repos.azul.com/azure-only/zulu/apt stable main"
apt-get -q update
apt-get -y install zulu-7-azure-jdk=\*
apt-get -y install zulu-8-azure-jdk=\*
apt-get -y install zulu-11-azure-jdk=\*
apt-get -y install zulu-12-azure-jdk=\*
update-java-alternatives -s /usr/lib/jvm/zulu-8-azure-amd64
echo "JAVA_HOME_7_X64=/usr/lib/jvm/zulu-7-azure-amd64" | tee -a /etc/environment
echo "JAVA_HOME_8_X64=/usr/lib/jvm/zulu-8-azure-amd64" | tee -a /etc/environment
echo "JAVA_HOME_11_X64=/usr/lib/jvm/zulu-11-azure-amd64" | tee -a /etc/environment
echo "JAVA_HOME_12_X64=/usr/lib/jvm/zulu-12-azure-amd64" | tee -a /etc/environment
echo "JAVA_HOME=/usr/lib/jvm/zulu-${DEFAULT_JDK_VERSION}-azure-amd64" | tee -a /etc/environment
echo "JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8" | tee -a /etc/environment
# Install Ant
apt-fast install -y --no-install-recommends ant ant-optional
echo "ANT_HOME=/usr/share/ant" | tee -a /etc/environment
# Install Maven
curl -sL https://www-eu.apache.org/dist/maven/maven-3/3.6.2/binaries/apache-maven-3.6.2-bin.zip -o maven.zip
unzip -d /usr/share maven.zip
rm maven.zip
ln -s /usr/share/apache-maven-3.6.2/bin/mvn /usr/bin/mvn
echo "M2_HOME=/usr/share/apache-maven-3.6.2" | tee -a /etc/environment
# Install Gradle
# This script downloads the latest HTML list of releases at https://gradle.org/releases/.
# Then, it extracts the top-most release download URL, relying on the top-most URL being for the latest release.
# The release download URL looks like this: https://services.gradle.org/distributions/gradle-5.2.1-bin.zip
# The release version is extracted from the download URL (i.e. 5.2.1).
# After all of this, the release is downloaded, extracted, a symlink is created that points to it, and GRADLE_HOME is set.
wget -O gradleReleases.html https://gradle.org/releases/
gradleUrl=$(grep -m 1 -o "https:\/\/services.gradle.org\/distributions\/gradle-.*-bin\.zip" gradleReleases.html | head -1)
gradleVersion=$(echo $gradleUrl | sed -nre 's/^[^0-9]*(([0-9]+\.)*[0-9]+).*/\1/p')
rm gradleReleases.html
echo "gradleUrl=$gradleUrl"
echo "gradleVersion=$gradleVersion"
curl -sL $gradleUrl -o gradleLatest.zip
unzip -d /usr/share gradleLatest.zip
rm gradleLatest.zip
ln -s /usr/share/gradle-"${gradleVersion}"/bin/gradle /usr/bin/gradle
echo "GRADLE_HOME=/usr/share/gradle" | tee -a /etc/environment
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
for cmd in gradle java javac mvn ant; do
if ! command -v $cmd; then
echo "$cmd was not installed or found on path"
exit 1
fi
done
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Azul Zulu OpenJDK (7) ($(/usr/lib/jvm/zulu-7-azure-amd64/bin/java -showversion |& head -n 1))"
DocumentInstalledItem "Azul Zulu OpenJDK (8) ($(/usr/lib/jvm/zulu-8-azure-amd64/bin/java -showversion |& head -n 1))"
DocumentInstalledItem "Azul Zulu OpenJDK (11) ($(/usr/lib/jvm/zulu-11-azure-amd64/bin/java -showversion |& head -n 1))"
DocumentInstalledItem "Azul Zulu OpenJDK (12) ($(/usr/lib/jvm/zulu-12-azure-amd64/bin/java -showversion |& head -n 1))"
DocumentInstalledItem "Ant ($(ant -version))"
DocumentInstalledItem "Gradle ${gradleVersion}"
DocumentInstalledItem "Maven ($(mvn -version | head -n 1))"

View File

@@ -0,0 +1,26 @@
#!/bin/bash
################################################################################
## File: kind.sh
## Desc: Installs kind
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/apt.sh
# Install KIND
KIND_VERSION="v0.5.1"
curl -L -o /usr/local/bin/kind "https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-linux-amd64"
chmod +x /usr/local/bin/kind
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
if ! command -v kind; then
echo "Kind was not installed or found on PATH"
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Kind ($(kind version))"

View File

@@ -0,0 +1,35 @@
#!/bin/bash
################################################################################
## File: leiningen.sh
## Desc: Installs Leiningen
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
set -e
LEIN_BIN=/usr/local/bin/lein
curl -s https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein > $LEIN_BIN
chmod 0755 $LEIN_BIN
# Run lein to trigger self-install
export LEIN_HOME=/usr/local/lib/lein
lein
LEIN_JAR=$(find $LEIN_HOME -name "leiningen-*-standalone.jar")
echo "LEIN_JAR=$LEIN_JAR" | tee -a /etc/environment
echo "LEIN_HOME=$LEIN_HOME" | tee -a /etc/environment
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
if ! command -v lein; then
echo "lein was not installed"
exit 1
else
lein new app testapp && rm -rf testapp
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Leiningen ($(lein -v))"

View File

@@ -0,0 +1,23 @@
#!/bin/bash
################################################################################
## File: miniconda.sh
## Desc: Installs miniconda
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Install Miniconda
curl -sL https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -o miniconda.sh \
&& chmod +x miniconda.sh \
&& ./miniconda.sh -b -p /usr/share/miniconda \
&& rm miniconda.sh
CONDA=/usr/share/miniconda
echo "CONDA=$CONDA" | tee -a /etc/environment
ln -s $CONDA/bin/conda /usr/bin/conda
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Miniconda ($($CONDA/bin/conda --version))"

View File

@@ -0,0 +1,29 @@
#!/bin/bash
################################################################################
## File: cmake.sh
## Desc: Installs Mono
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
LSB_CODENAME=$(lsb_release -cs)
# Test to see if the software in question is already installed, if not install it
# wget "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF" -O out && sudo apt-key add out && rm out
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb https://download.mono-project.com/repo/ubuntu stable-$LSB_CODENAME main" | tee /etc/apt/sources.list.d/mono-official-stable.list
apt-get update
apt-get install -y --no-install-recommends apt-transport-https mono-complete
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
if ! command -v mono; then
echo "mono was not installed"
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Mono ($(mono --version | head -n 1))"

View File

@@ -0,0 +1,43 @@
#!/bin/bash
################################################################################
## File: mysql.sh
## Desc: Installs MySQL Client
################################################################################
## Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
export ACCEPT_EULA=Y
# Install MySQL Client
apt-get install mysql-client -y
# Install MySQL Server
MYSQL_ROOT_PASSWORD=root
echo "mysql-server mysql-server/root_password password $MYSQL_ROOT_PASSWORD" | debconf-set-selections
echo "mysql-server mysql-server/root_password_again password $MYSQL_ROOT_PASSWORD" | debconf-set-selections
apt-get install -y mysql-server
# Install MS SQL Server client tools (https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup-tools?view=sql-server-2017)
apt-get install -y mssql-tools unixodbc-dev
apt-get -f install
ln -s /opt/mssql-tools/bin/* /usr/local/bin/
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
if ! command -v mysql; then
echo "mysql was not installed"
exit 1
fi
set -e
mysql -vvv -e 'CREATE DATABASE smoke_test' -uroot -proot
mysql -vvv -e 'DROP DATABASE smoke_test' -uroot -proot
set +e
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "MySQL ($(mysql --version))"
DocumentInstalledItem "MySQL Server (user:root password:root)"
DocumentInstalledItem "MS SQL Server Client Tools"

View File

@@ -0,0 +1,47 @@
#!/bin/bash
################################################################################
## File: nodejs.sh
## Team: CI-Platform
## Desc: Installs Node.js LTS and related tooling (Gulp, Bower, Grunt)
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Install LTS Node.js and related build tools
curl -sL https://git.io/n-install | bash -s -- -ny -
~/n/bin/n lts
npm install -g bower grunt gulp n parcel-bundler typescript
npm install -g --save-dev webpack webpack-cli
npm install -g npm
rm -rf ~/n
# Install Yarn repository and key
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
apt-get update
# Install yarn
apt-get install -y --no-install-recommends yarn
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
for cmd in node bower grunt gulp webpack parcel yarn; do
if ! command -v $cmd; then
echo "$cmd was not installed"
exit 1
fi
done
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Node.js ($(node --version))"
DocumentInstalledItem "Bower ($(bower --version))"
DocumentInstalledItem "Grunt ($(grunt --version))"
DocumentInstalledItem "Gulp ($(gulp --version))"
DocumentInstalledItem "n ($(n --version))"
DocumentInstalledItem "Parcel ($(parcel --version))"
DocumentInstalledItem "TypeScript ($(tsc --version))"
DocumentInstalledItem "Webpack ($(webpack --version))"
DocumentInstalledItem "Webpack CLI ($(webpack-cli --version))"
DocumentInstalledItem "Yarn ($(yarn --version))"

View File

@@ -0,0 +1,29 @@
#!/bin/bash
################################################################################
## File: phantomjs.sh
## Desc: Installs PhantomJS
################################################################################
set -e
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Install PhantomJS
apt-get install -y chrpath libssl-dev libxft-dev libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev
PHANTOM_JS=phantomjs-2.1.1-linux-x86_64
wget https://bitbucket.org/ariya/phantomjs/downloads/$PHANTOM_JS.tar.bz2
tar xvjf $PHANTOM_JS.tar.bz2
mv $PHANTOM_JS /usr/local/share
ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
if ! command -v phantomjs; then
echo "phantomjs was not installed"
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "PhantomJS ($(phantomjs --version))"

View File

@@ -0,0 +1,22 @@
#!/bin/bash
################################################################################
## File: pollinate.sh
## Desc: Installs Pollinate
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Install Pollinate
apt-get install -y --no-install-recommends pollinate
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
if ! command -v pollinate; then
echo "pollinate was not installed"
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Pollinate"

View File

@@ -0,0 +1,67 @@
#!/bin/bash
################################################################################
## File: python.sh
## Desc: Installs Python 2/3 and related tools (pip, pypy)
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Install Python, Python 3, pip, pip3
apt-get install -y --no-install-recommends python python-dev python-pip python3 python3-dev python3-pip
# Install PyPy 2.7 to $AGENT_TOOLSDIRECTORY
wget -q -P /tmp https://bitbucket.org/pypy/pypy/downloads/pypy2.7-v7.1.0-linux64.tar.bz2
tar -x -C /tmp -f /tmp/pypy2.7-v7.1.0-linux64.tar.bz2
rm /tmp/pypy2.7-v7.1.0-linux64.tar.bz2
mkdir -p $AGENT_TOOLSDIRECTORY/PyPy/2.7.13
mv /tmp/pypy2.7-v7.1.0-linux64 $AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64
touch $AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64.complete
# add pypy to PATH by default
ln -s $AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64/bin/pypy /usr/local/bin/pypy
# pypy will be the python in PATH when its tools cache directory is prepended to PATH
# PEP 394-style symlinking; don't bother with minor version
ln -s $AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64/bin/pypy $AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64/bin/python2
ln -s $AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64/bin/python2 $AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64/bin/python
# Install latest Pip for PyPy2
$AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64/bin/pypy -m ensurepip
$AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64/bin/pypy -m pip install --ignore-installed pip
# Install PyPy 3.5 to $AGENT_TOOLSDIRECTORY
wget -q -P /tmp https://bitbucket.org/pypy/pypy/downloads/pypy3.5-v7.0.0-linux64.tar.bz2
tar -x -C /tmp -f /tmp/pypy3.5-v7.0.0-linux64.tar.bz2
rm /tmp/pypy3.5-v7.0.0-linux64.tar.bz2
mkdir -p $AGENT_TOOLSDIRECTORY/PyPy/3.5.3
mv /tmp/pypy3.5-v7.0.0-linux64 $AGENT_TOOLSDIRECTORY/PyPy/3.5.3/x64
touch $AGENT_TOOLSDIRECTORY/PyPy/3.5.3/x64.complete
# add pypy3 to PATH by default
ln -s $AGENT_TOOLSDIRECTORY/PyPy/3.5.3/x64/bin/pypy3 /usr/local/bin/pypy3
# pypy3 will be the python in PATH when its tools cache directory is prepended to PATH
# PEP 394-style symlinking; don't bother with minor version
ln -s $AGENT_TOOLSDIRECTORY/PyPy/3.5.3/x64/bin/pypy3 $AGENT_TOOLSDIRECTORY/PyPy/3.5.3/x64/bin/python3
ln -s $AGENT_TOOLSDIRECTORY/PyPy/3.5.3/x64/bin/python3 $AGENT_TOOLSDIRECTORY/PyPy/3.5.3/x64/bin/python
# Install latest Pip for PyPy3
$AGENT_TOOLSDIRECTORY/PyPy/3.5.3/x64/bin/pypy3 -m ensurepip
$AGENT_TOOLSDIRECTORY/PyPy/3.5.3/x64/bin/pypy3 -m pip install --ignore-installed pip
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
for cmd in python pip pypy python3 pip3 pypy3; do
if ! command -v $cmd; then
echo "$cmd was not installed or not found on PATH"
exit 1
fi
done
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Python ($(python --version 2>&1))"
DocumentInstalledItem "pip ($(pip --version))"
DocumentInstalledItem "Python3 ($(python3 --version))"
DocumentInstalledItem "pip3 ($(pip3 --version))"
DocumentInstalledItem "PyPy2 ($(pypy --version 2>&1 | grep PyPy))"
DocumentInstalledItem "PyPy3 ($(pypy3 --version 2>&1 | grep PyPy))"

View File

@@ -0,0 +1,11 @@
#!/bin/bash
################################################################################
## File: ruby.sh
## Desc: Installs Ruby requirements
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Install Ruby requirements
apt-get install -y libz-dev openssl libssl-dev

View File

@@ -0,0 +1,54 @@
#!/bin/bash
################################################################################
## File: rust.sh
## Desc: Installs Rust
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
set -e
export RUSTUP_HOME=/usr/share/rust/.rustup
export CARGO_HOME=/usr/share/rust/.cargo
curl https://sh.rustup.rs -sSf | sh -s -- -y
# Add Cargo and Rust binaries to the machine path
echo "PATH=${CARGO_HOME}/bin:$PATH" | tee -a /etc/environment
source $CARGO_HOME/env
# Install common tools
rustup component add rustfmt
rustup component add clippy
cargo install bindgen
cargo install cbindgen
echo "Test installation of the Rust toochain"
# Permissions
chmod -R 777 $(dirname $RUSTUP_HOME)
for cmd in rustup rustc rustdoc cargo rustfmt cargo-clippy bindgen cbindgen; do
if ! command -v $cmd --version; then
echo "$cmd was not installed or is not found on the path"
exit 1
fi
done
# Rust Symlinks are added to a default profile /etc/skel
pushd /etc/skel
ln -sf $RUSTUP_HOME .rustup
ln -sf $CARGO_HOME .cargo
popd
# Document what was added to the image
echo "Lastly, document what was added to the metadata file"
DocumentInstalledItem "rustup ($(rustup --version 2>&1 | cut -d ' ' -f 2))"
DocumentInstalledItem "rust ($(rustc --version 2>&1 | cut -d ' ' -f 2))"
DocumentInstalledItem "cargo ($(cargo --version 2>&1 | cut -d ' ' -f 2))"
DocumentInstalledItem "rustfmt ($(rustfmt --version 2>&1 | cut -d ' ' -f 2))"
DocumentInstalledItem "clippy ($(cargo-clippy --version 2>&1 | cut -d ' ' -f 2))"
DocumentInstalledItem "rustdoc ($(rustdoc --version 2>&1 | cut -d ' ' -f 2))"
DocumentInstalledItem "bindgen ($(bindgen --version 2>&1 | cut -d ' ' -f 2))"
DocumentInstalledItem "cbindgen ($(cbindgen --version 2>&1 | cut -d ' ' -f 2))"

View File

@@ -0,0 +1,20 @@
#!/bin/bash
################################################################################
## File: scala.sh
## Team: CI-Platform
## Desc: Installs sbt
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Install sbt
# https://www.scala-sbt.org/1.x/docs/Installing-sbt-on-Linux.html
echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | apt-key add
apt-get -q update
apt-get -y install sbt
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "sbt ($(sbt --script-version))"

View File

@@ -0,0 +1,15 @@
#!/bin/bash
################################################################################
## File: sphinx.sh
## Desc: Installs Sphinx
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Install Sphinx
apt-get install -y sphinxsearch
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Sphinx Open Source Search Server"

View File

@@ -0,0 +1,22 @@
#!/bin/bash
################################################################################
## File: subversion.sh
## Desc: Installs Subversion client
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Install Subversion
apt-get install -y --no-install-recommends subversion
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
if ! command -v svn; then
echo "Subversion (svn) was not installed"
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Subversion ($(svn --version | head -n 1))"

View File

@@ -0,0 +1,26 @@
#!/bin/bash
################################################################################
## File: terraform.sh
## Desc: Installs terraform
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/apt.sh
# Install Terraform
TERRAFORM_VERSION=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/terraform | jq -r .current_version)
curl -LO "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip"
unzip "terraform_${TERRAFORM_VERSION}_linux_amd64.zip" -d /usr/local/bin
rm -f "terraform_${TERRAFORM_VERSION}_linux_amd64.zip"
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
if ! command -v terraform; then
echo "Terraform was not installed or found on PATH"
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Terraform ($(terraform --version))"

View File

@@ -0,0 +1,70 @@
#!/bin/bash
################################################################################
## File: test-toolcache.sh
## Desc: Test Python and Ruby versions in tools cache
################################################################################
# Must be procecessed after tool cache setup(hosted-tool-cache.sh).
# Fail out if any tests fail
set -e
AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache
# Python test
if [ -d "$AGENT_TOOLSDIRECTORY/Python" ]; then
cd $AGENT_TOOLSDIRECTORY/Python
python_dirs=($(find . -mindepth 1 -maxdepth 1 -type d | sed "s|^\./||"))
echo "Python versions folders: ${python_dirs[@]}"
echo "------------------------------------------"
if [ -n "$python_dirs" ]; then
for version_dir in "${python_dirs[@]}"
do
echo "Test $AGENT_TOOLSDIRECTORY/Python/$version_dir:"
expected_ver=$(echo $version_dir | egrep -o '[0-9]+\.[0-9]+')
actual_ver=$($AGENT_TOOLSDIRECTORY/Python/$version_dir/x64/python -c 'import sys;print(sys.version)'| head -1 | egrep -o '[0-9]+\.[0-9]+')
if [ "$expected_ver" = "$actual_ver" ]; then
echo "Passed!"
else
echo "Expected: $expected_ver; Actual: $actual_ver"
exit 1
fi
done
else
echo "$AGENT_TOOLSDIRECTORY/Python does not include any folders"
exit 1
fi
else
echo "$AGENT_TOOLSDIRECTORY/Python does not exist"
exit 1
fi
# Ruby test
if [ -d "$AGENT_TOOLSDIRECTORY/Ruby" ]; then
cd $AGENT_TOOLSDIRECTORY/Ruby
ruby_dirs=($(find . -mindepth 1 -maxdepth 1 -type d | sed "s|^\./||"))
echo "Ruby versions folders: ${ruby_dirs[@]}"
echo "--------------------------------------"
if [ -n "$ruby_dirs" ]; then
for version_dir in "${ruby_dirs[@]}"
do
echo "Test $AGENT_TOOLSDIRECTORY/Ruby/$version_dir:"
expected_ver=$(echo $version_dir | egrep -o '[0-9]+\.[0-9]+')
actual_ver=$($AGENT_TOOLSDIRECTORY/Ruby/$version_dir/x64/bin/ruby -e "puts RUBY_VERSION" | egrep -o '[0-9]+\.[0-9]+')
if [ "$expected_ver" = "$actual_ver" ]; then
echo "Passed!"
else
echo "Expected: $expected_ver; Actual: $actual_ver"
exit 1
fi
done
else
echo "$AGENT_TOOLSDIRECTORY/Ruby does not include any folders"
exit 1
fi
else
echo "$AGENT_TOOLSDIRECTORY/Ruby does not exist"
exit 1
fi

View File

@@ -0,0 +1,30 @@
#!/bin/bash
################################################################################
## File: vcpkg.sh
## Desc: Installs vcpkg
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Set env variable for vcpkg
VCPKG_INSTALLATION_ROOT=/usr/local/share/vcpkg
echo "VCPKG_INSTALLATION_ROOT=${VCPKG_INSTALLATION_ROOT}" | tee -a /etc/environment
# Install vcpkg
git clone --depth=1 https://github.com/Microsoft/vcpkg $VCPKG_INSTALLATION_ROOT
$VCPKG_INSTALLATION_ROOT/bootstrap-vcpkg.sh
$VCPKG_INSTALLATION_ROOT/vcpkg integrate install
chmod 0777 -R $VCPKG_INSTALLATION_ROOT
ln -sf $VCPKG_INSTALLATION_ROOT/vcpkg /usr/local/bin
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
if ! command -v vcpkg; then
echo "vcpkg was not installed"
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Vcpkg $(vcpkg version | head -n 1 | cut -d ' ' -f 6)"

View File

@@ -0,0 +1,22 @@
#!/bin/bash
################################################################################
## File: zeit-now.sh
## Desc: Installs the Zeit Now CLI
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Install the Zeit Now CLI
npm i -g now
# Validate the installation
echo "Validate the installation"
if ! command -v now; then
echo "Zeit Now CLI was not installed"
exit 1
fi
# Document the installed version
echo "Document the installed version"
DocumentInstalledItem "Zeit Now CLI ($(now --version))"