mirror of
https://github.com/troglobit/finit.git
synced 2026-11-03 13:28:27 +00:00
Merge branch 'liuming50-introduce-two-more-config-options'
This commit is contained in:
commit
667b6ecbbd
2 files changed
+45
-3
No files matched your search
@@ -57,6 +57,14 @@ AC_ARG_ENABLE(kernel_cmdline,
|
|||||||
AS_HELP_STRING([--enable-kernel-cmdline], [Parse init args from /proc/cmdline (don't use!)]),,[
|
AS_HELP_STRING([--enable-kernel-cmdline], [Parse init args from /proc/cmdline (don't use!)]),,[
|
||||||
enable_kernel_cmdline=no])
|
enable_kernel_cmdline=no])
|
||||||
|
|
||||||
|
AC_ARG_ENABLE(fastboot,
|
||||||
|
AS_HELP_STRING([--enable-fastboot], [Skip fsck check on filesystems listed in /etc/fstab]),,[
|
||||||
|
enable_fastboot=no])
|
||||||
|
|
||||||
|
AC_ARG_ENABLE(fsckfix,
|
||||||
|
AS_HELP_STRING([--enable-fsckfix], [Run fsck fix mode (options: -yf) on filesystems listed in /etc/fstab]),,[
|
||||||
|
enable_fsckfix=no])
|
||||||
|
|
||||||
AC_ARG_ENABLE(redirect,
|
AC_ARG_ENABLE(redirect,
|
||||||
AS_HELP_STRING([--disable-redirect], [Disable redirection of service output to /dev/null]),,[
|
AS_HELP_STRING([--disable-redirect], [Disable redirection of service output to /dev/null]),,[
|
||||||
enable_redirect=yes])
|
enable_redirect=yes])
|
||||||
@@ -134,6 +142,12 @@ AS_IF([test "x$enable_auto_reload" = "xyes"], [
|
|||||||
AS_IF([test "x$enable_kernel_cmdline" = "xyes"], [
|
AS_IF([test "x$enable_kernel_cmdline" = "xyes"], [
|
||||||
AC_DEFINE(KERNEL_CMDLINE, 1, [Dumpster diving after init args from /proc/cmdline])])
|
AC_DEFINE(KERNEL_CMDLINE, 1, [Dumpster diving after init args from /proc/cmdline])])
|
||||||
|
|
||||||
|
AS_IF([test "x$enable_fastboot" = "xyes"], [
|
||||||
|
AC_DEFINE(FAST_BOOT, 1, [Skip fsck check on filesystems listed in /etc/fstab])])
|
||||||
|
|
||||||
|
AS_IF([test "x$enable_fsckfix" = "xyes"], [
|
||||||
|
AC_DEFINE(FSCK_FIX, 1, [Run fsck fix mode (options: -yf) on filesystems listed in /etc/fstab])])
|
||||||
|
|
||||||
AS_IF([test "x$enable_redirect" = "xyes"], [
|
AS_IF([test "x$enable_redirect" = "xyes"], [
|
||||||
AC_DEFINE(REDIRECT_OUTPUT, 1, [Enable redirection of service output to /dev/null])])
|
AC_DEFINE(REDIRECT_OUTPUT, 1, [Enable redirection of service output to /dev/null])])
|
||||||
|
|
||||||
|
|||||||
+31
-3
@@ -117,6 +117,7 @@ static int fsck(int pass)
|
|||||||
while ((fs = getfsent())) {
|
while ((fs = getfsent())) {
|
||||||
char cmd[80];
|
char cmd[80];
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
int fsck_rc = 0;
|
||||||
|
|
||||||
if (fs->fs_passno != pass)
|
if (fs->fs_passno != pass)
|
||||||
continue;
|
continue;
|
||||||
@@ -134,8 +135,33 @@ static int fsck(int pass)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef FSCK_FIX
|
||||||
|
snprintf(cmd, sizeof(cmd), "fsck -yf %s", fs->fs_spec);
|
||||||
|
#else
|
||||||
snprintf(cmd, sizeof(cmd), "fsck -a %s", fs->fs_spec);
|
snprintf(cmd, sizeof(cmd), "fsck -a %s", fs->fs_spec);
|
||||||
rc += run_interactive(cmd, "Checking filesystem %.13s", fs->fs_spec);
|
#endif
|
||||||
|
fsck_rc = run_interactive(cmd, "Checking filesystem %.13s", fs->fs_spec);
|
||||||
|
/*
|
||||||
|
* "failure" is defined as exiting with a return code of
|
||||||
|
* 2 or larger. A return code of 1 indicates that filesystem
|
||||||
|
* errors were corrected but that the boot may proceed.
|
||||||
|
*/
|
||||||
|
if (fsck_rc > 1) {
|
||||||
|
char *sulogin[] = {
|
||||||
|
_PATH_SULOGIN,
|
||||||
|
"sulogin",
|
||||||
|
};
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
for (i = 0; i < NELEMS(sulogin); i++) {
|
||||||
|
if (systemf(sulogin[i]))
|
||||||
|
continue;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
do_shutdown(SHUT_REBOOT);
|
||||||
|
}
|
||||||
|
rc += fsck_rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
endfsent();
|
endfsent();
|
||||||
@@ -145,14 +171,16 @@ static int fsck(int pass)
|
|||||||
|
|
||||||
static int fsck_all(void)
|
static int fsck_all(void)
|
||||||
{
|
{
|
||||||
int pass, rc = 0;
|
int rc = 0;
|
||||||
|
#ifndef FAST_BOOT
|
||||||
|
int pass;
|
||||||
|
|
||||||
for (pass = 1; pass < 10; pass++) {
|
for (pass = 1; pass < 10; pass++) {
|
||||||
rc = fsck(pass);
|
rc = fsck(pass);
|
||||||
if (rc)
|
if (rc)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user