bmc: add cleanup blob handler
Add a cleanup blob handler, such that there is a new blob id present
named "/flash/cleanup" that will delete temporary files. This blob
handler expects a client to open/commit/close the blob. This blob
handler will delete files that are specified as temporary. The host
client may use this to clean up artifacts on verification or update
failure.
This can be extended later to handle calling a service or doing anything
else to cleanup. The cleanup handler will be added if
--enable-cleanup-delete. The recipe will automatically add this blob
handler if that configure variable is set.
Tested: Not tested on real hardware.
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I4502b2613e38f0a947d7235d084287376c6b0ce1
diff --git a/configure.ac b/configure.ac
index b0b24aa..53815f5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,6 +32,9 @@
AS_IF([test "x$enable_tests" = "xyes"], [enable_aspeed_lpc=yes])
AS_IF([test "x$enable_tests" = "xyes"], [enable_nuvoton_lpc=yes])
+# If building tests, enable building all cleanup handler options.
+AS_IF([test "x$enable_tests" = "xyes"], [enable_cleanup_delete=yes])
+
# Checks for programs.
AC_PROG_CXX
AM_PROG_AR
@@ -90,6 +93,12 @@
AX_APPEND_COMPILE_FLAGS([-DENABLE_REBOOT_UPDATE], [CXXFLAGS])
])
+# Enable the cleanup handle that deletes the temporary files.
+AC_ARG_ENABLE([cleanup-delete],
+ AS_HELP_STRING([--enable-cleanup-delete],
+ [Enable use of the delete files cleanup mechanism.]))
+AM_CONDITIONAL([BUILD_CLEANUP_DELETE], [test "x$enable_cleanup_delete" = "xyes"])
+
# Enable static layout for firmware image staging.
AC_ARG_ENABLE([static-layout],
AS_HELP_STRING([--enable-static-layout],
@@ -321,5 +330,5 @@
)
# Create configured output
-AC_CONFIG_FILES([Makefile test/Makefile tools/Makefile])
+AC_CONFIG_FILES([Makefile test/Makefile tools/Makefile cleanup/Makefile cleanup/test/Makefile])
AC_OUTPUT