diff --git a/images/linux/scripts/installers/2004/android.sh b/images/linux/scripts/installers/2004/android.sh new file mode 100644 index 000000000..a4a94566c --- /dev/null +++ b/images/linux/scripts/installers/2004/android.sh @@ -0,0 +1,154 @@ +#!/bin/bash +################################################################################ +## File: android.sh +## Desc: Installs Android SDK +################################################################################ + +set -e + +# 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 + +# Create android sdk directory +mkdir -p ${ANDROID_SDK_ROOT} + +# 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_SDK_ROOT} +rm -f android-sdk.zip + +# Add required permissions +chmod -R a+X ${ANDROID_SDK_ROOT} + +# Check sdk manager installation +/usr/local/lib/android/sdk/tools/bin/sdkmanager --list 1>/dev/null +if [ $? -eq 0 ] +then + echo "Android SDK manager was installed" +else + echo "Android SDK manager was not installed" + exit 1 +fi + +# Install the following SDKs and build tools, passing in "y" to accept licenses. +echo "y" | ${ANDROID_SDK_ROOT}/tools/bin/sdkmanager \ + "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.3" \ + "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" \ + "cmake;3.10.2.4988404" \ + "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.3" +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)" diff --git a/images/linux/scripts/installers/2004/basic.sh b/images/linux/scripts/installers/2004/basic.sh new file mode 100644 index 000000000..29cb15b40 --- /dev/null +++ b/images/linux/scripts/installers/2004/basic.sh @@ -0,0 +1,170 @@ +#!/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 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 tzdata" +apt-get install -y --no-install-recommends tzdata + +echo "Install unzip" +apt-get install -y --no-install-recommends unzip + +echo "Install upx" +apt-get install -y --no-install-recommends upx + +echo "Install wget" +apt-get install -y --no-install-recommends wget + +echo "Install zip" +apt-get install -y --no-install-recommends zip + +echo "Install zstd" +apt-get install -y --no-install-recommends zstd + +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 libgbm-dev" +apt-get install -y --no-install-recommends libgbm-dev + +echo "Install libgtk" +apt-get install -y --no-install-recommends libgtk-3-0 + +echo "Install tk" +apt install -y tk + +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 + +echo "Install parallel" +apt-get install -y --no-install-recommends parallel + +# 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 parallel 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 "libgbm-dev" +DocumentInstalledItemIndent "libicu55" +DocumentInstalledItemIndent "libunwind8" +DocumentInstalledItemIndent "locales" +DocumentInstalledItemIndent "netcat" +DocumentInstalledItemIndent "openssh-client" +DocumentInstalledItemIndent "parallel" +DocumentInstalledItemIndent "rsync" +DocumentInstalledItemIndent "shellcheck" +DocumentInstalledItemIndent "sudo" +DocumentInstalledItemIndent "telnet" +DocumentInstalledItemIndent "time" +DocumentInstalledItemIndent "tzdata" +DocumentInstalledItemIndent "unzip" +DocumentInstalledItemIndent "upx" +DocumentInstalledItemIndent "wget" +DocumentInstalledItemIndent "zip" +DocumentInstalledItemIndent "zstd" diff --git a/images/linux/scripts/installers/2004/containers.sh b/images/linux/scripts/installers/2004/containers.sh new file mode 100644 index 000000000..0ccf746ab --- /dev/null +++ b/images/linux/scripts/installers/2004/containers.sh @@ -0,0 +1,24 @@ +#!/bin/bash +################################################################################ +## File: containers.sh +## Desc: Installs container tools: podman, buildah and skopeo onto the image +################################################################################ + +source $HELPER_SCRIPTS/apt.sh +source $HELPER_SCRIPTS/document.sh + +source /etc/os-release +sh -c "echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/x${NAME}_${VERSION_ID}/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list" +wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/x${NAME}_${VERSION_ID}/Release.key -O Release.key +apt-key add - < Release.key +apt-get update -qq +apt-get -qq -y install podman buildah skopeo +mkdir -p /etc/containers +echo -e "[registries.search]\nregistries = ['docker.io', 'quay.io']" | tee /etc/containers/registries.conf + +## Add version information to the metadata file +echo "Documenting container tools version" +PODMAN_VERSION='podman --version' +BUILDAH_VERSION='buildah --version' +SKOPEO_VERSION='skopeo --version' +DocumentInstalledItem "Podman ($PODMAN_VERSION)\nBuildah ($BUILDAH_VERSION)\nSkopeo ($SKOPEO_VERSION)" diff --git a/images/linux/scripts/installers/2004/kubernetes-tools.sh b/images/linux/scripts/installers/2004/kubernetes-tools.sh new file mode 100644 index 000000000..38659028f --- /dev/null +++ b/images/linux/scripts/installers/2004/kubernetes-tools.sh @@ -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 https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | 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))" diff --git a/images/linux/scripts/installers/2004/mercurial.sh b/images/linux/scripts/installers/2004/mercurial.sh new file mode 100644 index 000000000..abd9cdb0d --- /dev/null +++ b/images/linux/scripts/installers/2004/mercurial.sh @@ -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))" diff --git a/images/linux/scripts/installers/2004/php.sh b/images/linux/scripts/installers/2004/php.sh new file mode 100644 index 000000000..8ab10d785 --- /dev/null +++ b/images/linux/scripts/installers/2004/php.sh @@ -0,0 +1,224 @@ +#!/bin/bash +################################################################################ +## File: php.sh +## Desc: Installs php +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/etc-environment.sh +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-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-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-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 + +# Install php7.4 +apt-fast install -y --no-install-recommends \ + php7.4 \ + php7.4-bcmath \ + php7.4-bz2 \ + php7.4-cgi \ + php7.4-cli \ + php7.4-common \ + php7.4-curl \ + php7.4-dba \ + php7.4-dev \ + php7.4-enchant \ + php7.4-fpm \ + php7.4-gd \ + php7.4-gmp \ + php7.4-imap \ + php7.4-interbase \ + php7.4-intl \ + php7.4-json \ + php7.4-ldap \ + php7.4-mbstring \ + php7.4-mysql \ + php7.4-odbc \ + php7.4-opcache \ + php7.4-pgsql \ + php7.4-phpdbg \ + php7.4-pspell \ + php7.4-readline \ + php7.4-snmp \ + php7.4-soap \ + php7.4-sqlite3 \ + php7.4-sybase \ + php7.4-tidy \ + php7.4-xml \ + php7.4-xmlrpc \ + php7.4-xsl \ + php7.4-zip + +apt-fast install -y --no-install-recommends \ + php-amqp \ + php-apcu \ + 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') === file_get_contents('https://composer.github.io/installer.sig')) { 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');" + +# Update /etc/environment +prependEtcEnvironmentPath /home/runner/.config/composer/vendor/bin + +# Add composer bin folder to path +echo 'export PATH="$PATH:$HOME/.config/composer/vendor/bin"' >> /etc/skel/.bashrc + +# 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 php7.4 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 "PHP 7.4 ($(php7.4 --version | head -n 1))" +DocumentInstalledItem "Composer ($(composer --version))" +DocumentInstalledItem "PHPUnit ($(phpunit --version))" diff --git a/images/linux/scripts/installers/2004/preparemetadata.sh b/images/linux/scripts/installers/2004/preparemetadata.sh new file mode 100644 index 000000000..45cfcabfa --- /dev/null +++ b/images/linux/scripts/installers/2004/preparemetadata.sh @@ -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 "$(lsb_release -ds)" +WriteItem "The following software is installed on machines with the $IMAGE_VERSION update." +WriteItem "***" diff --git a/images/linux/ubuntu2004.json b/images/linux/ubuntu2004.json new file mode 100644 index 000000000..c7d86b64d --- /dev/null +++ b/images/linux/ubuntu2004.json @@ -0,0 +1,350 @@ +{ + "variables": { + "commit_url": "{{env `COMMIT_URL`}}", + "client_id": "{{env `ARM_CLIENT_ID`}}", + "client_secret": "{{env `ARM_CLIENT_SECRET`}}", + "subscription_id": "{{env `ARM_SUBSCRIPTION_ID`}}", + "tenant_id": "{{env `ARM_TENANT_ID`}}", + "resource_group": "{{env `ARM_RESOURCE_GROUP`}}", + "storage_account": "{{env `ARM_STORAGE_ACCOUNT`}}", + "temp_resource_group_name": "{{env `TEMP_RESOURCE_GROUP_NAME`}}", + "location": "{{env `ARM_RESOURCE_LOCATION`}}", + "virtual_network_name": "{{env `VNET_NAME`}}", + "virtual_network_resource_group_name": "{{env `VNET_RESOURCE_GROUP`}}", + "virtual_network_subnet_name": "{{env `VNET_SUBNET`}}", + "private_virtual_network_with_public_ip": "{{env `PRIVATE_VIRTUAL_NETWORK_WITH_PUBLIC_IP`}}", + "image_folder": "/imagegeneration", + "commit_file": "/imagegeneration/commit.txt", + "imagedata_file": "/imagegeneration/imagedata.json", + "metadata_file": "/imagegeneration/metadatafile", + "installer_script_folder": "/imagegeneration/installers", + "helper_script_folder": "/imagegeneration/helpers", + "vm_size": "Standard_DS2_v2", + "capture_name_prefix": "packer", + "image_version": "dev", + "image_os": "ubuntu20", + "github_feed_token": null, + "go_default": "1.14", + "go_versions": "1.11 1.12 1.13 1.14" + }, + "sensitive-variables": ["client_secret", "github_feed_token"], + "builders": [ + { + "type": "azure-arm", + "client_id": "{{user `client_id`}}", + "client_secret": "{{user `client_secret`}}", + "subscription_id": "{{user `subscription_id`}}", + "tenant_id": "{{user `tenant_id`}}", + + "location": "{{user `location`}}", + "vm_size": "{{user `vm_size`}}", + "resource_group_name": "{{user `resource_group`}}", + "storage_account": "{{user `storage_account`}}", + "temp_resource_group_name": "{{user `temp_resource_group_name`}}", + "capture_container_name": "images", + "capture_name_prefix": "{{user `capture_name_prefix`}}", + "virtual_network_name": "{{user `virtual_network_name`}}", + "virtual_network_resource_group_name": "{{user `virtual_network_resource_group_name`}}", + "virtual_network_subnet_name": "{{user `virtual_network_subnet_name`}}", + "private_virtual_network_with_public_ip": "{{user `private_virtual_network_with_public_ip`}}", + "os_type": "Linux", + "image_publisher": "canonical", + "image_offer": "0001-com-ubuntu-server-focal", + "image_sku": "20_04-lts", + "os_disk_size_gb": "86" + } + ], + "provisioners": [ + { + "type": "shell", + "inline": [ + "mkdir {{user `image_folder`}}", + "chmod 777 {{user `image_folder`}}", + "echo {{user `commit_url`}} > {{user `commit_file`}}", + "chmod +r {{user `commit_file`}}" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "scripts":[ + "{{template_dir}}/scripts/base/repos.sh" + ], + "environment_vars": [ + "DEBIAN_FRONTEND=noninteractive" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "inline": [ + "apt-get update", + "apt-get dist-upgrade -y", + "systemctl disable apt-daily.service", + "systemctl disable apt-daily.timer", + "systemctl disable apt-daily-upgrade.timer", + "systemctl disable apt-daily-upgrade.service", + "echo '* soft nofile 65536 \n* hard nofile 65536' >> /etc/security/limits.conf", + "echo 'session required pam_limits.so' >> /etc/pam.d/common-session", + "echo 'session required pam_limits.so' >> /etc/pam.d/common-session-noninteractive", + "echo 'DefaultLimitNOFILE=65536' >> /etc/systemd/system.conf" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "file", + "source": "{{template_dir}}/scripts/helpers", + "destination": "{{user `helper_script_folder`}}" + }, + { + "type": "file", + "source": "{{template_dir}}/scripts/installers", + "destination": "{{user `installer_script_folder`}}" + }, + { + "type": "shell", + "scripts":[ + "{{template_dir}}/scripts/installers/2004/preparemetadata.sh" + ], + "environment_vars": [ + "IMAGE_VERSION={{user `image_version`}}", + "METADATA_FILE={{user `metadata_file`}}", + "HELPER_SCRIPTS={{user `helper_script_folder`}}" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "scripts":[ + "{{template_dir}}/scripts/installers/preimagedata.sh" + ], + "environment_vars": [ + "IMAGE_VERSION={{user `image_version`}}", + "IMAGEDATA_FILE={{user `imagedata_file`}}" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "scripts": [ + "{{template_dir}}/scripts/installers/configure-environment.sh" + ], + "environment_vars": [ + "IMAGE_VERSION={{user `image_version`}}", + "IMAGE_OS={{user `image_os`}}" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "scripts": [ + "{{template_dir}}/scripts/installers/complete-snap-setup.sh" + ], + "environment_vars": [ + "HELPER_SCRIPTS={{user `helper_script_folder`}}" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "scripts": [ + "{{template_dir}}/scripts/installers/homebrew.sh" + ], + "environment_vars": [ + "METADATA_FILE={{user `metadata_file`}}", + "HELPER_SCRIPTS={{user `helper_script_folder`}}", + "DEBIAN_FRONTEND=noninteractive" + ], + "execute_command": "/bin/sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "expect_disconnect": true, + "scripts": [ + "{{template_dir}}/scripts/base/reboot.sh" + ], + "execute_command": "/bin/sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "pause_before": "30s", + "timeout": "10m", + "start_retry_timeout": "10s", + "scripts": [ + "{{template_dir}}/scripts/installers/homebrew-validate.sh" + ], + "execute_command": "/bin/sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "scripts": [ + "{{template_dir}}/scripts/installers/7-zip.sh", + "{{template_dir}}/scripts/installers/ansible.sh", + "{{template_dir}}/scripts/installers/azcopy.sh", + "{{template_dir}}/scripts/installers/azure-cli.sh", + "{{template_dir}}/scripts/installers/azure-devops-cli.sh", + "{{template_dir}}/scripts/installers/2004/basic.sh", + "{{template_dir}}/scripts/installers/aliyun-cli.sh", + "{{template_dir}}/scripts/installers/aws.sh", + "{{template_dir}}/scripts/installers/build-essential.sh", + "{{template_dir}}/scripts/installers/clang.sh", + "{{template_dir}}/scripts/installers/swift.sh", + "{{template_dir}}/scripts/installers/cmake.sh", + "{{template_dir}}/scripts/installers/2004/containers.sh", + "{{template_dir}}/scripts/installers/docker-compose.sh", + "{{template_dir}}/scripts/installers/docker-moby.sh", + "{{template_dir}}/scripts/installers/dotnetcore-sdk.sh", + "{{template_dir}}/scripts/installers/erlang.sh", + "{{template_dir}}/scripts/installers/firefox.sh", + "{{template_dir}}/scripts/installers/gcc.sh", + "{{template_dir}}/scripts/installers/gfortran.sh", + "{{template_dir}}/scripts/installers/git.sh", + "{{template_dir}}/scripts/installers/google-chrome.sh", + "{{template_dir}}/scripts/installers/google-cloud-sdk.sh", + "{{template_dir}}/scripts/installers/haskell.sh", + "{{template_dir}}/scripts/installers/heroku.sh", + "{{template_dir}}/scripts/installers/hhvm.sh", + "{{template_dir}}/scripts/installers/image-magick.sh", + "{{template_dir}}/scripts/installers/java-tools.sh", + "{{template_dir}}/scripts/installers/kind.sh", + "{{template_dir}}/scripts/installers/2004/kubernetes-tools.sh", + "{{template_dir}}/scripts/installers/leiningen.sh", + "{{template_dir}}/scripts/installers/2004/mercurial.sh", + "{{template_dir}}/scripts/installers/miniconda.sh", + "{{template_dir}}/scripts/installers/mono.sh", + "{{template_dir}}/scripts/installers/mysql.sh", + "{{template_dir}}/scripts/installers/nvm.sh", + "{{template_dir}}/scripts/installers/nodejs.sh", + "{{template_dir}}/scripts/installers/bazel.sh", + "{{template_dir}}/scripts/installers/phantomjs.sh", + "{{template_dir}}/scripts/installers/2004/php.sh", + "{{template_dir}}/scripts/installers/pollinate.sh", + "{{template_dir}}/scripts/installers/postgresql.sh", + "{{template_dir}}/scripts/installers/powershellcore.sh", + "{{template_dir}}/scripts/installers/ruby.sh", + "{{template_dir}}/scripts/installers/rust.sh", + "{{template_dir}}/scripts/installers/julia.sh", + "{{template_dir}}/scripts/installers/sbt.sh", + "{{template_dir}}/scripts/installers/selenium.sh", + "{{template_dir}}/scripts/installers/sphinx.sh", + "{{template_dir}}/scripts/installers/subversion.sh", + "{{template_dir}}/scripts/installers/terraform.sh", + "{{template_dir}}/scripts/installers/packer.sh", + "{{template_dir}}/scripts/installers/vcpkg.sh", + "{{template_dir}}/scripts/installers/zeit-now.sh", + "{{template_dir}}/scripts/installers/dpkg-config.sh", + "{{template_dir}}/scripts/installers/mongodb.sh", + "{{template_dir}}/scripts/installers/rndgenerator.sh" + ], + "environment_vars": [ + "METADATA_FILE={{user `metadata_file`}}", + "HELPER_SCRIPTS={{user `helper_script_folder`}}", + "DEBIAN_FRONTEND=noninteractive" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "scripts": [ + "{{template_dir}}/scripts/installers/aws-sam-cli.sh" + ], + "environment_vars": [ + "METADATA_FILE={{user `metadata_file`}}", + "HELPER_SCRIPTS={{user `helper_script_folder`}}", + "DEBIAN_FRONTEND=noninteractive" + ], + "execute_command": "/bin/sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "scripts": [ + "{{template_dir}}/scripts/installers/go.sh" + ], + "environment_vars": [ + "METADATA_FILE={{user `metadata_file`}}", + "HELPER_SCRIPTS={{user `helper_script_folder`}}", + "GO_VERSIONS={{user `go_versions`}}", + "GO_DEFAULT={{user `go_default`}}" + ], + "execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}" + }, + { + "type": "file", + "source": "{{template_dir}}/toolcache-2004.json", + "destination": "{{user `installer_script_folder`}}/toolcache.json" + }, + { + "type": "shell", + "scripts":[ + "{{template_dir}}/scripts/installers/2004/android.sh", + "{{template_dir}}/scripts/installers/azpowershell.sh", + "{{template_dir}}/scripts/helpers/containercache.sh", + "{{template_dir}}/scripts/installers/hosted-tool-cache.sh", + "{{template_dir}}/scripts/installers/python.sh", + "{{template_dir}}/scripts/installers/test-toolcache.sh" + ], + "environment_vars": [ + "METADATA_FILE={{user `metadata_file`}}", + "HELPER_SCRIPTS={{user `helper_script_folder`}}", + "INSTALLER_SCRIPT_FOLDER={{user `installer_script_folder`}}", + "GITHUB_FEED_TOKEN={{user `github_feed_token`}}" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "scripts":[ + "{{template_dir}}/scripts/installers/boost.sh" + ], + "environment_vars": [ + "METADATA_FILE={{user `metadata_file`}}", + "HELPER_SCRIPTS={{user `helper_script_folder`}}", + "INSTALLER_SCRIPT_FOLDER={{user `installer_script_folder`}}" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "scripts":[ + "{{template_dir}}/scripts/installers/cleanup.sh" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "file", + "source": "{{user `metadata_file`}}", + "destination": "{{template_dir}}/Ubuntu2004-README.md", + "direction": "download" + }, + { + "type": "shell", + "inline": [ + "rm -rf {{user `helper_script_folder`}}", + "rm -rf {{user `installer_script_folder`}}", + "chmod 755 {{user `image_folder`}}" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "file", + "source": "{{template_dir}}/config/ubuntu2004.conf", + "destination": "/tmp/" + }, + { + "type": "shell", + "inline": [ + "mkdir -p /etc/vsts", + "cp /tmp/ubuntu2004.conf /etc/vsts/machine_instance.conf" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "inline": [ + "sleep 30", + "/usr/sbin/waagent -force -deprovision+user && export HISTSIZE=0 && sync" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + } + ] +}