Skip to content

Instantly share code, notes, and snippets.

@julian-klode
Created May 4, 2026 09:10
Show Gist options
  • Select an option

  • Save julian-klode/bdf250894751ead23c570022166618a4 to your computer and use it in GitHub Desktop.

Select an option

Save julian-klode/bdf250894751ead23c570022166618a4 to your computer and use it in GitHub Desktop.
#!/bin/sh
. /etc/os-release
case "$DISTRO" in
*:*)
ID=$(echo $DISTRO | cut -f1 -d:)
VERSION_CODENAME=$(echo $DISTRO | cut -f2 -d:)
CLEAN_ID="$(echo $ID | sed s%/%-%g)"
;;
*)
VERSION_CODENAME="$DISTRO"
;;
"")
;;
esac
tag=build-$CLEAN_ID-$VERSION_CODENAME-$(awk '/^Source:/ {print $2}' debian/control)-$(grep-dctrl -sBuild-Depends,Build-Depends-Indep -F Source "" debian/control | md5sum | awk '{print $1}')
basedir=$(basename $PWD)
if podman images | grep -q $tag; then
:
else
cat << EOF | podman build $PM_ARGS -v $(realpath $PWD/..):/build --tag $tag -
FROM $ID:$VERSION_CODENAME
ENV DEBIAN_FRONTEND=noninteractive
#RUN sed /-updates/d /etc/apt/sources.list -i || sed -i 's/[^ ]*-updates//g' /etc/apt/sources.list.d/*.sources
RUN sed -i s/archive.ubuntu/de.archive.ubuntu/ \$(find /etc/apt/ -name '*.list' -o -name '*.sources')
RUN sed -i s/security.ubuntu/de.archive.ubuntu/ \$(find /etc/apt/ -name '*.list' -o -name '*.sources')
#RUN echo 'Acquire::http::proxy "http://host.containers.internal:8000";' > /etc/apt/apt.conf.d/99proxy
RUN apt update && apt -y install eatmydata && eatmydata apt -y dist-upgrade
RUN cd /build/$basedir && apt update && eatmydata apt build-dep -y ./ || ( dpkg --force-depends --unpack ./*-build-deps_*.deb && eatmydata apt install -fy python-apt-build-deps )
RUN eatmydata apt -y install python3-feedparser git-buildpackage devscripts nullmailer --no-install-recommends dgit build-essential apt-utils ccache '?exact-name(apt-btrfs-snapshot)' parsewiki python3-mock xvfb gir1.2-gtk-3.0 python3-gi '?exact-name(python3-nose)' pycodestyle
EOF
fi
podman run $PM_ARGS --rm -itv $(realpath $PWD/..):/build $tag env -C /build/$(basename $PWD) "$@"
#podman run --rm -itv $(realpath $PWD/..):/build $tag sh -c "cd /build/$(basename $PWD) && $*"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment