|
|
|
@@ -1,7 +1,9 @@
|
|
|
|
|
#!/bin/sh
|
|
|
|
|
# Сборка BIRD из официального tarball (версия задаётся BIRD_VERSION, по умолчанию 2.14).
|
|
|
|
|
# Запуск от root (Docker) или через sudo на хосте. Префикс установки: /usr/local.
|
|
|
|
|
# birdc требует ncurses + readline; в runtime-образе gobinary — libncurses6 + libreadline8.
|
|
|
|
|
# Сборка BIRD из официального tarball (BIRD_VERSION, по умолчанию 2.14).
|
|
|
|
|
# Источники: https://bird.nic.cz/get-bird/ (актуальные), https://bird.nic.cz/old-releases/ (архив).
|
|
|
|
|
# Tarball: https://bird.nic.cz/download/bird-<version>.tar.gz
|
|
|
|
|
# Запуск от root (Docker) или через sudo на хосте. Префикс: /usr/local.
|
|
|
|
|
# birdc: ncurses + readline; runtime gobinary — libreadline8 + libncurses6.
|
|
|
|
|
set -eu
|
|
|
|
|
BIRD_VERSION="${BIRD_VERSION:-2.14}"
|
|
|
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
|
|
@@ -18,14 +20,54 @@ apt-get install -y --no-install-recommends \
|
|
|
|
|
|
|
|
|
|
cd /tmp
|
|
|
|
|
rm -rf "bird-${BIRD_VERSION}"
|
|
|
|
|
curl -fsSL "https://bird.network.cz/download/bird-${BIRD_VERSION}.tar.gz" | tar xz
|
|
|
|
|
cd "bird-${BIRD_VERSION}"
|
|
|
|
|
BIRD_TARBALL="bird-${BIRD_VERSION}.tar.gz"
|
|
|
|
|
BIRD_SRC_DIR="bird-${BIRD_VERSION}"
|
|
|
|
|
BIRD_NIC_URL="https://bird.nic.cz/download/${BIRD_TARBALL}"
|
|
|
|
|
# Старые релизы (2.14 и др.) — только на old-releases; get-bird — для актуальных.
|
|
|
|
|
BIRD_REFERER="https://bird.nic.cz/old-releases/"
|
|
|
|
|
case "${BIRD_VERSION}" in
|
|
|
|
|
2.19.*|2.18.*|2.17.*|3.*) BIRD_REFERER="https://bird.nic.cz/get-bird/" ;;
|
|
|
|
|
esac
|
|
|
|
|
GITHUB_TAG_URL="https://github.com/CZ-NIC/bird/archive/refs/tags/v${BIRD_VERSION}.tar.gz"
|
|
|
|
|
|
|
|
|
|
download_bird_tarball() {
|
|
|
|
|
if curl -fsSL --retry 3 --retry-delay 2 \
|
|
|
|
|
-H "Referer: ${BIRD_REFERER}" \
|
|
|
|
|
-H "User-Agent: EvoBGP-docker-build/1.0 (+https://bird.nic.cz/get-bird/)" \
|
|
|
|
|
"${BIRD_NIC_URL}" -o "${BIRD_TARBALL}"; then
|
|
|
|
|
return 0
|
|
|
|
|
fi
|
|
|
|
|
echo "bird.nic.cz download failed, trying GitHub mirror (CZ-NIC/bird)..." >&2
|
|
|
|
|
curl -fsSL --retry 3 --retry-delay 2 \
|
|
|
|
|
-H "User-Agent: EvoBGP-docker-build/1.0" \
|
|
|
|
|
"${GITHUB_TAG_URL}" -o "${BIRD_TARBALL}"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
download_bird_tarball
|
|
|
|
|
tar xzf "${BIRD_TARBALL}"
|
|
|
|
|
rm -f "${BIRD_TARBALL}"
|
|
|
|
|
|
|
|
|
|
if [ ! -d "${BIRD_SRC_DIR}" ]; then
|
|
|
|
|
# GitHub archive: bird-2.14 → иногда bird-bird-2.14; ищем единственный каталог bird-*.
|
|
|
|
|
BIRD_SRC_DIR="$(find /tmp -maxdepth 1 -type d -name 'bird-*' | head -n 1)"
|
|
|
|
|
if [ -z "${BIRD_SRC_DIR}" ] || [ ! -d "${BIRD_SRC_DIR}" ]; then
|
|
|
|
|
echo "BIRD source directory not found after extract" >&2
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
cd "${BIRD_SRC_DIR}"
|
|
|
|
|
if [ ! -f ./configure ]; then
|
|
|
|
|
apt-get install -y --no-install-recommends autoconf automake libtool
|
|
|
|
|
autoreconf -fi
|
|
|
|
|
fi
|
|
|
|
|
./configure --prefix=/usr/local --enable-client
|
|
|
|
|
make -j"$(nproc)"
|
|
|
|
|
make install
|
|
|
|
|
cd /
|
|
|
|
|
rm -rf "/tmp/bird-${BIRD_VERSION}"
|
|
|
|
|
rm -rf "${BIRD_SRC_DIR}"
|
|
|
|
|
|
|
|
|
|
apt-get purge -y build-essential flex bison libncurses-dev libreadline-dev
|
|
|
|
|
apt-get purge -y build-essential flex bison libncurses-dev libreadline-dev autoconf automake libtool 2>/dev/null || \
|
|
|
|
|
apt-get purge -y build-essential flex bison libncurses-dev libreadline-dev
|
|
|
|
|
apt-get autoremove -y
|
|
|
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
|