mirror of
https://github.com/troglobit/finit.git
synced 2026-11-18 19:30:56 +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.
|
prevent them from forking off to the background.
|
||||||
|
|
||||||
runparts <PATH>
|
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>
|
tty [RUN_LVLS] <DEV | /bin/sh>
|
||||||
Start a getty on the given TTY device, in the given runlevels. When
|
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;
|
char *x;
|
||||||
const char *err = NULL;
|
const char *err = NULL;
|
||||||
|
|
||||||
/* Assume absolute path is given ... */
|
|
||||||
fp = fopen(file, "r");
|
fp = fopen(file, "r");
|
||||||
if (!fp) {
|
if (!fp)
|
||||||
/* ... if it fails, try /etc/finit.d/ as prefix */
|
return 1;
|
||||||
snprintf(line, sizeof(line), "%s/%s", rcsd, file);
|
|
||||||
fp = fopen(file, "r");
|
|
||||||
if (!fp)
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
_d("Parse %s ...", file);
|
_d("Parse %s ...", file);
|
||||||
while (!feof(fp)) {
|
while (!feof(fp)) {
|
||||||
@@ -169,14 +163,24 @@ static int parse_conf(char *file)
|
|||||||
rcsd = strdup(strip_line(x));
|
rcsd = strdup(strip_line(x));
|
||||||
continue;
|
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)) {
|
if (MATCH_CMD(line, "include ", x)) {
|
||||||
|
int result;
|
||||||
char *file = strip_line(x);
|
char *file = strip_line(x);
|
||||||
char buf[60];
|
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_desc("", buf);
|
||||||
print_result(parse_conf(file));
|
print_result(result);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (MATCH_CMD(line, "startx ", x)) {
|
if (MATCH_CMD(line, "startx ", x)) {
|
||||||
|
|||||||
Reference in new issue
Block a user