From a7c0b42965a991789c5d7c5d2e753b95ca8e9d13 Mon Sep 17 00:00:00 2001 From: Ming Liu Date: Thu, 9 Sep 2021 15:23:56 +0200 Subject: [PATCH 1/2] configure.ac: add fastboo/fsckfix to config summary output Signed-off-by: Ming Liu --- configure.ac | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure.ac b/configure.ac index fe60287b..f27a9066 100644 --- a/configure.ac +++ b/configure.ac @@ -269,6 +269,8 @@ Optional features: Built-in keventd......: $with_keventd Built-in watchdogd....: $with_watchdog $watchdog Built-in logrotate....: $enable_logrotate + Skip fsck check.......: $enable_fastboot + Run fsck fix mode.....: $enable_fsckfix Redirect output.......: $enable_redirect Default hostname......: $hostname Default runlevel......: $runlevel From 6728b77aca45db6c4c4879ec23b17eedd38d9e27 Mon Sep 17 00:00:00 2001 From: Ming Liu Date: Fri, 17 Sep 2021 13:10:01 +0200 Subject: [PATCH 2/2] Dont hard-code nologin file It's configurable in /etc/login.defs as NOLOGINS_FILE, avoid to hard coding it here, introduce a macro FINIT_NOLOGIN_PATH instead which is configurable from compiler flags, it's not defined, then back to _PATH_NOLOGIN from /usr/include/paths.h. Signed-off-by: Ming Liu --- src/sm.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/sm.c b/src/sm.c index 54d470d2..76ab70dc 100644 --- a/src/sm.c +++ b/src/sm.c @@ -23,6 +23,7 @@ #include "config.h" /* Generated by configure script */ +#include #include #include "finit.h" @@ -38,6 +39,10 @@ sm_t sm; +#ifndef FINIT_NOLOGIN_PATH +#define FINIT_NOLOGIN_PATH _PATH_NOLOGIN /* Stop user logging in. */ +#endif + void sm_init(sm_t *sm) { sm->state = SM_BOOTSTRAP_STATE; @@ -76,16 +81,16 @@ static char *sm_status(sm_state_t state) * Disable login in single user mode and shutdown/reboot * * Re-enable only when going from these runlevels, this way a user can - * manage /etc/nologin manually within the other runlevels without us - * pulling the rug from under their feet. + * manage FINIT_NOLOGIN_PATH manually within the other runlevels without + * us pulling the rug from under their feet. */ static void nologin(void) { if (runlevel == 1 || runlevel == 0 || runlevel == 6) - touch("/etc/nologin"); + touch(FINIT_NOLOGIN_PATH); if (prevlevel == 1 || prevlevel == 0 || prevlevel == 6) - erase("/etc/nologin"); + erase(FINIT_NOLOGIN_PATH); } void sm_set_runlevel(sm_t *sm, int newlevel)