package/finit: backport fixes from upstream

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2026-02-24 06:59:28 +01:00
parent f187fee89b
commit 0e21dc894b
2 changed files with 92 additions and 0 deletions
@@ -0,0 +1,31 @@
From 7090321ff3c812644507d43e1ddea25de8cff93a Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Tue, 10 Feb 2026 15:58:46 +0100
Subject: [PATCH 4/5] Don't hide cursor when shutting down
Organization: Wires
Users starting Finit based systems using U-Boot or Barebox may otherwise
not get a visible cursor at their prompt.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
src/sm.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/src/sm.c b/src/sm.c
index a1e982b..f23fa65 100644
--- a/src/sm.c
+++ b/src/sm.c
@@ -361,9 +361,6 @@ restart:
/* Restore terse mode and run hooks before shutdown */
if (runlevel == 0 || runlevel == 6) {
- /* Hide cursor, we're going down ... */
- dprint(STDOUT_FILENO, "\033[?25l", 6);
-
api_exit();
log_exit();
plugin_run_hooks(HOOK_SHUTDOWN);
--
2.43.0
@@ -0,0 +1,61 @@
From f0914f6d32b9cd055a888cf0a1c7e45dec871824 Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Tue, 10 Feb 2026 15:59:49 +0100
Subject: [PATCH 5/5] Fix 'initctl reload NAME' not updating conditions for
dependents
Organization: Wires
When reloading a specific service with 'initctl reload foo', the
pid/foo and service/foo/ready conditions were never cleared, so
dependent services were not notified of the reload.
Clear the service's pid condition and, for pid/none notify types,
the ready condition before reloading. The conditions are then
reasserted by the pidfile inotify handler when the service touches
its PID file after processing SIGHUP.
For s6/systemd services the ready condition is left intact since
their readiness notification may not re-trigger on SIGHUP.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
src/api.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/src/api.c b/src/api.c
index 381c219..8537335 100644
--- a/src/api.c
+++ b/src/api.c
@@ -112,6 +112,8 @@ static int restart(svc_t *svc, void *user_data)
static int reload(svc_t *svc, void *user_data)
{
+ char cond[MAX_COND_LEN];
+
(void)user_data;
if (!svc)
@@ -122,6 +124,20 @@ static int reload(svc_t *svc, void *user_data)
else
service_timeout_cancel(svc);
+ /*
+ * Clear conditions before reload to ensure dependent services
+ * are properly updated. The conditions are reasserted when
+ * the service touches its PID file after processing SIGHUP.
+ *
+ * Note: only clear 'ready' for services where the pidfile
+ * inotify handler reasserts it (pid/none). For s6/systemd
+ * services readiness relies on their respective notification
+ * mechanism which may not re-trigger on SIGHUP.
+ */
+ cond_clear(mkcond(svc, cond, sizeof(cond)));
+ if (svc->notify == SVC_NOTIFY_PID || svc->notify == SVC_NOTIFY_NONE)
+ service_ready(svc, 0);
+
svc_mark_dirty(svc);
service_step(svc);
--
2.43.0