mirror of
https://github.com/troglobit/finit.git
synced 2026-10-10 16:52:39 +07:00
Fix #366: document fsck.* command line options and simplify code
As pointed out in #366, the configure options --enable-fastboot and --enable-fsckfix should just alter the default values of the two fsck command line options. This commit simplifies the code and makes it possible to override using the command line regardless of the two build options. Finally, add the two command line options to doc/cmdline.md Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
@@ -12,6 +12,15 @@ The `bool` setting is one of `on, off, true false, 1, 0`.
|
||||
* `debug`: Enable kernel debug. Debug messages are printed to the
|
||||
console until Finit starts up, unless `loglevel=7` (below) is used.
|
||||
|
||||
* `fsck.mode=<auto,force,skip>`, default: `auto`, unless built with
|
||||
`configure --enable-fastboot`, in which case the default is `skip`
|
||||
|
||||
* `fsck.repair=<preen,yes,no>`, default: `preen`, unless built with
|
||||
`configure --enable-fsckfix`, in which case the default is `yes`.
|
||||
This configure option also sets `fsck.mode=force`, unless fastboot
|
||||
is selected at the same time. I.e., the `--enable-fastboot` build
|
||||
option overrides the `fsck.mode` default value.
|
||||
|
||||
* `finit.cond=foo[,bar[,baz]]`: set `<boot/foo>` condition, optionally
|
||||
multiple conditions can be set using the same option, separated with a
|
||||
comma. Alternatively, multiple `foo.cond=arg` can be given. Each will
|
||||
|
||||
+17
@@ -62,8 +62,25 @@ static TAILQ_HEAD(, env_entry) env_list = TAILQ_HEAD_INITIALIZER(env_list);
|
||||
struct rlimit initial_rlimit[RLIMIT_NLIMITS];
|
||||
struct rlimit global_rlimit[RLIMIT_NLIMITS];
|
||||
|
||||
/*
|
||||
* --enable-fastboot => fsck_mode: NULL => no fsck by default
|
||||
* --enable-fsckfix => fsck_mode: "-f" + fsck_repair: "y"
|
||||
*/
|
||||
#ifdef FSCK_FIX
|
||||
# ifdef FAST_BOOT
|
||||
char *fsck_mode = NULL;
|
||||
# else
|
||||
char *fsck_mode = "-f";
|
||||
# endif
|
||||
char *fsck_repair = "-y";
|
||||
#else
|
||||
# ifdef FAST_BOOT
|
||||
char *fsck_mode = NULL;
|
||||
# else
|
||||
char *fsck_mode = "";
|
||||
# endif
|
||||
char *fsck_repair = "-p";
|
||||
#endif
|
||||
|
||||
char cgroup_current[16]; /* cgroup.NAME sets current cgroup for a set of services */
|
||||
|
||||
|
||||
+1
-6
@@ -255,11 +255,7 @@ static int fsck(int pass)
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef FSCK_FIX
|
||||
snprintf(cmd, sizeof(cmd), "fsck -yf %s", dev);
|
||||
#else
|
||||
snprintf(cmd, sizeof(cmd), "fsck %s %s %s", fsck_mode, fsck_repair, dev);
|
||||
#endif
|
||||
dbg("Running pass %d fsck command %s", pass, cmd);
|
||||
fsck_rc = run_interactive(cmd, "Checking filesystem %s", dev);
|
||||
/*
|
||||
@@ -282,7 +278,6 @@ static int fsck(int pass)
|
||||
static int fsck_all(void)
|
||||
{
|
||||
int rc = 0;
|
||||
#ifndef FAST_BOOT
|
||||
int pass;
|
||||
|
||||
if (!fsck_mode)
|
||||
@@ -293,7 +288,7 @@ static int fsck_all(void)
|
||||
if (rc)
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user