Created
August 11, 2021 16:22
-
-
Save julian-klode/473a84ddc87d2a85496c0ea98d91ede4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
. /etc/os-release | |
case "$DISTRO" in | |
*:*) | |
ID=$(echo $DISTRO | cut -f1 -d:) | |
VERSION_CODENAME=$(echo $DISTRO | cut -f2 -d:) | |
;; | |
*) | |
VERSION_CODENAME="$DISTRO" | |
;; | |
"") | |
;; | |
esac | |
tag=build-$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 | |
exec podman run --rm -itv $(realpath $PWD/..):/build $tag sh -c "cd /build/$(basename $PWD) && $*" | |
fi | |
#rm -f *-build-deps_*.deb && mk-build-deps | |
cat << EOF | podman build -v $(realpath $PWD/..):/build --tag $tag - | |
FROM $ID:$VERSION_CODENAME | |
ENV DEBIAN_FRONTEND=noninteractive | |
RUN apt update | |
RUN apt -y install eatmydata | |
RUN eatmydata apt -y dist-upgrade | |
RUN eatmydata apt -y install git-buildpackage bzr-builddeb devscripts nullmailer --no-install-recommends | |
RUN sed -i s#http://deb\.#http://cdn-aws.deb.#g /etc/apt/sources.list && apt update | |
RUN cd /build/$basedir && eatmydata apt build-dep -y ./ || dpkg --force-depends --unpack ./*-build-deps_*.deb && eatmydata apt install -fy | |
RUN eatmydata apt install python3-feedparser | |
EOF | |
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