#!/bin/sh
+
+# If we are triggering for just linux or linux-meta we know we have
+# just built the kernel and there is no point in repeating that
+# build, it just wastes time. (LP: #1498862)
+build_needed=0
+for trigger in ${ADT_TEST_TRIGGERS:-force}
+do
+ case "$trigger" in
+ linux/*|linux-lts-*/*|linux-meta*/*) ;;
+ *) build_needed=1 ;;
+ esac
+done
+if [ "$build_needed" -eq 0 ]; then
+ echo "rebuild: short circuiting build for '${ADT_TEST_TRIGGERS}'"
+ exit 0
+fi
+
set -e
dpkg-buildpackage -rfakeroot -us -uc -b