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 <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2021-03-22 18:57:43 +01:00
parent a1e38a3e40
commit b9d498e01c
+4
View File
@@ -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;
}