mirror of
https://github.com/troglobit/finit.git
synced 2026-11-01 13:10:32 +00:00
Reserve certain configuration directives for bootstrap only
The following configuration directives, previously only allowed in /etc/finit.conf, are now also only allowed in runlevel S, i.e. at bootstrap: - host - mknod - network - runparts - runlevel This change is in preparation for allowing reload of finit.conf as well as /etc/finit.d/*.conf, which we already support. Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
f3669c7537
commit
e7cca05fe3
1 file changed
+10
-7
+10
-7
@@ -35,6 +35,7 @@
|
|||||||
#include "tty.h"
|
#include "tty.h"
|
||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
|
|
||||||
|
#define BOOTSTRAP (runlevel == 0)
|
||||||
#define MATCH_CMD(l, c, x) \
|
#define MATCH_CMD(l, c, x) \
|
||||||
(!strncasecmp(l, c, strlen(c)) && (x = (l) + strlen(c)))
|
(!strncasecmp(l, c, strlen(c)) && (x = (l) + strlen(c)))
|
||||||
|
|
||||||
@@ -242,13 +243,13 @@ static void parse_static(char *line)
|
|||||||
char *x;
|
char *x;
|
||||||
char cmd[CMD_SIZE];
|
char cmd[CMD_SIZE];
|
||||||
|
|
||||||
if (MATCH_CMD(line, "host ", x)) {
|
if (BOOTSTRAP && MATCH_CMD(line, "host ", x)) {
|
||||||
if (hostname) free(hostname);
|
if (hostname) free(hostname);
|
||||||
hostname = strdup(strip_line(x));
|
hostname = strdup(strip_line(x));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MATCH_CMD(line, "mknod ", x)) {
|
if (BOOTSTRAP && MATCH_CMD(line, "mknod ", x)) {
|
||||||
char *dev = strip_line(x);
|
char *dev = strip_line(x);
|
||||||
|
|
||||||
strcpy(cmd, "mknod ");
|
strcpy(cmd, "mknod ");
|
||||||
@@ -258,13 +259,13 @@ static void parse_static(char *line)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MATCH_CMD(line, "network ", x)) {
|
if (BOOTSTRAP && MATCH_CMD(line, "network ", x)) {
|
||||||
if (network) free(network);
|
if (network) free(network);
|
||||||
network = strdup(strip_line(x));
|
network = strdup(strip_line(x));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MATCH_CMD(line, "runparts ", x)) {
|
if (BOOTSTRAP && MATCH_CMD(line, "runparts ", x)) {
|
||||||
if (runparts) free(runparts);
|
if (runparts) free(runparts);
|
||||||
runparts = strdup(strip_line(x));
|
runparts = strdup(strip_line(x));
|
||||||
return;
|
return;
|
||||||
@@ -289,10 +290,12 @@ static void parse_static(char *line)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The desired runlevel to start when leaving bootstrap (S).
|
/*
|
||||||
|
* The desired runlevel to start when leaving bootstrap (S).
|
||||||
* Finit supports 1-9, but most systems only use 1-6, where
|
* Finit supports 1-9, but most systems only use 1-6, where
|
||||||
* 6 is reserved for reboot */
|
* 6 is reserved for reboot and 0 for halt/poweroff.
|
||||||
if (MATCH_CMD(line, "runlevel ", x)) {
|
*/
|
||||||
|
if (BOOTSTRAP && MATCH_CMD(line, "runlevel ", x)) {
|
||||||
char *token = strip_line(x);
|
char *token = strip_line(x);
|
||||||
const char *err = NULL;
|
const char *err = NULL;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user