Support using OS other than Debian as base for custom images

Signed-off-by: Balasankar "Balu" C <balasankar@gitlab.com>
This commit is contained in:
Balasankar "Balu" C 2022-06-15 09:51:03 +05:30
parent 703c30315e
commit 0dea43ac3b
No known key found for this signature in database
GPG key ID: B77D2E2E23735427
14 changed files with 345 additions and 226 deletions

View file

@ -3,10 +3,6 @@
set -xeuo pipefail
IFS=$'\n\t'
export DEBIAN_FRONTEND=noninteractive
apt-get update
# 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
@ -47,30 +43,48 @@ function install_debian_bullseye_deps() {
libre2-dev libevent-dev gettext rsync git-core lsb-release
}
VERSION=`cat /etc/issue | cut -d ' ' -f 3`
function prepare_debian_environment() {
export DEBIAN_FRONTEND=noninteractive
case "$VERSION" in
9)
install_debian_stretch_deps
;;
10)
install_debian_buster_deps
;;
11)
install_debian_bullseye_deps
;;
esac
apt-get update
# 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
VERSION=`cat /etc/issue | cut -d ' ' -f 3`
apt-get autoremove -yq
apt-get clean -yqq
rm -rf /var/lib/apt/lists/*
case "$VERSION" in
9)
install_debian_stretch_deps
;;
10)
install_debian_buster_deps
;;
11)
install_debian_bullseye_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() {
echo "UBI preparation scripts"
}
if [[ $1 =~ debian ]]; then
export BUILD_OS=debian
prepare_debian_environment "$@"
elif [[ $1 =~ ubi ]]; then
export BUILD_OS=ubi
prepare_ubi_environment "$@"
fi