2022-04-04 18:15:05 +08:00
|
|
|
#!/bin/bash -e
|
|
|
|
|
|
|
|
if [ ! -f debian/control ]; then
|
|
|
|
echo "Cannot find debian/control" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -n ${UID} && -n ${GID} ]]; then
|
2022-05-03 23:44:30 +08:00
|
|
|
addgroup --gid ${GID} --quiet docker-build
|
|
|
|
adduser --uid=${UID} --gid=${GID} --disabled-password --gecos '' --quiet docker-build
|
2022-04-04 18:15:05 +08:00
|
|
|
else
|
|
|
|
echo "UID/GID not set. Use docker run -e UID=$(id -u) -e GID=$(id -g)" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# install build dependencies using tmpdir to not interfer with parallel builds
|
|
|
|
topdir=$(pwd)
|
|
|
|
tmpdir=$(mktemp -d)
|
|
|
|
pushd ${tmpdir} >/dev/null
|
|
|
|
mk-build-deps --tool='apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes' --install ${topdir}/debian/control
|
|
|
|
popd >/dev/null
|
|
|
|
rm -rf ${tmpdir}
|
|
|
|
|
|
|
|
# start build
|
|
|
|
export HOME=$(echo ~docker-build)
|
|
|
|
sudo -E -u docker-build gbp buildpackage "$@"
|