gbmc-bridge: Add invariant to guarantee RWFS is clear

This ensures that skipping powercycles or future rm calls causes the
netboot to fail out.

Change-Id: I70ae860fbbf5996e3476700bf8c0cb0c3a9030b5
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/recipes-google/networking/gbmc-bridge/49-purge-rwfs.sh b/recipes-google/networking/gbmc-bridge/49-purge-rwfs.sh
index 247f9ed..5c2232e 100644
--- a/recipes-google/networking/gbmc-bridge/49-purge-rwfs.sh
+++ b/recipes-google/networking/gbmc-bridge/49-purge-rwfs.sh
@@ -16,6 +16,9 @@
 [ -z "${gbmc_purge_rwfs-}" ] || return
 
 gbmc_purge_rwfs_hook() {
+  # Ensure that we don't succeed unless it clears
+  GBMC_BR_DHCP_OUTSTANDING[gbmc_purge_rwfs]=1
+
   # Only execute this hook if we aren't already purged
   if [ -e '/run/initramfs/rwfs-purged' ]; then
     echo 'RWFS already purged' >&2
diff --git a/recipes-google/networking/gbmc-bridge/51-clear-purge-rwfs.sh b/recipes-google/networking/gbmc-bridge/51-clear-purge-rwfs.sh
index 198af89..4f65919 100644
--- a/recipes-google/networking/gbmc-bridge/51-clear-purge-rwfs.sh
+++ b/recipes-google/networking/gbmc-bridge/51-clear-purge-rwfs.sh
@@ -17,6 +17,7 @@
 
 gbmc_clear_purge_rwfs_hook() {
   rm -f /run/initramfs/rwfs-purged
+  unset GBMC_BR_DHCP_OUTSTANDING[gbmc_purge_rwfs]
 }
 
 GBMC_BR_DHCP_HOOKS+=(gbmc_clear_purge_rwfs_hook)