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:
Maxim Lobanov
2020-07-13 11:36:25 +03:00
committed by GitHub
24 changed files with 30 additions and 51 deletions

View File

@@ -1,9 +1,18 @@
#!/bin/bash
export DEBIAN_FRONTEND=noninteractive
apt-get -yqq update
apt-get -yqq dist-upgrade
apt-get -yq update
apt-get -yq dist-upgrade
systemctl disable apt-daily.service
systemctl disable apt-daily.timer
systemctl disable apt-daily-upgrade.timer
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

View File

@@ -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

View File

@@ -4,7 +4,6 @@
## Desc: Prepulls Docker images used in build tasks and templates
################################################################################
source $HELPER_SCRIPTS/apt.sh
source $HELPER_SCRIPTS/document.sh
# Check prereqs

View File

@@ -33,4 +33,13 @@ download_with_retries() {
echo "Could not download $URL"
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
}

View File

@@ -8,7 +8,6 @@ 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

View File

@@ -8,7 +8,6 @@ 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

View File

@@ -6,7 +6,6 @@
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/apt.sh
# 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"))')

View File

@@ -6,7 +6,6 @@
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/apt.sh
source $HELPER_SCRIPTS/os.sh
set -e

View File

@@ -6,13 +6,13 @@
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/apt.sh
source $HELPER_SCRIPTS/install.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
if ! IsPackageInstalled $PACKAGE; then
echo "Installing $PACKAGE"
apt-get install -y --no-install-recommends $PACKAGE
else

View File

@@ -6,7 +6,6 @@
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/apt.sh
function InstallClang {
version=$1

View File

@@ -4,7 +4,6 @@
## 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

View File

@@ -4,7 +4,6 @@
## Desc: Installs Docker Compose
################################################################################
source $HELPER_SCRIPTS/apt.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)

View File

@@ -4,8 +4,8 @@
## Desc: Installs docker onto the image
################################################################################
source $HELPER_SCRIPTS/apt.sh
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/install.sh
source $HELPER_SCRIPTS/os.sh
docker_package=moby
@@ -17,7 +17,7 @@ fi
## Check to see if docker is already 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..."
apt-get remove -y moby-engine moby-cli
apt-get update

View File

@@ -3,9 +3,10 @@
## File: dotnetcore-sdk.sh
## Desc: Installs .NET Core SDK
################################################################################
source $HELPER_SCRIPTS/etc-environment.sh
source $HELPER_SCRIPTS/apt.sh
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/install.sh
source $HELPER_SCRIPTS/os.sh
# 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
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..."
apt-get install $latest_package -y
else

View File

@@ -6,7 +6,6 @@
# 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

View File

@@ -7,7 +7,6 @@
# 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"

View File

@@ -6,7 +6,6 @@
# 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

View File

@@ -6,7 +6,6 @@
# 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

View File

@@ -6,13 +6,13 @@
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/apt.sh
source $HELPER_SCRIPTS/install.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
if ! IsPackageInstalled ${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
@@ -23,7 +23,7 @@ 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
if ! IsPackageInstalled ${hhvm_package}; then
echo "${hhvm_package} was not installed"
exit 1
fi

View File

@@ -6,7 +6,6 @@
# 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 \

View File

@@ -6,7 +6,6 @@
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/apt.sh
## Install kubectl
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -

View File

@@ -6,7 +6,6 @@
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/apt.sh
source $HELPER_SCRIPTS/os.sh
if isUbuntu16 ; then

View File

@@ -5,7 +5,6 @@
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/apt.sh
# Install Packer
PACKER_VERSION=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/packer | jq -r .current_version)

View File

@@ -6,7 +6,6 @@
# 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)