mirror of
https://github.com/troglobit/finit.git
synced 2026-10-13 10:14:47 +00:00
Bug fix and document new include <CONF> syntax.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
773d2e65d6
commit
10386ee4de
2 files changed
+21
-12
No files matched your search
+6
-1
@@ -78,7 +78,12 @@ service [RUN_LVLS] /path/to/daemon ARGS -- Optional description
|
||||
prevent them from forking off to the background.
|
||||
|
||||
runparts <PATH>
|
||||
Call run-parts(8) on a directory other than the default /etc/finit.d
|
||||
Call run-parts(8) on a directory other than the default ``/etc/finit.d``
|
||||
|
||||
include <CONF>
|
||||
Include another configuration file, ``/etc/finit.d``, or runparts
|
||||
path is prepended to file if the file is not found or an absolute
|
||||
path is not given
|
||||
|
||||
tty [RUN_LVLS] <DEV | /bin/sh>
|
||||
Start a getty on the given TTY device, in the given runlevels. When
|
||||
|
||||
@@ -94,15 +94,9 @@ static int parse_conf(char *file)
|
||||
char *x;
|
||||
const char *err = NULL;
|
||||
|
||||
/* Assume absolute path is given ... */
|
||||
fp = fopen(file, "r");
|
||||
if (!fp) {
|
||||
/* ... if it fails, try /etc/finit.d/ as prefix */
|
||||
snprintf(line, sizeof(line), "%s/%s", rcsd, file);
|
||||
fp = fopen(file, "r");
|
||||
if (!fp)
|
||||
return 1;
|
||||
}
|
||||
if (!fp)
|
||||
return 1;
|
||||
|
||||
_d("Parse %s ...", file);
|
||||
while (!feof(fp)) {
|
||||
@@ -169,14 +163,24 @@ static int parse_conf(char *file)
|
||||
rcsd = strdup(strip_line(x));
|
||||
continue;
|
||||
}
|
||||
/* Parse any include file, use rcsd if absolute path not given. */
|
||||
/* Parse any include file, use rcsd if absolute path not given */
|
||||
if (MATCH_CMD(line, "include ", x)) {
|
||||
int result;
|
||||
char *file = strip_line(x);
|
||||
char buf[60];
|
||||
|
||||
snprintf(buf, sizeof(buf), "Loading include file %s", file);
|
||||
strlcpy(cmd, file, sizeof(cmd));
|
||||
if (!fexist(cmd)) {
|
||||
/* ... try /etc/finit.d/ as prefix */
|
||||
snprintf(cmd, sizeof(cmd), "%s/%s", rcsd, file);
|
||||
if (!fexist(cmd))
|
||||
continue;
|
||||
}
|
||||
|
||||
snprintf(buf, sizeof(buf), "Loading include file %s", cmd);
|
||||
result = parse_conf(file);
|
||||
print_desc("", buf);
|
||||
print_result(parse_conf(file));
|
||||
print_result(result);
|
||||
continue;
|
||||
}
|
||||
if (MATCH_CMD(line, "startx ", x)) {
|
||||
|
||||
Reference in new issue
Block a user