mirror of
https://github.com/troglobit/finit.git
synced 2026-10-30 12:50:34 +00:00
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:
1 parent
7a48240856
commit
516dbcc512
5 files changed
+14
-32
No files matched your search
@@ -66,10 +66,6 @@ AC_ARG_ENABLE(logrotate,
|
|||||||
AS_HELP_STRING([--disable-logrotate], [Disable built-in rotation of /var/log/wtmp, default enabled]),,[
|
AS_HELP_STRING([--disable-logrotate], [Disable built-in rotation of /var/log/wtmp, default enabled]),,[
|
||||||
enable_logrotate=yes])
|
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
|
# Check for extra plugins to enable
|
||||||
enable_all_plugins=auto
|
enable_all_plugins=auto
|
||||||
AC_PLUGIN([alsa-utils], [no], [Save and restore ALSA sound settings using alsactl])
|
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"], [
|
AS_IF([test "x$enable_logrotate" != "xno"], [
|
||||||
AC_DEFINE(LOGROTATE_ENABLED, 1, [Enable built-in rotation of /var/log/wtmp et al.])])
|
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 ##############################################################################
|
### With features ##############################################################################
|
||||||
AS_IF([test "x$with_fifo" != "xno"], [
|
AS_IF([test "x$with_fifo" != "xno"], [
|
||||||
AS_IF([test "x$fifo" = "xyes"], [
|
AS_IF([test "x$fifo" = "xyes"], [
|
||||||
@@ -255,7 +246,6 @@ Optional features:
|
|||||||
Fallback shell........: $enable_fallback_shell
|
Fallback shell........: $enable_fallback_shell
|
||||||
Remount / RW at boot..: $enable_rw_rootfs
|
Remount / RW at boot..: $enable_rw_rootfs
|
||||||
Silent mode...........: $enable_silent
|
Silent mode...........: $enable_silent
|
||||||
Quiet mode............: $enable_quiet
|
|
||||||
Default console dev...: $console
|
Default console dev...: $console
|
||||||
Default user..........: $username
|
Default user..........: $username
|
||||||
Default hostname......: $hostname
|
Default hostname......: $hostname
|
||||||
|
|||||||
+2
-5
@@ -43,7 +43,7 @@ static int parse_conf(char *file);
|
|||||||
|
|
||||||
void conf_parse_cmdline(void)
|
void conf_parse_cmdline(void)
|
||||||
{
|
{
|
||||||
int dbg = 0, qit = 0;
|
int dbg = 0;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
fp = fopen("/proc/cmdline", "r");
|
fp = fopen("/proc/cmdline", "r");
|
||||||
@@ -57,13 +57,10 @@ void conf_parse_cmdline(void)
|
|||||||
if (strstr(line, "finit_debug") || strstr(line, "--debug"))
|
if (strstr(line, "finit_debug") || strstr(line, "--debug"))
|
||||||
dbg = 1;
|
dbg = 1;
|
||||||
|
|
||||||
if (strstr(line, "quiet"))
|
|
||||||
qit = 1;
|
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
log_init(qit, dbg);
|
log_init(dbg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert optional "[!123456789S]" string into a bitmask */
|
/* Convert optional "[!123456789S]" string into a bitmask */
|
||||||
|
|||||||
+1
-1
@@ -202,7 +202,7 @@ static void emergency_shell(void)
|
|||||||
if (pid) {
|
if (pid) {
|
||||||
waitpid(pid, NULL, 0);
|
waitpid(pid, NULL, 0);
|
||||||
fprintf(stderr, "\n=> Embarrassingly, Finit has crashed. Check /dev/kmsg for details.\n");
|
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
|
* Become session leader and set controlling TTY
|
||||||
|
|||||||
@@ -32,27 +32,22 @@
|
|||||||
|
|
||||||
static int up = 0;
|
static int up = 0;
|
||||||
static int debug = 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 silent = SILENT_MODE; /* Completely silent, including boot */
|
||||||
static int loglevel = LOG_NOTICE;
|
static int loglevel = LOG_NOTICE;
|
||||||
|
|
||||||
void log_init(int qit, int dbg)
|
void log_init(int dbg)
|
||||||
{
|
{
|
||||||
if (dbg)
|
if (dbg)
|
||||||
debug = 1;
|
debug = 1;
|
||||||
if (!dbg && qit)
|
|
||||||
quiet = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we enabled terse mode at boot, restore to previous setting at shutdown */
|
/* If we enabled terse mode at boot, restore to previous setting at shutdown */
|
||||||
void log_exit(void)
|
void log_exit(void)
|
||||||
{
|
{
|
||||||
if (quiet) {
|
silent = SILENT_MODE;
|
||||||
silent = SILENT_MODE;
|
if (!silent) {
|
||||||
if (!silent) {
|
sched_yield();
|
||||||
sched_yield();
|
fputs("\n", stderr);
|
||||||
fputs("\n", stderr);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,10 +67,10 @@ void log_open(void)
|
|||||||
|
|
||||||
void log_silent(void)
|
void log_silent(void)
|
||||||
{
|
{
|
||||||
if (quiet && !debug)
|
if (debug)
|
||||||
silent = 1;
|
|
||||||
else
|
|
||||||
silent = 0;
|
silent = 0;
|
||||||
|
else
|
||||||
|
silent = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int log_is_silent(void)
|
int log_is_silent(void)
|
||||||
@@ -89,10 +84,10 @@ void log_debug(void)
|
|||||||
debug = !debug;
|
debug = !debug;
|
||||||
|
|
||||||
if (debug) {
|
if (debug) {
|
||||||
silent = 0;
|
silent = 0;
|
||||||
loglevel = LOG_DEBUG;
|
loglevel = LOG_DEBUG;
|
||||||
} else {
|
} else {
|
||||||
silent = quiet ? 1 : SILENT_MODE;
|
silent = SILENT_MODE;
|
||||||
loglevel = LOG_NOTICE;
|
loglevel = LOG_NOTICE;
|
||||||
}
|
}
|
||||||
log_open();
|
log_open();
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
#define _e(fmt, args...) logit(LOG_ERR, "%s():" fmt "\n", __func__, ##args)
|
#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)
|
#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_exit (void);
|
||||||
|
|
||||||
void log_silent (void);
|
void log_silent (void);
|
||||||
|
|||||||
Reference in new issue
Block a user