chroot_version_hooks.d: cleanout old binhosts from sysroots

BUG=chromium:965244
TEST=run_chroot_version_hooks

Change-Id: I15efcadbccf9a9136b4e9e5e9a598100f37bb105
Reviewed-on: https://chromium-review.googlesource.com/1835660
Tested-by: Alex Klein <saklein@chromium.org>
Commit-Ready: Alex Klein <saklein@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
diff --git a/chroot_version_hooks.d/169_deleted_binhosts_cleanup b/chroot_version_hooks.d/169_deleted_binhosts_cleanup
new file mode 100644
index 0000000..a8097cd
--- /dev/null
+++ b/chroot_version_hooks.d/169_deleted_binhosts_cleanup
@@ -0,0 +1,18 @@
+# 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 clean out
+# old binhosts. crbug.com/965244
+
+for board_root in /build/*; do
+  board_name=${board_root##*/}
+  if [[ -e "/build/${board_name}/etc/make.conf.board" ]]; then
+    /mnt/host/source/chromite/bin/setup_board \
+        --board=${board_name} \
+        --skip-board-pkg-init \
+        --skip-chroot-upgrade \
+        --regen-configs &
+  fi
+done
+wait