Hi Stefano,
> Then how do you explain that it is called sometimes ?
I don't understand what you are refering to with this question, unfortunately.
> In fact, behavior is not consistent. The postupdate was introduced for
> the integrated Webserver, and then extended to other parts (the local),
> but not to any subsystem.
>
> However, the way a client (local, suricatta, Webserver) is asking to run
> the command is different. The client send an ipc command to the core,
> see ipc_postupdate() in code. And this is not called by suricatta code.
I had a look at the server_hawbit.c and server_general.c now and indeed, the
ipc_postupdate() is missing at the cleanup in the server_general.c. Here's a
suggestion for fixing this:
From ce291ec4fca1fc951a01880f88a5dc5470948f82 Mon Sep 17 00:00:00 2001
From: Adrian Winterstein <
adr...@winterstein.biz>
Date: Wed, 2 Apr 2025 18:19:56 +0200
Subject: [PATCH] suricatta: add missing postupdate call
---
suricatta/server_general.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/suricatta/server_general.c b/suricatta/server_general.c
index f106bce1..45b439eb 100644
--- a/suricatta/server_general.c
+++ b/suricatta/server_general.c
@@ -573,6 +573,19 @@ cleanup:
free(server_general.cached_file);
server_general.cached_file = NULL;
}
+
+ if (result == SERVER_OK) {
+ INFO("Update successful, executing post-update actions.");
+ ipc_message msg;
+ memset(&msg, 0, sizeof(msg));
+ if (ipc_postupdate(&msg) != 0) {
+ result = SERVER_EERR;
+ } else {
+ result = msg.type == ACK ? SERVER_OK : SERVER_EERR;
+ DEBUG("%s", msg.data.msg);
+ }
+ }
+
return result;
}
--
2.49.0
The relevant log output when executing with this patch looks like this (the post update command is executed):
[INFO ] : SWUPDATE running : Installation in progress
[TRACE] : SWUPDATE running : [install_single_image] : Found installer for stream core-image-base-raspberrypi0-2w-64.rootfs.ext4.gz raw
[INFO ] : SWUPDATE successful ! SWUPDATE successful !
[TRACE] : SWUPDATE running : [network_initializer] : Main thread sleep again !
[INFO ] : No SWUPDATE running : Waiting for requests...
[INFO ] : SWUPDATE running : [server_install_update] : Update successful, executing post-update actions.
[DEBUG] : SWUPDATE running : [postupdate] : Running Post-update command
[TRACE] : SWUPDATE running : [read_lines_notify] : Test command output
[TRACE] : SWUPDATE running : [__run_cmd] : '/home/root/test.sh' command returned 0
[DEBUG] : SWUPDATE running : [server_install_update] : Post-update actions successfully executed.
Best,
Adrian Winterstein