mirror of
https://github.com/actions/runner-images.git
synced 2025-12-20 06:35:47 +00:00
Merge pull request #1208 from miketimofeev/v-mitim/get_rid_of_apt.sh_invocation
[Ubuntu] Fix 'Unable to acquire the dpkg frontend lock' error
This commit is contained in:
@@ -1,9 +1,18 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
apt-get -yqq update
|
apt-get -yq update
|
||||||
apt-get -yqq dist-upgrade
|
apt-get -yq dist-upgrade
|
||||||
systemctl disable apt-daily.service
|
systemctl disable apt-daily.service
|
||||||
systemctl disable apt-daily.timer
|
systemctl disable apt-daily.timer
|
||||||
systemctl disable apt-daily-upgrade.timer
|
systemctl disable apt-daily-upgrade.timer
|
||||||
systemctl disable apt-daily-upgrade.service
|
systemctl disable apt-daily-upgrade.service
|
||||||
|
|
||||||
|
# Configure apt to always assume Y
|
||||||
|
echo "APT::Get::Assume-Yes \"true\";" > /etc/apt/apt.conf.d/90assumeyes
|
||||||
|
|
||||||
|
# Use apt-fast for parallel downloads
|
||||||
|
apt-get install aria2
|
||||||
|
add-apt-repository -y ppa:apt-fast/stable
|
||||||
|
apt-get update
|
||||||
|
apt-get -y install apt-fast
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
################################################################################
|
|
||||||
## File: apt.sh
|
|
||||||
## Desc: This script contains helper functions for using dpkg and apt
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
## Use dpkg to figure out if a package has already been installed
|
|
||||||
## Example use:
|
|
||||||
## if ! IsInstalled packageName; then
|
|
||||||
## echo "packageName is not installed!"
|
|
||||||
## fi
|
|
||||||
function IsInstalled {
|
|
||||||
dpkg -S $1 &> /dev/null
|
|
||||||
}
|
|
||||||
|
|
||||||
# Configure apt to always assume Y
|
|
||||||
echo "APT::Get::Assume-Yes \"true\";" > /etc/apt/apt.conf.d/90assumeyes
|
|
||||||
|
|
||||||
# Use apt-fast for parallel downloads
|
|
||||||
apt-get install aria2
|
|
||||||
add-apt-repository -y ppa:apt-fast/stable
|
|
||||||
apt-get update
|
|
||||||
apt-get -y install apt-fast
|
|
||||||
@@ -4,7 +4,6 @@
|
|||||||
## Desc: Prepulls Docker images used in build tasks and templates
|
## Desc: Prepulls Docker images used in build tasks and templates
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
source $HELPER_SCRIPTS/apt.sh
|
|
||||||
source $HELPER_SCRIPTS/document.sh
|
source $HELPER_SCRIPTS/document.sh
|
||||||
|
|
||||||
# Check prereqs
|
# Check prereqs
|
||||||
|
|||||||
@@ -34,3 +34,12 @@ download_with_retries() {
|
|||||||
echo "Could not download $URL"
|
echo "Could not download $URL"
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
## Use dpkg to figure out if a package has already been installed
|
||||||
|
## Example use:
|
||||||
|
## if ! IsPackageInstalled packageName; then
|
||||||
|
## echo "packageName is not installed!"
|
||||||
|
## fi
|
||||||
|
function IsPackageInstalled {
|
||||||
|
dpkg -S $1 &> /dev/null
|
||||||
|
}
|
||||||
@@ -8,7 +8,6 @@ set -e
|
|||||||
|
|
||||||
# Source the helpers for use with the script
|
# Source the helpers for use with the script
|
||||||
source $HELPER_SCRIPTS/document.sh
|
source $HELPER_SCRIPTS/document.sh
|
||||||
source $HELPER_SCRIPTS/apt.sh
|
|
||||||
|
|
||||||
# Set env variable for SDK Root (https://developer.android.com/studio/command-line/variables)
|
# Set env variable for SDK Root (https://developer.android.com/studio/command-line/variables)
|
||||||
ANDROID_ROOT=/usr/local/lib/android
|
ANDROID_ROOT=/usr/local/lib/android
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ set -e
|
|||||||
|
|
||||||
# Source the helpers for use with the script
|
# Source the helpers for use with the script
|
||||||
source $HELPER_SCRIPTS/document.sh
|
source $HELPER_SCRIPTS/document.sh
|
||||||
source $HELPER_SCRIPTS/apt.sh
|
|
||||||
|
|
||||||
# Set env variable for SDK Root (https://developer.android.com/studio/command-line/variables)
|
# Set env variable for SDK Root (https://developer.android.com/studio/command-line/variables)
|
||||||
ANDROID_ROOT=/usr/local/lib/android
|
ANDROID_ROOT=/usr/local/lib/android
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
# Source the helpers for use with the script
|
# Source the helpers for use with the script
|
||||||
source $HELPER_SCRIPTS/document.sh
|
source $HELPER_SCRIPTS/document.sh
|
||||||
source $HELPER_SCRIPTS/apt.sh
|
|
||||||
|
|
||||||
# Install Alibaba Cloud CLI
|
# Install Alibaba Cloud CLI
|
||||||
URL=$(curl -s https://api.github.com/repos/aliyun/aliyun-cli/releases/latest | jq -r '.assets[].browser_download_url | select(contains("aliyun-cli-linux"))')
|
URL=$(curl -s https://api.github.com/repos/aliyun/aliyun-cli/releases/latest | jq -r '.assets[].browser_download_url | select(contains("aliyun-cli-linux"))')
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
# Source the helpers for use with the script
|
# Source the helpers for use with the script
|
||||||
source $HELPER_SCRIPTS/document.sh
|
source $HELPER_SCRIPTS/document.sh
|
||||||
source $HELPER_SCRIPTS/apt.sh
|
|
||||||
source $HELPER_SCRIPTS/os.sh
|
source $HELPER_SCRIPTS/os.sh
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|||||||
@@ -6,13 +6,13 @@
|
|||||||
|
|
||||||
# Source the helpers for use with the script
|
# Source the helpers for use with the script
|
||||||
source $HELPER_SCRIPTS/document.sh
|
source $HELPER_SCRIPTS/document.sh
|
||||||
source $HELPER_SCRIPTS/apt.sh
|
source $HELPER_SCRIPTS/install.sh
|
||||||
|
|
||||||
PACKAGE=build-essential
|
PACKAGE=build-essential
|
||||||
|
|
||||||
# Test to see if the software in question is already installed, if not install it
|
# 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"
|
echo "Checking to see if the installer script has already been run"
|
||||||
if ! IsInstalled $PACKAGE; then
|
if ! IsPackageInstalled $PACKAGE; then
|
||||||
echo "Installing $PACKAGE"
|
echo "Installing $PACKAGE"
|
||||||
apt-get install -y --no-install-recommends $PACKAGE
|
apt-get install -y --no-install-recommends $PACKAGE
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
# Source the helpers for use with the script
|
# Source the helpers for use with the script
|
||||||
source $HELPER_SCRIPTS/document.sh
|
source $HELPER_SCRIPTS/document.sh
|
||||||
source $HELPER_SCRIPTS/apt.sh
|
|
||||||
|
|
||||||
function InstallClang {
|
function InstallClang {
|
||||||
version=$1
|
version=$1
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
## Desc: Installs container tools: podman, buildah and skopeo onto the image
|
## Desc: Installs container tools: podman, buildah and skopeo onto the image
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
source $HELPER_SCRIPTS/apt.sh
|
|
||||||
source $HELPER_SCRIPTS/document.sh
|
source $HELPER_SCRIPTS/document.sh
|
||||||
|
|
||||||
source /etc/os-release
|
source /etc/os-release
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
## Desc: Installs Docker Compose
|
## Desc: Installs Docker Compose
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
source $HELPER_SCRIPTS/apt.sh
|
|
||||||
source $HELPER_SCRIPTS/document.sh
|
source $HELPER_SCRIPTS/document.sh
|
||||||
|
|
||||||
URL=$(curl -s https://api.github.com/repos/docker/compose/releases/latest | jq -r '.assets[].browser_download_url | select(contains("docker-compose-Linux-x86_64"))' | head -1)
|
URL=$(curl -s https://api.github.com/repos/docker/compose/releases/latest | jq -r '.assets[].browser_download_url | select(contains("docker-compose-Linux-x86_64"))' | head -1)
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
## Desc: Installs docker onto the image
|
## Desc: Installs docker onto the image
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
source $HELPER_SCRIPTS/apt.sh
|
|
||||||
source $HELPER_SCRIPTS/document.sh
|
source $HELPER_SCRIPTS/document.sh
|
||||||
|
source $HELPER_SCRIPTS/install.sh
|
||||||
source $HELPER_SCRIPTS/os.sh
|
source $HELPER_SCRIPTS/os.sh
|
||||||
|
|
||||||
docker_package=moby
|
docker_package=moby
|
||||||
@@ -17,7 +17,7 @@ fi
|
|||||||
|
|
||||||
## Check to see if docker is already installed
|
## Check to see if docker is already installed
|
||||||
echo "Determing if Docker ($docker_package) is installed"
|
echo "Determing if Docker ($docker_package) is installed"
|
||||||
if ! IsInstalled $docker_package; then
|
if ! IsPackageInstalled $docker_package; then
|
||||||
echo "Docker ($docker_package) was not found. Installing..."
|
echo "Docker ($docker_package) was not found. Installing..."
|
||||||
apt-get remove -y moby-engine moby-cli
|
apt-get remove -y moby-engine moby-cli
|
||||||
apt-get update
|
apt-get update
|
||||||
|
|||||||
@@ -3,9 +3,10 @@
|
|||||||
## File: dotnetcore-sdk.sh
|
## File: dotnetcore-sdk.sh
|
||||||
## Desc: Installs .NET Core SDK
|
## Desc: Installs .NET Core SDK
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
source $HELPER_SCRIPTS/etc-environment.sh
|
source $HELPER_SCRIPTS/etc-environment.sh
|
||||||
source $HELPER_SCRIPTS/apt.sh
|
|
||||||
source $HELPER_SCRIPTS/document.sh
|
source $HELPER_SCRIPTS/document.sh
|
||||||
|
source $HELPER_SCRIPTS/install.sh
|
||||||
source $HELPER_SCRIPTS/os.sh
|
source $HELPER_SCRIPTS/os.sh
|
||||||
|
|
||||||
# Ubuntu 20 doesn't support EOL versions
|
# Ubuntu 20 doesn't support EOL versions
|
||||||
@@ -43,7 +44,7 @@ export DOTNET_CLI_TELEMETRY_OPTOUT=1
|
|||||||
|
|
||||||
for latest_package in ${LATEST_DOTNET_PACKAGES[@]}; do
|
for latest_package in ${LATEST_DOTNET_PACKAGES[@]}; do
|
||||||
echo "Determing if .NET Core ($latest_package) is installed"
|
echo "Determing if .NET Core ($latest_package) is installed"
|
||||||
if ! IsInstalled $latest_package; then
|
if ! IsPackageInstalled $latest_package; 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 -y
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
# Source the helpers for use with the script
|
# Source the helpers for use with the script
|
||||||
source $HELPER_SCRIPTS/document.sh
|
source $HELPER_SCRIPTS/document.sh
|
||||||
source $HELPER_SCRIPTS/apt.sh
|
|
||||||
|
|
||||||
source_list=/etc/apt/sources.list.d/eslerlang.list
|
source_list=/etc/apt/sources.list.d/eslerlang.list
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
# Source the helpers for use with the script
|
# Source the helpers for use with the script
|
||||||
source $HELPER_SCRIPTS/document.sh
|
source $HELPER_SCRIPTS/document.sh
|
||||||
source $HELPER_SCRIPTS/apt.sh
|
|
||||||
|
|
||||||
# Test to see if the software in question is already installed, if not install it
|
# 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"
|
echo "Checking to see if the installer script has already been run"
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
# Source the helpers for use with the script
|
# Source the helpers for use with the script
|
||||||
source $HELPER_SCRIPTS/document.sh
|
source $HELPER_SCRIPTS/document.sh
|
||||||
source $HELPER_SCRIPTS/apt.sh
|
|
||||||
|
|
||||||
# Install Firefox
|
# Install Firefox
|
||||||
apt-get install -y firefox
|
apt-get install -y firefox
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
# Source the helpers for use with the script
|
# Source the helpers for use with the script
|
||||||
source $HELPER_SCRIPTS/document.sh
|
source $HELPER_SCRIPTS/document.sh
|
||||||
source $HELPER_SCRIPTS/apt.sh
|
|
||||||
|
|
||||||
# Install Heroku CLI
|
# Install Heroku CLI
|
||||||
curl https://cli-assets.heroku.com/install-ubuntu.sh | sh
|
curl https://cli-assets.heroku.com/install-ubuntu.sh | sh
|
||||||
|
|||||||
@@ -6,13 +6,13 @@
|
|||||||
|
|
||||||
# Source the helpers for use with the script
|
# Source the helpers for use with the script
|
||||||
source $HELPER_SCRIPTS/document.sh
|
source $HELPER_SCRIPTS/document.sh
|
||||||
source $HELPER_SCRIPTS/apt.sh
|
source $HELPER_SCRIPTS/install.sh
|
||||||
|
|
||||||
hhvm_package=hhvm
|
hhvm_package=hhvm
|
||||||
|
|
||||||
# Test to see if the software in question is already installed, if not install it
|
# 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"
|
echo "Checking to see if the installer script has already been run"
|
||||||
if ! IsInstalled ${hhvm_package}; then
|
if ! IsPackageInstalled ${hhvm_package}; then
|
||||||
apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xB4112585D386EB94
|
apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xB4112585D386EB94
|
||||||
add-apt-repository https://dl.hhvm.com/ubuntu
|
add-apt-repository https://dl.hhvm.com/ubuntu
|
||||||
apt-get update
|
apt-get update
|
||||||
@@ -23,7 +23,7 @@ fi
|
|||||||
|
|
||||||
# Run tests to determine that the software installed as expected
|
# Run tests to determine that the software installed as expected
|
||||||
echo "Testing to make sure that script performed as expected, and basic scenarios work"
|
echo "Testing to make sure that script performed as expected, and basic scenarios work"
|
||||||
if ! IsInstalled ${hhvm_package}; then
|
if ! IsPackageInstalled ${hhvm_package}; then
|
||||||
echo "${hhvm_package} was not installed"
|
echo "${hhvm_package} was not installed"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
# Source the helpers for use with the script
|
# Source the helpers for use with the script
|
||||||
source $HELPER_SCRIPTS/document.sh
|
source $HELPER_SCRIPTS/document.sh
|
||||||
source $HELPER_SCRIPTS/apt.sh
|
|
||||||
|
|
||||||
# Install ImageMagick
|
# Install ImageMagick
|
||||||
apt-get install -y --no-install-recommends --fix-missing \
|
apt-get install -y --no-install-recommends --fix-missing \
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
# Source the helpers for use with the script
|
# Source the helpers for use with the script
|
||||||
source $HELPER_SCRIPTS/document.sh
|
source $HELPER_SCRIPTS/document.sh
|
||||||
source $HELPER_SCRIPTS/apt.sh
|
|
||||||
|
|
||||||
## Install kubectl
|
## Install kubectl
|
||||||
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
|
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
# Source the helpers for use with the script
|
# Source the helpers for use with the script
|
||||||
source $HELPER_SCRIPTS/document.sh
|
source $HELPER_SCRIPTS/document.sh
|
||||||
source $HELPER_SCRIPTS/apt.sh
|
|
||||||
source $HELPER_SCRIPTS/os.sh
|
source $HELPER_SCRIPTS/os.sh
|
||||||
|
|
||||||
if isUbuntu16 ; then
|
if isUbuntu16 ; then
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
################################################################################
|
################################################################################
|
||||||
# Source the helpers for use with the script
|
# Source the helpers for use with the script
|
||||||
source $HELPER_SCRIPTS/document.sh
|
source $HELPER_SCRIPTS/document.sh
|
||||||
source $HELPER_SCRIPTS/apt.sh
|
|
||||||
|
|
||||||
# Install Packer
|
# Install Packer
|
||||||
PACKER_VERSION=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/packer | jq -r .current_version)
|
PACKER_VERSION=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/packer | jq -r .current_version)
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
# Source the helpers for use with the script
|
# Source the helpers for use with the script
|
||||||
source $HELPER_SCRIPTS/document.sh
|
source $HELPER_SCRIPTS/document.sh
|
||||||
source $HELPER_SCRIPTS/apt.sh
|
|
||||||
|
|
||||||
# Install Terraform
|
# Install Terraform
|
||||||
TERRAFORM_VERSION=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/terraform | jq -r .current_version)
|
TERRAFORM_VERSION=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/terraform | jq -r .current_version)
|
||||||
|
|||||||
Reference in New Issue
Block a user