diff --git a/doc/cmdline.md b/doc/cmdline.md index eb36d322..33426633 100644 --- a/doc/cmdline.md +++ b/doc/cmdline.md @@ -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=`, default: `auto`, unless built with + `configure --enable-fastboot`, in which case the default is `skip` + +* `fsck.repair=`, 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 `` 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 diff --git a/src/conf.c b/src/conf.c index 8e58ff38..da77e3b7 100644 --- a/src/conf.c +++ b/src/conf.c @@ -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 */ diff --git a/src/finit.c b/src/finit.c index ea37dd3f..1691effa 100644 --- a/src/finit.c +++ b/src/finit.c @@ -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; }