chroot_version_hooks: Add version hook to regenerate board configs

This hook tests for the existence of make.conf.board to avoid running
commands against extraneous directories that may be in /build, such as
/build/bin.

TEST=./update_chroot
BUG=chromium:898996
CQ-DEPEND=CL:1476151, CL:1471347, CL:1476038
Change-Id: I516006c1627574b03d886c5e46271283d3896d3e
Reviewed-on: https://chromium-review.googlesource.com/1474582
Commit-Ready: Chris McDonald <cjmcdonald@chromium.org>
Tested-by: Chris McDonald <cjmcdonald@chromium.org>
Reviewed-by: Ned Nguyen <nednguyen@google.com>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
diff --git a/chroot_version_hooks.d/163_use_postsubmit_binpkgs b/chroot_version_hooks.d/163_use_postsubmit_binpkgs
new file mode 100644
index 0000000..b605488
--- /dev/null
+++ b/chroot_version_hooks.d/163_use_postsubmit_binpkgs
@@ -0,0 +1,19 @@
+# Copyright 2019 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Force regeneration of every board configuration in order to include the
+# postsubmit builders as binpkg sources.
+# crbug.com/898996
+
+for board_root in /build/*; do
+  board_name=${board_root##*/}
+  if [[ -e "/build/${board_name}/etc/make.conf.board" ]]; then
+    ~/trunk/src/scripts/setup_board \
+        --board=${board_name} \
+        --skip_board_pkg_init \
+        --skip_chroot_upgrade \
+        --regen_configs &
+  fi
+done
+wait