diff mbox series

[06/13] Introduce entry for post-update failure scripts

Message ID 20240221082221.11997-7-stefano.babic@swupdate.org
State Accepted
Delegated to: Stefano Babic
Headers show
Series Extend Lua Environemnt and post-failure scripts | expand

Commit Message

Stefano Babic Feb. 21, 2024, 8:22 a.m. UTC
There are cases where an update fails, and some glue logic must be added
to restore the system before update has begun. To help this, introduce
FAILURE scripts, that should be called only in case an update fails (and
they are in alternative to POSTINSTALL).

Signed-off-by: Stefano Babic <stefano.babic@swupdate.org>
---
 include/handler.h | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

--
2.34.1
diff mbox series

Patch

diff --git a/include/handler.h b/include/handler.h
index 36e860b3..509a89ac 100644
--- a/include/handler.h
+++ b/include/handler.h
@@ -11,10 +11,18 @@ 
 #include <stdbool.h>

 struct img_type;
+
+/*
+ * Identify the type of a script
+ * A script can contain functions for several of these
+ * entries. For example, it can contain both a pre- and post-
+ * install functions.
+ */
 typedef enum {
 	NONE,
-	PREINSTALL,
-	POSTINSTALL
+	PREINSTALL,	/* Script runs as preinstall */
+	POSTINSTALL,	/* Script runs a postinstall */
+	POSTFAILURE	/* Script called in case update fails */
 } script_fn ;

 /*