gitlab-build-images/scripts/install-essentials
2024-04-09 11:21:31 +00:00

66 lines
2 KiB
Bash
Executable file

#!/bin/bash
set -xeuo pipefail
IFS=$'\n\t'
# We install `git-core` as some tooling expect `/usr/bin/git`
# other tools that rely on PATH ordering will pick a one in `/usr/local`
# if present
function install_debian_deps() {
apt-get install -y \
apt-utils build-essential ca-certificates clang cmake curl \
gettext git-core libclang-dev libcurl4-openssl-dev libevent-dev \
libffi-dev libicu-dev libjpeg-dev libkrb5-dev libncurses5-dev \
libpng-dev libpq-dev libre2-dev libreadline-dev libsqlite3-dev \
libssl-dev libxml2-dev libxslt1-dev libyaml-dev libzstd-dev \
llvm-dev locales logrotate lsb-release openssh-client pkg-config \
postgresql-client python3-docutils rsync shellcheck unzip wget \
zlib1g-dev
}
function prepare_debian_environment() {
export DEBIAN_FRONTEND=noninteractive
apt-get update
VERSION=`cat /etc/issue | cut -d ' ' -f 3`
case "$VERSION" in
11|12)
install_debian_deps;;
esac
# Set UTF-8
# http://stackoverflow.com/a/3182519/2137281
LOC=$'LC_ALL=C.UTF-8\nLANG=C.UTF-8'
echo "$LOC" > /etc/environment
cat /etc/environment
echo "C.UTF-8 UTF-8" > /etc/locale.gen
locale-gen
dpkg-reconfigure locales -f noninteractive -p critical
locale -a
apt-get autoremove -yq
apt-get clean -yqq
rm -rf /var/lib/apt/lists/*
}
function prepare_ubi_environment() {
yum update -y
yum install -by --nodocs \
autoconf clang-devel cmake gcc gcc-c++ make patch perl bzip2 \
libedit ncurses uuid libarchive curl-devel \
libicu-devel libyaml-devel libedit-devel libffi-devel libpq-devel libuuid-devel openssl-devel \
ncurses-devel pcre2-devel zlib-devel libstdc++-static \
libevent-devel redhat-lsb-core procps-ng
yum autoremove -y
yum clean -y all
}
if [[ $1 =~ debian ]]; then
prepare_debian_environment "$@"
elif [[ $1 =~ ubi ]]; then
prepare_ubi_environment "$@"
fi