[Ubuntu] unify apt install calls (#9953)

This commit is contained in:
Mikhail Koliada
2024-05-29 13:43:07 +02:00
committed by GitHub
parent 448c998191
commit 899fcf9b16
34 changed files with 50 additions and 49 deletions

View File

@@ -5,7 +5,7 @@
################################################################################ ################################################################################
# Install Apache # Install Apache
apt-get install apache2 -y apt-get install apache2
# Disable apache2.service # Disable apache2.service
systemctl is-active --quiet apache2.service && systemctl stop apache2.service systemctl is-active --quiet apache2.service && systemctl stop apache2.service

View File

@@ -12,7 +12,7 @@ cmd_packages=$(get_toolset_value .apt.cmd_packages[])
for package in $common_packages $cmd_packages; do for package in $common_packages $cmd_packages; do
echo "Install $package" echo "Install $package"
apt-get install -y --no-install-recommends $package apt-get install --no-install-recommends $package
done done
invoke_tests "Apt" invoke_tests "Apt"

View File

@@ -8,4 +8,4 @@
source $HELPER_SCRIPTS/install.sh source $HELPER_SCRIPTS/install.sh
vital_packages=$(get_toolset_value .apt.vital_packages[]) vital_packages=$(get_toolset_value .apt.vital_packages[])
apt-get install -y --no-install-recommends $vital_packages apt-get install --no-install-recommends $vital_packages

View File

@@ -14,7 +14,7 @@ unzip -qq "$awscliv2_archive_path" -d /tmp
/tmp/aws/install -i /usr/local/aws-cli -b /usr/local/bin /tmp/aws/install -i /usr/local/aws-cli -b /usr/local/bin
smplugin_deb_path=$(download_with_retry "https://s3.amazonaws.com/session-manager-downloads/plugin/latest/ubuntu_64bit/session-manager-plugin.deb") smplugin_deb_path=$(download_with_retry "https://s3.amazonaws.com/session-manager-downloads/plugin/latest/ubuntu_64bit/session-manager-plugin.deb")
apt install "$smplugin_deb_path" apt-get install "$smplugin_deb_path"
# Download the latest aws sam cli release # Download the latest aws sam cli release
aws_sam_cli_archive_name="aws-sam-cli-linux-x86_64.zip" aws_sam_cli_archive_name="aws-sam-cli-linux-x86_64.zip"

View File

@@ -11,7 +11,7 @@ install_clang() {
local version=$1 local version=$1
echo "Installing clang-$version..." echo "Installing clang-$version..."
apt-get install -y "clang-$version" "lldb-$version" "lld-$version" "clang-format-$version" "clang-tidy-$version" apt-get install "clang-$version" "lldb-$version" "lld-$version" "clang-format-$version" "clang-tidy-$version"
} }
set_default_clang() { set_default_clang() {

View File

@@ -29,7 +29,7 @@ fi
# Install podman, buildah, skopeo container's tools # Install podman, buildah, skopeo container's tools
apt-get update apt-get update
apt-get -y install ${install_packages[@]} apt-get install ${install_packages[@]}
mkdir -p /etc/containers mkdir -p /etc/containers
printf "[registries.search]\nregistries = ['docker.io', 'quay.io']\n" | tee /etc/containers/registries.conf printf "[registries.search]\nregistries = ['docker.io', 'quay.io']\n" | tee /etc/containers/registries.conf

View File

@@ -24,10 +24,10 @@ components=$(get_toolset_value '.docker.components[] .package')
for package in $components; do for package in $components; do
version=$(get_toolset_value ".docker.components[] | select(.package == \"$package\") | .version") version=$(get_toolset_value ".docker.components[] | select(.package == \"$package\") | .version")
if [[ $version == "latest" ]]; then if [[ $version == "latest" ]]; then
apt-get install -y --no-install-recommends "$package" apt-get install --no-install-recommends "$package"
else else
version_string=$(apt-cache madison "$package" | awk '{ print $3 }' | grep "$version" | grep "$os_codename" | head -1) version_string=$(apt-cache madison "$package" | awk '{ print $3 }' | grep "$version" | grep "$os_codename" | head -1)
apt-get install -y --no-install-recommends "${package}=${version_string}" apt-get install --no-install-recommends "${package}=${version_string}"
fi fi
done done

View File

@@ -48,7 +48,7 @@ for latest_package in ${latest_dotnet_packages[@]}; do
echo "Determining if .NET Core ($latest_package) is installed" echo "Determining if .NET Core ($latest_package) is installed"
if ! dpkg -S $latest_package &> /dev/null; then if ! dpkg -S $latest_package &> /dev/null; then
echo "Could not find .NET Core ($latest_package), installing..." echo "Could not find .NET Core ($latest_package), installing..."
apt-get install $latest_package -y apt-get install $latest_package
else else
echo ".NET Core ($latest_package) is already installed" echo ".NET Core ($latest_package) is already installed"
fi fi

View File

@@ -21,7 +21,7 @@ curl -fsSL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x${GPG_FINGER
echo "deb $REPO_URL $(lsb_release -cs) main" > $REPO_PATH echo "deb $REPO_URL $(lsb_release -cs) main" > $REPO_PATH
apt-get update apt-get update
apt-get install --target-release 'o=LP-PPA-mozillateam' -y firefox apt-get install --target-release 'o=LP-PPA-mozillateam' firefox
rm $REPO_PATH rm $REPO_PATH
# Document apt source repo's # Document apt source repo's

View File

@@ -11,7 +11,7 @@ versions=$(get_toolset_value '.gcc.versions[]')
for version in ${versions[*]}; do for version in ${versions[*]}; do
echo "Installing $version..." echo "Installing $version..."
apt-get install $version -y apt-get install $version
done done
invoke_tests "Tools" "gcc" invoke_tests "Tools" "gcc"

View File

@@ -11,7 +11,7 @@ versions=$(get_toolset_value '.gfortran.versions[]')
for version in ${versions[*]}; do for version in ${versions[*]}; do
echo "Installing $version..." echo "Installing $version..."
apt-get install $version -y apt-get install $version
done done
invoke_tests "Tools" "gfortran" invoke_tests "Tools" "gfortran"

View File

@@ -11,7 +11,7 @@ GIT_LFS_REPO="https://packagecloud.io/install/repositories/github/git-lfs"
# Install git-lfs # Install git-lfs
curl -fsSL $GIT_LFS_REPO/script.deb.sh | bash curl -fsSL $GIT_LFS_REPO/script.deb.sh | bash
apt-get install -y git-lfs apt-get install git-lfs
# Remove source repo's # Remove source repo's
rm /etc/apt/sources.list.d/github_git-lfs.list rm /etc/apt/sources.list.d/github_git-lfs.list

View File

@@ -13,8 +13,7 @@ GIT_REPO="ppa:git-core/ppa"
## Install git ## Install git
add-apt-repository $GIT_REPO -y add-apt-repository $GIT_REPO -y
apt-get update apt-get update
apt-get install git -y apt-get install git
git --version
# Git version 2.35.2 introduces security fix that breaks action\checkout https://github.com/actions/checkout/issues/760 # Git version 2.35.2 introduces security fix that breaks action\checkout https://github.com/actions/checkout/issues/760
cat <<EOF >> /etc/gitconfig cat <<EOF >> /etc/gitconfig
@@ -27,7 +26,7 @@ set_etc_environment_variable "GIT_CLONE_PROTECTION_ACTIVE" 'false'
reload_etc_environment reload_etc_environment
# Install git-ftp # Install git-ftp
apt-get install git-ftp -y apt-get install git-ftp
# Remove source repo's # Remove source repo's
add-apt-repository --remove $GIT_REPO add-apt-repository --remove $GIT_REPO

View File

@@ -19,6 +19,6 @@ external_hash=$(get_checksum_from_url "$hash_url" "linux_amd64.deb" "SHA256")
use_checksum_comparison "$gh_cli_deb_path" "$external_hash" use_checksum_comparison "$gh_cli_deb_path" "$external_hash"
# Install GitHub CLI # Install GitHub CLI
apt install "$gh_cli_deb_path" apt-get install "$gh_cli_deb_path"
invoke_tests "CLI.Tools" "GitHub CLI" invoke_tests "CLI.Tools" "GitHub CLI"

View File

@@ -37,7 +37,7 @@ get_chromium_revision() {
# Download and install Google Chrome # Download and install Google Chrome
CHROME_DEB_URL="https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb" CHROME_DEB_URL="https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb"
chrome_deb_path=$(download_with_retry "$CHROME_DEB_URL") chrome_deb_path=$(download_with_retry "$CHROME_DEB_URL")
apt install "$chrome_deb_path" -f apt-get install "$chrome_deb_path" -f
set_etc_environment_variable "CHROME_BIN" "/usr/bin/google-chrome" set_etc_environment_variable "CHROME_BIN" "/usr/bin/google-chrome"
# Remove Google Chrome repo # Remove Google Chrome repo

View File

@@ -9,8 +9,8 @@ REPO_URL="https://packages.cloud.google.com/apt"
# Install the Google Cloud CLI # Install the Google Cloud CLI
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] $REPO_URL cloud-sdk main" > /etc/apt/sources.list.d/google-cloud-sdk.list echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] $REPO_URL cloud-sdk main" > /etc/apt/sources.list.d/google-cloud-sdk.list
wget -qO- https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor > /usr/share/keyrings/cloud.google.gpg wget -qO- https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor > /usr/share/keyrings/cloud.google.gpg
apt-get update -y apt-get update
apt-get install -y google-cloud-cli apt-get install google-cloud-cli
# remove apt # remove apt
rm /etc/apt/sources.list.d/google-cloud-sdk.list rm /etc/apt/sources.list.d/google-cloud-sdk.list

View File

@@ -13,7 +13,8 @@ curl -fsSL "${REPO_URL}/release.key" | gpg --dearmor -o $GPG_KEY
echo "deb [trusted=yes] $REPO_URL ./" > $REPO_PATH echo "deb [trusted=yes] $REPO_URL ./" > $REPO_PATH
# install heroku # install heroku
apt-get update -y && apt-get install -y heroku apt-get update
apt-get install heroku
# remove heroku's apt repository # remove heroku's apt repository
rm $REPO_PATH rm $REPO_PATH

View File

@@ -14,7 +14,7 @@ echo "deb [signed-by=$GPG_KEY] $REPO_URL $(lsb_release -cs) main" > $REPO_PATH
# install HHVM # install HHVM
apt-get update apt-get update
apt-get -qq install -y hhvm apt-get install hhvm
# remove HHVM's apt repository # remove HHVM's apt repository
rm $REPO_PATH rm $REPO_PATH

View File

@@ -85,7 +85,7 @@ for jdkVersionToInstall in ${jdkVersionsToInstall[@]}; do
done done
# Install Ant # Install Ant
apt-get install -y --no-install-recommends ant ant-optional apt-get install --no-install-recommends ant ant-optional
set_etc_environment_variable "ANT_HOME" "/usr/share/ant" set_etc_environment_variable "ANT_HOME" "/usr/share/ant"
# Install Maven # Install Maven

View File

@@ -23,7 +23,8 @@ install "${kind_binary_path}" /usr/local/bin/kind
kubectl_minor_version=$(curl -fsSL "https://dl.k8s.io/release/stable.txt" | cut -d'.' -f1,2 ) kubectl_minor_version=$(curl -fsSL "https://dl.k8s.io/release/stable.txt" | cut -d'.' -f1,2 )
curl -fsSL https://pkgs.k8s.io/core:/stable:/$kubectl_minor_version/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg curl -fsSL https://pkgs.k8s.io/core:/stable:/$kubectl_minor_version/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/'$kubectl_minor_version'/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/'$kubectl_minor_version'/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update -y && sudo apt-get install -y kubectl apt-get update
apt-get install kubectl
rm -f /etc/apt/sources.list.d/kubernetes.list rm -f /etc/apt/sources.list.d/kubernetes.list
# Install Helm # Install Helm

View File

@@ -18,7 +18,7 @@ echo "deb [ arch=amd64,arm64 signed-by=$GPG_KEY ] $REPO_URL $(lsb_release -cs)/m
# Install Mongo DB # Install Mongo DB
sudo apt-get update sudo apt-get update
sudo apt-get install -y mongodb-org sudo apt-get install mongodb-org
# remove Mongo DB's apt repository # remove Mongo DB's apt repository
rm $REPO_PATH rm $REPO_PATH

View File

@@ -23,7 +23,7 @@ echo "deb [signed-by=$GPG_KEY] $REPO_URL stable-$os_label main" > $REPO_PATH
# Install Mono # Install Mono
apt-get update apt-get update
apt-get install -y --no-install-recommends apt-transport-https mono-complete nuget apt-get install --no-install-recommends apt-transport-https mono-complete nuget
# Remove Mono's apt repo # Remove Mono's apt repo
rm $REPO_PATH rm $REPO_PATH

View File

@@ -11,6 +11,6 @@ wget https://packages.microsoft.com/config/ubuntu/$os_label/packages-microsoft-p
dpkg -i packages-microsoft-prod.deb dpkg -i packages-microsoft-prod.deb
# update # update
apt-get install -y apt-transport-https ca-certificates curl software-properties-common apt-get install apt-transport-https ca-certificates curl software-properties-common
apt-get -yq update apt-get update
apt-get -yq dist-upgrade apt-get dist-upgrade

View File

@@ -7,7 +7,7 @@
export ACCEPT_EULA=Y export ACCEPT_EULA=Y
apt-get update apt-get update
apt-get install -y mssql-tools unixodbc-dev apt-get install mssql-tools unixodbc-dev
apt-get -f install apt-get -f install
ln -s /opt/mssql-tools/bin/* /usr/local/bin/ ln -s /opt/mssql-tools/bin/* /usr/local/bin/

View File

@@ -15,13 +15,13 @@ echo "mysql-server mysql-server/root_password_again password $MYSQL_ROOT_PASSWOR
export ACCEPT_EULA=Y export ACCEPT_EULA=Y
# Install MySQL Client # Install MySQL Client
apt-get install mysql-client -y apt-get install mysql-client
# Install MySQL Server # Install MySQL Server
apt-get install -y mysql-server apt-get install mysql-server
#Install MySQL Dev tools # Install MySQL Dev tools
apt install libmysqlclient-dev -y apt-get install libmysqlclient-dev
# Disable mysql.service # Disable mysql.service
systemctl is-active --quiet mysql.service && systemctl stop mysql.service systemctl is-active --quiet mysql.service && systemctl stop mysql.service

View File

@@ -5,7 +5,7 @@
################################################################################ ################################################################################
# Install Nginx # Install Nginx
apt-get install nginx -y apt-get install nginx
# Disable nginx.service # Disable nginx.service
systemctl is-active --quiet nginx.service && systemctl stop nginx.service systemctl is-active --quiet nginx.service && systemctl stop nginx.service

View File

@@ -8,7 +8,7 @@
source $HELPER_SCRIPTS/install.sh source $HELPER_SCRIPTS/install.sh
# Install required dependencies # Install required dependencies
apt-get install -y chrpath libssl-dev libxft-dev libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev apt-get install chrpath libssl-dev libxft-dev libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev
# Define the version and hash of PhantomJS to be installed # Define the version and hash of PhantomJS to be installed
DIR_NAME=phantomjs-2.1.1-linux-x86_64 DIR_NAME=phantomjs-2.1.1-linux-x86_64

View File

@@ -21,7 +21,7 @@ php_versions=$(get_toolset_value '.php.versions[]')
for version in $php_versions; do for version in $php_versions; do
echo "Installing PHP $version" echo "Installing PHP $version"
apt-get install -y --no-install-recommends \ apt-get install --no-install-recommends \
php$version \ php$version \
php$version-amqp \ php$version-amqp \
php$version-apcu \ php$version-apcu \
@@ -67,24 +67,24 @@ for version in $php_versions; do
php$version-zip \ php$version-zip \
php$version-zmq php$version-zmq
apt-get install -y --no-install-recommends php$version-pcov apt-get install --no-install-recommends php$version-pcov
# Disable PCOV, as Xdebug is enabled by default # Disable PCOV, as Xdebug is enabled by default
# https://github.com/krakjoe/pcov#interoperability # https://github.com/krakjoe/pcov#interoperability
phpdismod -v $version pcov phpdismod -v $version pcov
if [[ $version == "7.2" || $version == "7.3" || $version == "7.4" ]]; then if [[ $version == "7.2" || $version == "7.3" || $version == "7.4" ]]; then
apt-get install -y --no-install-recommends php$version-recode apt-get install --no-install-recommends php$version-recode
fi fi
if [[ $version != "8.0" && $version != "8.1" && $version != "8.2" && $version != "8.3" ]]; then if [[ $version != "8.0" && $version != "8.1" && $version != "8.2" && $version != "8.3" ]]; then
apt-get install -y --no-install-recommends php$version-xmlrpc php$version-json apt-get install --no-install-recommends php$version-xmlrpc php$version-json
fi fi
done done
apt-get install -y --no-install-recommends php-pear apt-get install --no-install-recommends php-pear
apt-get install -y --no-install-recommends snmp apt-get install --no-install-recommends snmp
# Install composer # Install composer
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"

View File

@@ -20,7 +20,7 @@ toolset_version=$(get_toolset_value '.postgresql.version')
# Install PostgreSQL # Install PostgreSQL
echo "Install PostgreSQL" echo "Install PostgreSQL"
apt update apt update
apt install postgresql-$toolset_version apt-get install postgresql-$toolset_version
echo "Install libpq-dev" echo "Install libpq-dev"
apt-get install libpq-dev apt-get install libpq-dev

View File

@@ -17,5 +17,5 @@ if is_ubuntu24; then
package_path=$(download_with_retry "https://github.com/PowerShell/PowerShell/releases/download/v7.4.2/powershell-lts_7.4.2-1.deb_amd64.deb") package_path=$(download_with_retry "https://github.com/PowerShell/PowerShell/releases/download/v7.4.2/powershell-lts_7.4.2-1.deb_amd64.deb")
sudo dpkg -i "$package_path" sudo dpkg -i "$package_path"
else else
apt-get install -y powershell=$pwsh_version* apt-get install powershell=$pwsh_version*
fi fi

View File

@@ -10,14 +10,14 @@ source $HELPER_SCRIPTS/etc-environment.sh
source $HELPER_SCRIPTS/os.sh source $HELPER_SCRIPTS/os.sh
# Install Python, Python 3, pip, pip3 # Install Python, Python 3, pip, pip3
apt-get install -y --no-install-recommends python3 python3-dev python3-pip python3-venv apt-get install --no-install-recommends python3 python3-dev python3-pip python3-venv
# Install pipx # Install pipx
# Set pipx custom directory # Set pipx custom directory
export PIPX_BIN_DIR=/opt/pipx_bin export PIPX_BIN_DIR=/opt/pipx_bin
export PIPX_HOME=/opt/pipx export PIPX_HOME=/opt/pipx
if is_ubuntu24; then if is_ubuntu24; then
apt-get install -y --no-install-recommends pipx apt-get install --no-install-recommends pipx
pipx ensurepath pipx ensurepath
else else
python3 -m pip install pipx python3 -m pip install pipx

View File

@@ -20,7 +20,7 @@ if [[ -n "$gems_to_install" ]]; then
fi fi
# Install Ruby requirements # Install Ruby requirements
apt-get install -y libz-dev openssl libssl-dev apt-get install libz-dev openssl libssl-dev
echo "Install Ruby from toolset..." echo "Install Ruby from toolset..."
package_tar_names=$(curl -fsSL "https://api.github.com/repos/ruby/ruby-builder/releases/latest" | jq -r '.assets[].name') package_tar_names=$(curl -fsSL "https://api.github.com/repos/ruby/ruby-builder/releases/latest" | jq -r '.assets[].name')

View File

@@ -14,7 +14,7 @@ if is_ubuntu22; then
echo "deb http://archive.ubuntu.com/ubuntu/ focal-security main" | tee "${focal_list}" echo "deb http://archive.ubuntu.com/ubuntu/ focal-security main" | tee "${focal_list}"
apt-get update --quiet apt-get update --quiet
apt-get install --no-install-recommends --yes libssl1.1 apt-get install --no-install-recommends libssl1.1
rm "${focal_list}" rm "${focal_list}"
apt-get update --quiet apt-get update --quiet

View File

@@ -19,7 +19,7 @@ external_hash=$(get_checksum_from_url "${download_url}.sha256" "${release_name}.
use_checksum_comparison "$archive_path" "$external_hash" use_checksum_comparison "$archive_path" "$external_hash"
# Install zstd # Install zstd
apt-get install -y liblz4-dev apt-get install liblz4-dev
tar xzf "$archive_path" -C /tmp tar xzf "$archive_path" -C /tmp
make -C "/tmp/${release_name}/contrib/pzstd" all make -C "/tmp/${release_name}/contrib/pzstd" all