Remove --disable-quiet and quiet mode, default to a sane behavior

This patch is a follow-up to 1f1c2e0 which introduced the new semantics
for the very confusing quiet and silent modes.

The initial idea was to loosely follow the kernel cmdline 'quiet' option
and as a working concept this was good.  The resulting code, however,
became unnecessarily complex and the configure options impossible to
explain.

With this patch the quiet mode, and thus the --disable-quiet configure
option, is removed.  Finit now defaults to a sane behavior: services are
shown only at startup.   The --enable-silent option works like it did
before, silencing everything.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2017-07-02 13:40:54 +02:00
parent 7a48240856
commit 516dbcc512
5 changed files with 14 additions and 32 deletions
-10
View File
@@ -66,10 +66,6 @@ AC_ARG_ENABLE(logrotate,
AS_HELP_STRING([--disable-logrotate], [Disable built-in rotation of /var/log/wtmp, default enabled]),,[
enable_logrotate=yes])
AC_ARG_ENABLE(quiet,
AS_HELP_STRING([--disable-quiet], [Silent after boot, default follows kernel quiet]),,[
enable_quiet=yes])
# Check for extra plugins to enable
enable_all_plugins=auto
AC_PLUGIN([alsa-utils], [no], [Save and restore ALSA sound settings using alsactl])
@@ -159,11 +155,6 @@ AS_IF([test "x$enable_inetd" != "xno"], [
AS_IF([test "x$enable_logrotate" != "xno"], [
AC_DEFINE(LOGROTATE_ENABLED, 1, [Enable built-in rotation of /var/log/wtmp et al.])])
AS_IF([test "x$enable_quiet" != "xno"], [
AC_DEFINE(QUIET_MODE, 1, [Silent, after initial boot, no stopping/starting messages. Default: 1])
], [
AC_DEFINE(QUIET_MODE, 0, [Silent, after initial boot, no stopping/starting messages. Default: 1])])
### With features ##############################################################################
AS_IF([test "x$with_fifo" != "xno"], [
AS_IF([test "x$fifo" = "xyes"], [
@@ -255,7 +246,6 @@ Optional features:
Fallback shell........: $enable_fallback_shell
Remount / RW at boot..: $enable_rw_rootfs
Silent mode...........: $enable_silent
Quiet mode............: $enable_quiet
Default console dev...: $console
Default user..........: $username
Default hostname......: $hostname
+2 -5
View File
@@ -43,7 +43,7 @@ static int parse_conf(char *file);
void conf_parse_cmdline(void)
{
int dbg = 0, qit = 0;
int dbg = 0;
FILE *fp;
fp = fopen("/proc/cmdline", "r");
@@ -57,13 +57,10 @@ void conf_parse_cmdline(void)
if (strstr(line, "finit_debug") || strstr(line, "--debug"))
dbg = 1;
if (strstr(line, "quiet"))
qit = 1;
fclose(fp);
}
log_init(qit, dbg);
log_init(dbg);
}
/* Convert optional "[!123456789S]" string into a bitmask */
+1 -1
View File
@@ -202,7 +202,7 @@ static void emergency_shell(void)
if (pid) {
waitpid(pid, NULL, 0);
fprintf(stderr, "\n=> Embarrassingly, Finit has crashed. Check /dev/kmsg for details.\n");
fprintf(stderr, "=> For more, remove 'quiet' and add '--debug' to the kernel command line.\n\n");
fprintf(stderr, "=> To debug, add '--debug' to the kernel command line.\n\n");
/*
* Become session leader and set controlling TTY
+10 -15
View File
@@ -32,27 +32,22 @@
static int up = 0;
static int debug = 0;
static int quiet = QUIET_MODE; /* Delayed disable of silent mode. */
static int silent = SILENT_MODE; /* Completely silent, including boot */
static int loglevel = LOG_NOTICE;
void log_init(int qit, int dbg)
void log_init(int dbg)
{
if (dbg)
debug = 1;
if (!dbg && qit)
quiet = 1;
}
/* If we enabled terse mode at boot, restore to previous setting at shutdown */
void log_exit(void)
{
if (quiet) {
silent = SILENT_MODE;
if (!silent) {
sched_yield();
fputs("\n", stderr);
}
silent = SILENT_MODE;
if (!silent) {
sched_yield();
fputs("\n", stderr);
}
}
@@ -72,10 +67,10 @@ void log_open(void)
void log_silent(void)
{
if (quiet && !debug)
silent = 1;
else
if (debug)
silent = 0;
else
silent = 1;
}
int log_is_silent(void)
@@ -89,10 +84,10 @@ void log_debug(void)
debug = !debug;
if (debug) {
silent = 0;
silent = 0;
loglevel = LOG_DEBUG;
} else {
silent = quiet ? 1 : SILENT_MODE;
silent = SILENT_MODE;
loglevel = LOG_NOTICE;
}
log_open();
+1 -1
View File
@@ -40,7 +40,7 @@
#define _e(fmt, args...) logit(LOG_ERR, "%s():" fmt "\n", __func__, ##args)
#define _pe(fmt, args...) logit(LOG_ERR, "%s():" fmt ": %m\n", __func__, ##args)
void log_init (int qit, int dbg);
void log_init (int dbg);
void log_exit (void);
void log_silent (void);