Release new version 0.108
[grml-debootstrap.git] / tests / docker-build-deb.sh
1 #!/bin/bash
2 # SPDX-License-Identifier: GPL-2.0-or-later
3 #
4 # Build a grml-debootstrap.deb.
5 # To be run inside docker, as this script assumes it can modify the running OS.
6
7 set -eu -o pipefail
8 set -x
9
10 if [ "${1:-}" != "--autobuild" ]; then
11   echo "$0: Only intended for CI scenarios, will destroy source files and modify running OS." >&2
12   exit 1
13 fi
14 BUILD_NUMBER="${2:-}"
15 if [ -z "$BUILD_NUMBER" ]; then
16   echo "$0: missing build number in arguments" >&2
17   exit 1
18 fi
19
20 apt-get update
21 apt-get install -qq -y --no-install-recommends build-essential devscripts equivs
22
23 SOURCEDIR=$PWD
24
25 cd /tmp
26 mk-build-deps -ir -t 'apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y' "$SOURCEDIR"/debian/control
27
28 dpkg-source -b "$SOURCEDIR"
29 dpkg-source -x ./*.dsc builddir
30 cd builddir
31
32 OLD_VERSION=$(dpkg-parsechangelog -SVersion)
33
34 cat > debian/changelog <<EOT
35 grml-debootstrap (${OLD_VERSION}+autobuild${BUILD_NUMBER}) UNRELEASED; urgency=medium
36
37   * Automated Build
38
39  -- Automated Build <builder@localhost>  $(date -R)
40 EOT
41
42 dpkg-buildpackage -b --no-sign
43
44 mv ../*deb "$SOURCEDIR"/