3 ARCHITECTURES
=( amd64 arm64 i386 armhf
)
4 RELEASES
=( buster bullseye bookworm sid
)
10 echo "Not enough arguments" >&2
14 # Get host architecture
15 local host_arch
="$(dpkg --print-architecture)"
16 if [ -z "${host_arch}" ]; then
17 echo "Could not discover host architecture" >&2
24 # Create some temporary directory
25 local tmp
="$(mktemp -d)"
27 # Extract the sources into it
28 mkdir
-p "${tmp}/sources"
29 tar xvfa
"${sources}" -C "${tmp}/sources"
31 # Copy the tarball under the correct Debian name
32 cp -vf "${sources}" "${tmp}/sources/${package//-/_}.orig.tar.xz"
34 # Change into temporary directory
37 # Build the package for each release
39 for release
in ${RELEASES[@]}; do
40 local chroot
="${release}-${host_arch}-sbuild"
41 if [ "${release}" = "buster" ]; then
42 local buster_backport
=( --extra-repository "deb http://deb.debian.org/debian buster-backports main" --build-dep-resolver=aspcud
)
48 # Create a chroot environment
49 if [ ! -d "/etc/sbuild/chroot/${chroot}" ]; then
50 if ! sbuild-createchroot
--arch="${host_arch}" "${release}" \
51 "${CHROOT_PATH}/${chroot}"; then
52 echo "Could not create chroot for ${release} on ${host_arch}" >&2
58 # And for each architecture we want to support
60 for arch
in ${ARCHITECTURES[@]}; do
65 cp -r "${tmp}/sources" .
67 # Run the build process
68 if ! sbuild
--dist="${release}" --host="${arch}" --source "${buster_backport[@]}" "sources/${package}"; then
69 echo "Could not build package for ${release} on ${arch}" >&2
75 rm -rf "sources/${package}"
82 rm -rf "${tmp}/sources"
87 echo " You can find your Debian packages in ${tmp}"