From b9d498e01c0fe8170dbb98377d35c40df47de1c6 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Mon, 22 Mar 2021 18:57:43 +0100 Subject: [PATCH] initctl: fall back to .conf in /etc/finit.d if not in available/ For commands like `initctl show foo`, initctl looks in the available/ subdirectory for `foo.conf`. This patch adds support for falling back to return `/etc/finit.d/foo.conf` if the service doesn't exist in the `/etc/finit.d/available/` subdirectory. Static services, outside of the `enabled/` handling, live in the base dirctory and this is what you expect from the tool. "Do what I mean" Signed-off-by: Joachim Wiberg --- src/serv.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/serv.c b/src/serv.c index 6e436437..1a3732c5 100644 --- a/src/serv.c +++ b/src/serv.c @@ -177,6 +177,10 @@ static char *conf(char *path, size_t len, char *name, int creat) } else strlcat(path, name, len); + /* fall back to static service unless edit/create */ + if (!creat && !fexist(path)) + paste(path, len, FINIT_RCSD, name); + return path; }