mirror of
https://github.com/troglobit/finit.git
synced 2026-11-13 17:00:16 +00:00
Support for fsck_mode=[auto,skip,force] + fsck_repair=[preen,no,yes]
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
7af257cccf
commit
1e1b3564dd
3 files changed
+45
-1
No files matched your search
+39
@@ -62,6 +62,9 @@ static TAILQ_HEAD(, env_entry) env_list = TAILQ_HEAD_INITIALIZER(env_list);
|
|||||||
struct rlimit initial_rlimit[RLIMIT_NLIMITS];
|
struct rlimit initial_rlimit[RLIMIT_NLIMITS];
|
||||||
struct rlimit global_rlimit[RLIMIT_NLIMITS];
|
struct rlimit global_rlimit[RLIMIT_NLIMITS];
|
||||||
|
|
||||||
|
char *fsck_mode = "";
|
||||||
|
char *fsck_repair = "-p";
|
||||||
|
|
||||||
char cgroup_current[16]; /* cgroup.NAME sets current cgroup for a set of services */
|
char cgroup_current[16]; /* cgroup.NAME sets current cgroup for a set of services */
|
||||||
|
|
||||||
struct conf_change {
|
struct conf_change {
|
||||||
@@ -149,6 +152,37 @@ static void parse_finit_opts(char *opt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void parse_fsck_opts(char *opt)
|
||||||
|
{
|
||||||
|
char *arg;
|
||||||
|
|
||||||
|
arg = strchr(opt, '=');
|
||||||
|
if (arg)
|
||||||
|
*arg++ = 0;
|
||||||
|
|
||||||
|
if (string_compare(opt, "mode")) {
|
||||||
|
if (!strcmp(arg, "skip"))
|
||||||
|
fsck_mode = NULL;
|
||||||
|
if (!strcmp(arg, "auto"))
|
||||||
|
fsck_mode = "";
|
||||||
|
if (!strcmp(arg, "force"))
|
||||||
|
fsck_mode = "-f";
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string_compare(opt, "repair")) {
|
||||||
|
if (!strcmp(arg, "no"))
|
||||||
|
fsck_repair = "-n";
|
||||||
|
if (!strcmp(arg, "preen"))
|
||||||
|
fsck_repair = "-p";
|
||||||
|
if (!strcmp(arg, "yes"))
|
||||||
|
fsck_repair = "-y";
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* When runlevel (single integer) is given on the command line,
|
* When runlevel (single integer) is given on the command line,
|
||||||
* it overrides the runlevel in finit.conf and the built-in
|
* it overrides the runlevel in finit.conf and the built-in
|
||||||
@@ -183,6 +217,11 @@ static void parse_arg(char *arg)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!strncmp(arg, "fsck.", 5)) {
|
||||||
|
parse_fsck_opts(&arg[5]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (string_compare(arg, "rescue") || string_compare(arg, "recover")) {
|
if (string_compare(arg, "rescue") || string_compare(arg, "recover")) {
|
||||||
rescue = 1;
|
rescue = 1;
|
||||||
return;
|
return;
|
||||||
|
|||||||
+4
-1
@@ -259,7 +259,7 @@ static int fsck(int pass)
|
|||||||
#ifdef FSCK_FIX
|
#ifdef FSCK_FIX
|
||||||
snprintf(cmd, sizeof(cmd), "fsck -yf %s", dev);
|
snprintf(cmd, sizeof(cmd), "fsck -yf %s", dev);
|
||||||
#else
|
#else
|
||||||
snprintf(cmd, sizeof(cmd), "fsck -a %s", dev);
|
snprintf(cmd, sizeof(cmd), "fsck %s %s %s", fsck_mode, fsck_repair, dev);
|
||||||
#endif
|
#endif
|
||||||
dbg("Running pass %d fsck command %s", pass, cmd);
|
dbg("Running pass %d fsck command %s", pass, cmd);
|
||||||
fsck_rc = run_interactive(cmd, "Checking filesystem %s", dev);
|
fsck_rc = run_interactive(cmd, "Checking filesystem %s", dev);
|
||||||
@@ -286,6 +286,9 @@ static int fsck_all(void)
|
|||||||
#ifndef FAST_BOOT
|
#ifndef FAST_BOOT
|
||||||
int pass;
|
int pass;
|
||||||
|
|
||||||
|
if (!fsck_mode)
|
||||||
|
return 0;
|
||||||
|
|
||||||
for (pass = 1; pass < 10; pass++) {
|
for (pass = 1; pass < 10; pass++) {
|
||||||
rc = fsck(pass);
|
rc = fsck(pass);
|
||||||
if (rc)
|
if (rc)
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ extern char *finit_conf;
|
|||||||
extern char *finit_rcsd;
|
extern char *finit_rcsd;
|
||||||
extern svc_t *wdog;
|
extern svc_t *wdog;
|
||||||
extern int service_interval;
|
extern int service_interval;
|
||||||
|
extern char *fsck_mode;
|
||||||
|
extern char *fsck_repair;
|
||||||
|
|
||||||
int api_init (uev_ctx_t *ctx);
|
int api_init (uev_ctx_t *ctx);
|
||||||
int api_exit (void);
|
int api_exit (void);
|
||||||
|
|||||||
Reference in new issue
Block a user