Load plugins much earlier, for future banner plugin

This patch moves the plugin loader much earlier, making it possible to
provide a custom banner/logo in a plugin.

To facilitate this move we need to also move banner later and parsing
of the kernel cmdline earlier, right after mouting /proc.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2017-07-08 00:05:07 +02:00
parent 709e4230c8
commit 878885e2b2
2 changed files with 21 additions and 19 deletions
+20 -16
View File
@@ -223,6 +223,7 @@ static void emergency_shell(void)
int main(int argc, char* argv[])
{
int ret;
char *devfsd;
uev_ctx_t loop;
@@ -241,11 +242,6 @@ int main(int argc, char* argv[])
*/
emergency_shell();
/*
* Hello world.
*/
banner();
/*
* Initial setup of signals, ignore all until we're up.
*/
@@ -272,6 +268,25 @@ int main(int argc, char* argv[])
if (fisdir("/proc/bus/usb"))
mount("none", "/proc/bus/usb", "usbfs", 0, NULL);
/*
* Parse kernel parameters, including log_init()
*/
conf_parse_cmdline();
/*
* Load plugins early, finit.conf may contain references to
* features implemented by plugins.
*/
ret = plugin_init(&loop, PLUGIN_PATH);
/*
* Hello world.
*/
banner();
/* Show results after banner() */
print(ret, "Loading plugins");
/*
* Check file filesystems in /etc/fstab
*/
@@ -305,11 +320,6 @@ int main(int argc, char* argv[])
mount("tmpfs", "/run", "tmpfs", MS_NODEV, "mode=0755,size=10%");
umask(022);
/*
* Parse kernel parameters
*/
conf_parse_cmdline();
/*
* Populate /dev and prepare for runtime events from kernel.
*/
@@ -332,12 +342,6 @@ int main(int argc, char* argv[])
run("udevadm settle --timeout=120");
}
/*
* Load plugins first, finit.conf may contain references to
* features implemented by plugins.
*/
plugin_init(&loop, PLUGIN_PATH);
/*
* Parse /etc/finit.conf, main configuration file
*/
+1 -3
View File
@@ -322,8 +322,6 @@ static int load_plugins(char *path)
DIR *dp;
struct dirent *entry;
print_desc("Loading plugins", NULL);
dp = opendir(path);
if (!dp) {
_e("Failed, cannot open plugin directory %s: %s", path, strerror(errno));
@@ -358,7 +356,7 @@ int plugin_init(uev_ctx_t *ctx, char *path)
if (!load_plugins(path))
fail = init_plugins(ctx);
return print_result(fail);
return fail;
}
void plugin_exit(void)