summaryrefslogtreecommitdiff
path: root/tools/build-debian-package.sh
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2018-10-01 20:38:44 +0200
committerDaniil Baturin <daniil@baturin.org>2018-10-01 20:44:01 +0200
commit836ad9fb4e423e1f10b22bd68154f90b1131636c (patch)
tree584f3228b2622449cf745416e4eef7d41f33045a /tools/build-debian-package.sh
parent979ee884911aeeda2b1dd0942e07d68d4b32e955 (diff)
tools: add a script for building a Debian package in one step.
The script simplifies the relatively lengthy procedure. It should be invoked from the top level source directory, for example: ./tools/build-debian-package.sh Signed-off-by: Daniil Baturin <daniil@baturin.org>
Diffstat (limited to 'tools/build-debian-package.sh')
-rwxr-xr-xtools/build-debian-package.sh40
1 files changed, 40 insertions, 0 deletions
diff --git a/tools/build-debian-package.sh b/tools/build-debian-package.sh
new file mode 100755
index 0000000000..73231f0aec
--- /dev/null
+++ b/tools/build-debian-package.sh
@@ -0,0 +1,40 @@
+#!/bin/sh
+#
+# Written by Daniil Baturin, 2018
+# This file is public domain
+
+git diff-index --quiet HEAD || echo "Warning: git working directory is not clean!"
+
+# Set the defaults
+if [ "$EXTRA_VERSION" = "" ]; then
+ EXTRA_VERSION="-MyDebPkgVersion"
+fi
+
+if [ "$WANT_SNMP" = "" ]; then
+ WANT_SNMP=0
+fi
+
+if [ "$WANT_CUMULUS_MODE" = "" ]; then
+ WANT_CUMULUS_MODE=0
+fi
+
+echo "Preparing the build"
+./bootstrap.sh
+./configure --with-pkg-extra-version=$EXTRA_VERSION
+make dist
+
+echo "Preparing Debian source package"
+mv debianpkg debian
+make -f debian/rules backports
+
+echo "Unpacking the source to frrpkg/"
+mkdir frrpkg
+cd frrpkg
+tar xf ../frr_*.orig.tar.gz
+cd frr*
+. /etc/os-release
+tar xf ../../frr_*${ID}${VERSION_ID}*.debian.tar.xz
+
+echo "Building the Debian package"
+debuild --no-lintian --set-envvar=WANT_SNMP=$WANT_SNMP --set-envvar=WANT_CUMULUS_MODE=$WANT_CUMULUS_MODE -b -uc -us
+