#!/usr/bin/env bash set -euo pipefail source "$(cd "$(dirname "$0")/.." && pwd)/lib/common.sh" export DEBIAN_FRONTEND=noninteractive distribution_id="$(detect_debian_distribution_id)" distribution_codename="$(detect_debian_distribution)" metadata_file="$(ci_metadata_file)" refresh_package_indexes=false log "Bootstrapping APT packages for $distribution_id:$distribution_codename" printf 'Acquire::http::Proxy "http://cbrapt01.lan.cyber.gent:3142";\n' >/etc/apt/apt.conf.d/80proxy apt-get update apt-get install -y --no-install-recommends \ ca-certificates \ curl \ git update-ca-certificates bash ./scripts/ci/preflight-package.sh if [[ -f "$metadata_file" ]]; then set -a # shellcheck disable=SC1090 . "$metadata_file" set +a if [[ "${SKIP_PACKAGE_BUILD:-false}" == "true" ]]; then log "Skipping package bootstrap because the package already exists in Gitea" exit 0 fi fi apt-get upgrade -y apt-get install -y --no-install-recommends build-essential case "$distribution_id" in ubuntu) apt-get install -y --no-install-recommends software-properties-common if ! grep -RqsE '(^|[[:space:]])universe([[:space:]]|$)' /etc/apt/sources.list /etc/apt/sources.list.d 2>/dev/null; then add-apt-repository -y universe refresh_package_indexes=true fi ;; debian) ;; *) die "Unsupported distribution ID: $distribution_id" ;; esac if [[ "$refresh_package_indexes" == true ]]; then apt-get update fi apt-get install -y --no-install-recommends \ autoconf \ automake \ cmake \ flex \ gawk \ gnupg \ libbz2-dev \ libcap2-bin \ libltdl-dev \ libtool-bin \ m4 \ ncat \ regina-rexx \ reprepro \ sudo \ time \ wget \ zlib1g-dev update-ca-certificates