build/tools.sh
Rama master · réplica de lectura del repositorio original.
#!/usr/bin/env bash
set -euo pipefail
# Pinned tool versions, bumped by Renovate via the "# renovate:" comments.
# renovate: datasource=github-tags depName=aws/aws-cli
AWS_CLI_VERSION="2.39.7"
# renovate: datasource=github-releases depName=cli/cli
GH_CLI_VERSION="2.103.3"
# renovate: datasource=github-releases depName=git-lfs/git-lfs
GIT_LFS_VERSION="3.8.1"
# renovate: datasource=github-releases depName=PowerShell/PowerShell
PWSH_VERSION="7.6.9"
# renovate: datasource=github-releases depName=mikefarah/yq
YQ_VERSION="4.54.3"
function install_git() {
( apt-get install -y --no-install-recommends git \
|| apt-get install -t stable -y --no-install-recommends git )
}
function install_liblttng-ust() {
if [[ $(apt-cache search -n liblttng-ust0 | awk '{print $1}') == "liblttng-ust0" ]]; then
apt-get install -y --no-install-recommends liblttng-ust0
fi
if [[ $(apt-cache search -n liblttng-ust1 | awk '{print $1}') == "liblttng-ust1" ]]; then
apt-get install -y --no-install-recommends liblttng-ust1
fi
}
function install_aws-cli() {
( curl -fsSL "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m)-${AWS_CLI_VERSION}.zip" -o "awscliv2.zip" \
&& unzip -q awscliv2.zip -d /tmp/ \
&& /tmp/aws/install \
&& rm awscliv2.zip \
) \
|| pip3 install --no-cache-dir awscli
}
function install_git-lfs() {
local DPKG_ARCH
DPKG_ARCH="$(dpkg --print-architecture)"
curl -fsSL "https://github.com/git-lfs/git-lfs/releases/download/v${GIT_LFS_VERSION}/git-lfs-linux-${DPKG_ARCH}-v${GIT_LFS_VERSION}.tar.gz" -o /tmp/lfs.tar.gz
tar -xzf /tmp/lfs.tar.gz -C /tmp
"/tmp/git-lfs-${GIT_LFS_VERSION}/install.sh"
rm -rf /tmp/lfs.tar.gz "/tmp/git-lfs-${GIT_LFS_VERSION}"
}
function install_docker-cli() {
apt-get install -y docker-ce-cli --no-install-recommends --allow-unauthenticated
}
function install_docker() {
apt-get install -y docker-ce docker-ce-cli docker-buildx-plugin containerd.io docker-compose-plugin --no-install-recommends --allow-unauthenticated
echo -e '#!/bin/sh\ndocker compose --compatibility "$@"' > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
sed -i 's/ulimit -Hn/# ulimit -Hn/g' /etc/init.d/docker
}
function install_container-tools() {
( apt-get install -y --no-install-recommends podman buildah skopeo || : )
}
function install_github-cli() {
local DPKG_ARCH
DPKG_ARCH="$(dpkg --print-architecture)"
curl -fsSLo /tmp/ghcli.deb "https://github.com/cli/cli/releases/download/v${GH_CLI_VERSION}/gh_${GH_CLI_VERSION}_linux_${DPKG_ARCH}.deb"
apt-get -y install /tmp/ghcli.deb
rm /tmp/ghcli.deb
}
function install_yq() {
local DPKG_ARCH
DPKG_ARCH="$(dpkg --print-architecture)"
curl -fsSL "https://github.com/mikefarah/yq/releases/download/v${YQ_VERSION}/yq_linux_${DPKG_ARCH}.tar.gz" -o /tmp/yq.tar.gz
tar -xzf /tmp/yq.tar.gz -C /tmp
mv "/tmp/yq_linux_${DPKG_ARCH}" /usr/local/bin/yq
}
function install_powershell() {
local DPKG_ARCH
DPKG_ARCH="$(dpkg --print-architecture)"
curl -fsSL -o /tmp/powershell.tar.gz "https://github.com/PowerShell/PowerShell/releases/download/v${PWSH_VERSION}/powershell-${PWSH_VERSION}-linux-${DPKG_ARCH//amd64/x64}.tar.gz"
mkdir -p /opt/powershell
tar zxf /tmp/powershell.tar.gz -C /opt/powershell
chmod +x /opt/powershell/pwsh
ln -s /opt/powershell/pwsh /usr/bin/pwsh
}
function install_tools() {
local function_name
# shellcheck source=/dev/null
source "$(dirname "${BASH_SOURCE[0]}")/config.sh"
script_packages | while read -r package; do
function_name="install_${package}"
if declare -f "${function_name}" > /dev/null; then
"${function_name}"
else
echo "No install script found for package: ${package}"
exit 1
fi
done
}