2023-08-13 20:56:46 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
2024-04-27 10:22:53 +08:00
|
|
|
set -xeuo pipefail
|
2023-08-13 20:56:46 +08:00
|
|
|
|
|
|
|
DISTRO_ID=$(grep ^ID= /etc/os-release | cut -d= -f2- | tr -d '"')
|
|
|
|
VERSION_ID=$(grep ^VERSION_ID= /etc/os-release | cut -d= -f2- | tr -d '"')
|
2024-04-27 10:22:53 +08:00
|
|
|
[[ -v JOBS ]] || JOBS=$(nproc)
|
2023-08-13 20:56:46 +08:00
|
|
|
|
|
|
|
# install deps
|
|
|
|
default_repositories=(
|
|
|
|
deb.debian.org
|
|
|
|
security.debian.org
|
|
|
|
archive.ubuntu.com
|
|
|
|
security.ubuntu.com
|
|
|
|
ports.ubuntu.com
|
|
|
|
)
|
|
|
|
|
2024-04-27 10:22:53 +08:00
|
|
|
if [[ -v MIRROR ]]
|
2023-08-13 20:56:46 +08:00
|
|
|
then
|
|
|
|
for repo in ${default_repositories[@]}
|
|
|
|
do
|
|
|
|
[[ -f /etc/apt/sources.list ]] && sed -i "s|$repo|$MIRROR|" /etc/apt/sources.list
|
|
|
|
for file in $(ls /etc/apt/sources.list.d/)
|
|
|
|
do
|
|
|
|
# okay for both *.list and *.sources (since Debian 12)
|
|
|
|
sed -i "s|$repo|$MIRROR|" /etc/apt/sources.list.d/$file
|
|
|
|
done
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
|
|
apt update
|
2024-04-27 10:22:53 +08:00
|
|
|
apt install -y --no-install-recommends build-essential debhelper devscripts equivs
|
|
|
|
|
|
|
|
./packages/debian/builddeb.sh
|
|
|
|
|
|
|
|
file=$(ls /tmp/redpanda-cpp_*.deb)
|
|
|
|
basename=$(basename $file)
|
2023-08-13 20:56:46 +08:00
|
|
|
|
|
|
|
# copy back to host
|
2024-04-27 10:22:53 +08:00
|
|
|
mkdir -p dist
|
|
|
|
cp $file dist/${basename/.deb/.$DISTRO_ID$VERSION_ID.deb}
|