Refactor: Cleanup and expand client code to support <version|q|reload|debug>

Further refactoring of the client code.  Supported commands:

- debug:   Toggle PID 1 debug flag
- version: Show Finit version or custom header string
- reload:  Reload config files in /etc/finit.d/, same as SIGHUP

Also supported is the legacy 'init q' command, to reload config.

The 'status' command now supports an optiona '-v', either as an
argument to init itself, or as argument to the command.  When it
is given 'status' lists verbose information about all services.
Currently only the service arguments are listed.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2015-06-07 12:11:07 +02:00
1 parent 811bd75eab
commit 2026486fda
9 files changed
+233 -145

No files matched your search

-28
View File
@@ -52,34 +52,6 @@ char *console = NULL;
uev_ctx_t *ctx = NULL; /* Main loop context */
static void parse_kernel_cmdline(void)
{
FILE *fp;
char line[LINE_SIZE];
if ((fp = fopen("/proc/cmdline", "r")) != NULL) {
fgets(line, sizeof(line), fp);
_d("Kernel command line: %s", line);
if (strstr(line, "finit_debug") || strstr(line, "--debug"))
debug = 1;
if (!debug && strstr(line, "quiet"))
verbose = 0;
fclose(fp);
}
}
static void banner(void)
{
delline();
#ifdef INIT_HEADING
echo("%s", INIT_HEADING);
#else
echo("Finit version " VERSION " (" WHOAMI ") " __DATE__ " " __TIME__);
#endif
}
int main(int argc, char* argv[])
{