|
|
ad10ea |
From 62cd5c826756efc3acb24267cb4271c0a615c8e9 Mon Sep 17 00:00:00 2001
|
|
|
ad10ea |
From: Ray Strode <rstrode@redhat.com>
|
|
|
ad10ea |
Date: Wed, 6 May 2020 10:32:38 -0400
|
|
|
ad10ea |
Subject: [PATCH] main: drop error spooling
|
|
|
ad10ea |
|
|
|
ad10ea |
In the olden days, the login screen contained a little system
|
|
|
ad10ea |
tray icon to show errors from boot. We ditched that years ago,
|
|
|
ad10ea |
but we still have the backend code in place for it.
|
|
|
ad10ea |
|
|
|
ad10ea |
Drop that unnecessary code.
|
|
|
ad10ea |
---
|
|
|
ad10ea |
src/Makefile.am | 1 -
|
|
|
ad10ea |
src/main.c | 53 -------------------------------------------------
|
|
|
ad10ea |
2 files changed, 54 deletions(-)
|
|
|
ad10ea |
|
|
|
ad10ea |
diff --git a/src/Makefile.am b/src/Makefile.am
|
|
|
ad10ea |
index fc2f5da..3aab240 100644
|
|
|
ad10ea |
--- a/src/Makefile.am
|
|
|
ad10ea |
+++ b/src/Makefile.am
|
|
|
ad10ea |
@@ -1,40 +1,39 @@
|
|
|
ad10ea |
SUBDIRS = libply libply-splash-core libply-splash-graphics . plugins client viewer
|
|
|
ad10ea |
if ENABLE_UPSTART_MONITORING
|
|
|
ad10ea |
SUBDIRS += upstart-bridge
|
|
|
ad10ea |
endif
|
|
|
ad10ea |
AM_CPPFLAGS = -I$(top_srcdir) \
|
|
|
ad10ea |
-I$(srcdir)/libply \
|
|
|
ad10ea |
-I$(srcdir)/libply-splash-core \
|
|
|
ad10ea |
-I$(srcdir) \
|
|
|
ad10ea |
-DPLYMOUTH_LOG_DIRECTORY=\"$(localstatedir)/log\" \
|
|
|
ad10ea |
- -DPLYMOUTH_SPOOL_DIRECTORY=\"$(localstatedir)/spool/plymouth\" \
|
|
|
ad10ea |
-DPLYMOUTH_TIME_DIRECTORY=\"$(localstatedir)/lib/plymouth/\" \
|
|
|
ad10ea |
-DPLYMOUTH_LOGO_FILE=\"$(logofile)\"
|
|
|
ad10ea |
|
|
|
ad10ea |
plymouthdbindir = $(plymouthdaemondir)
|
|
|
ad10ea |
plymouthdbin_PROGRAMS = plymouthd
|
|
|
ad10ea |
|
|
|
ad10ea |
plymouthd_CFLAGS = $(PLYMOUTH_CFLAGS) \
|
|
|
ad10ea |
-rdynamic \
|
|
|
ad10ea |
-DPLYMOUTH_PLUGIN_PATH=\"$(PLYMOUTH_PLUGIN_PATH)\" \
|
|
|
ad10ea |
-DPLYMOUTH_THEME_PATH=\"$(PLYMOUTH_THEME_PATH)/\" \
|
|
|
ad10ea |
-DPLYMOUTH_POLICY_DIR=\"$(PLYMOUTH_POLICY_DIR)/\" \
|
|
|
ad10ea |
-DPLYMOUTH_RUNTIME_DIR=\"$(PLYMOUTH_RUNTIME_DIR)\" \
|
|
|
ad10ea |
-DPLYMOUTH_CONF_DIR=\"$(PLYMOUTH_CONF_DIR)/\"
|
|
|
ad10ea |
plymouthd_LDADD = $(PLYMOUTH_LIBS) libply/libply.la libply-splash-core/libply-splash-core.la
|
|
|
ad10ea |
plymouthd_SOURCES = \
|
|
|
ad10ea |
ply-boot-protocol.h \
|
|
|
ad10ea |
ply-boot-server.h \
|
|
|
ad10ea |
ply-boot-server.c \
|
|
|
ad10ea |
plugins/splash/details/plugin.c \
|
|
|
ad10ea |
main.c
|
|
|
ad10ea |
|
|
|
ad10ea |
plymouthdrundir = $(localstatedir)/run/plymouth
|
|
|
ad10ea |
plymouthdspooldir = $(localstatedir)/spool/plymouth
|
|
|
ad10ea |
plymouthdtimedir = $(localstatedir)/lib/plymouth
|
|
|
ad10ea |
|
|
|
ad10ea |
pkgconfigdir = $(libdir)/pkgconfig
|
|
|
ad10ea |
pkgconfig_DATA = ply-splash-core.pc ply-splash-graphics.pc
|
|
|
ad10ea |
|
|
|
ad10ea |
plymouthd_defaultsdir = $(PLYMOUTH_POLICY_DIR)
|
|
|
ad10ea |
dist_plymouthd_defaults_DATA = plymouthd.defaults
|
|
|
ad10ea |
diff --git a/src/main.c b/src/main.c
|
|
|
ad10ea |
index 68c1d89..b1b8035 100644
|
|
|
ad10ea |
--- a/src/main.c
|
|
|
ad10ea |
+++ b/src/main.c
|
|
|
ad10ea |
@@ -696,151 +696,98 @@ get_cache_file_for_mode (ply_mode_t mode)
|
|
|
ad10ea |
}
|
|
|
ad10ea |
|
|
|
ad10ea |
ply_trace ("returning cache file '%s'", filename);
|
|
|
ad10ea |
return filename;
|
|
|
ad10ea |
}
|
|
|
ad10ea |
|
|
|
ad10ea |
static const char *
|
|
|
ad10ea |
get_log_file_for_mode (ply_mode_t mode)
|
|
|
ad10ea |
{
|
|
|
ad10ea |
const char *filename;
|
|
|
ad10ea |
|
|
|
ad10ea |
switch ((int)mode)
|
|
|
ad10ea |
{
|
|
|
ad10ea |
case PLY_MODE_BOOT:
|
|
|
ad10ea |
filename = PLYMOUTH_LOG_DIRECTORY "/boot.log";
|
|
|
ad10ea |
break;
|
|
|
ad10ea |
case PLY_MODE_SHUTDOWN:
|
|
|
ad10ea |
case PLY_MODE_UPDATES:
|
|
|
ad10ea |
filename = _PATH_DEVNULL;
|
|
|
ad10ea |
break;
|
|
|
ad10ea |
default:
|
|
|
ad10ea |
ply_error ("Unhandled case in %s line %d\n", __FILE__, __LINE__);
|
|
|
ad10ea |
abort ();
|
|
|
ad10ea |
break;
|
|
|
ad10ea |
}
|
|
|
ad10ea |
|
|
|
ad10ea |
ply_trace ("returning log file '%s'", filename);
|
|
|
ad10ea |
return filename;
|
|
|
ad10ea |
}
|
|
|
ad10ea |
|
|
|
ad10ea |
-static const char *
|
|
|
ad10ea |
-get_log_spool_file_for_mode (ply_mode_t mode)
|
|
|
ad10ea |
-{
|
|
|
ad10ea |
- const char *filename;
|
|
|
ad10ea |
-
|
|
|
ad10ea |
- switch ((int)mode)
|
|
|
ad10ea |
- {
|
|
|
ad10ea |
- case PLY_MODE_BOOT:
|
|
|
ad10ea |
- filename = PLYMOUTH_SPOOL_DIRECTORY "/boot.log";
|
|
|
ad10ea |
- break;
|
|
|
ad10ea |
- case PLY_MODE_SHUTDOWN:
|
|
|
ad10ea |
- case PLY_MODE_UPDATES:
|
|
|
ad10ea |
- filename = NULL;
|
|
|
ad10ea |
- break;
|
|
|
ad10ea |
- default:
|
|
|
ad10ea |
- ply_error ("Unhandled case in %s line %d\n", __FILE__, __LINE__);
|
|
|
ad10ea |
- abort ();
|
|
|
ad10ea |
- break;
|
|
|
ad10ea |
- }
|
|
|
ad10ea |
-
|
|
|
ad10ea |
- ply_trace ("returning spool file '%s'", filename);
|
|
|
ad10ea |
- return filename;
|
|
|
ad10ea |
-}
|
|
|
ad10ea |
-
|
|
|
ad10ea |
-static void
|
|
|
ad10ea |
-spool_error (state_t *state)
|
|
|
ad10ea |
-{
|
|
|
ad10ea |
- const char *logfile;
|
|
|
ad10ea |
- const char *logspool;
|
|
|
ad10ea |
-
|
|
|
ad10ea |
- ply_trace ("spooling error for viewer");
|
|
|
ad10ea |
-
|
|
|
ad10ea |
- logfile = get_log_file_for_mode (state->mode);
|
|
|
ad10ea |
- logspool = get_log_spool_file_for_mode (state->mode);
|
|
|
ad10ea |
-
|
|
|
ad10ea |
- if (logfile != NULL && logspool != NULL)
|
|
|
ad10ea |
- {
|
|
|
ad10ea |
- unlink (logspool);
|
|
|
ad10ea |
-
|
|
|
ad10ea |
- ply_create_file_link (logfile, logspool);
|
|
|
ad10ea |
- }
|
|
|
ad10ea |
-}
|
|
|
ad10ea |
-
|
|
|
ad10ea |
static void
|
|
|
ad10ea |
prepare_logging (state_t *state)
|
|
|
ad10ea |
{
|
|
|
ad10ea |
const char *logfile;
|
|
|
ad10ea |
|
|
|
ad10ea |
if (!state->system_initialized)
|
|
|
ad10ea |
{
|
|
|
ad10ea |
ply_trace ("not preparing logging yet, system not initialized");
|
|
|
ad10ea |
return;
|
|
|
ad10ea |
}
|
|
|
ad10ea |
|
|
|
ad10ea |
if (state->session == NULL)
|
|
|
ad10ea |
{
|
|
|
ad10ea |
ply_trace ("not preparing logging, no session");
|
|
|
ad10ea |
return;
|
|
|
ad10ea |
}
|
|
|
ad10ea |
|
|
|
ad10ea |
logfile = get_log_file_for_mode (state->mode);
|
|
|
ad10ea |
if (logfile != NULL)
|
|
|
ad10ea |
{
|
|
|
ad10ea |
ply_trace ("opening log '%s'", logfile);
|
|
|
ad10ea |
ply_terminal_session_open_log (state->session, logfile);
|
|
|
ad10ea |
-
|
|
|
ad10ea |
- if (state->number_of_errors > 0)
|
|
|
ad10ea |
- spool_error (state);
|
|
|
ad10ea |
}
|
|
|
ad10ea |
}
|
|
|
ad10ea |
|
|
|
ad10ea |
static void
|
|
|
ad10ea |
on_system_initialized (state_t *state)
|
|
|
ad10ea |
{
|
|
|
ad10ea |
ply_trace ("system now initialized, opening log");
|
|
|
ad10ea |
state->system_initialized = true;
|
|
|
ad10ea |
|
|
|
ad10ea |
prepare_logging (state);
|
|
|
ad10ea |
}
|
|
|
ad10ea |
|
|
|
ad10ea |
static void
|
|
|
ad10ea |
on_error (state_t *state)
|
|
|
ad10ea |
{
|
|
|
ad10ea |
ply_trace ("encountered error during boot up");
|
|
|
ad10ea |
-
|
|
|
ad10ea |
- if (state->system_initialized && state->number_of_errors == 0)
|
|
|
ad10ea |
- spool_error (state);
|
|
|
ad10ea |
- else
|
|
|
ad10ea |
- ply_trace ("not spooling because number of errors %d", state->number_of_errors);
|
|
|
ad10ea |
-
|
|
|
ad10ea |
- state->number_of_errors++;
|
|
|
ad10ea |
}
|
|
|
ad10ea |
|
|
|
ad10ea |
static bool
|
|
|
ad10ea |
plymouth_should_ignore_show_splash_calls (state_t *state)
|
|
|
ad10ea |
{
|
|
|
ad10ea |
ply_trace ("checking if plymouth should be running");
|
|
|
ad10ea |
if (state->mode != PLY_MODE_BOOT || command_line_has_argument (state->kernel_command_line, "plymouth.force-splash"))
|
|
|
ad10ea |
return false;
|
|
|
ad10ea |
|
|
|
ad10ea |
if (command_line_has_argument (state->kernel_command_line, "plymouth.ignore-show-splash"))
|
|
|
ad10ea |
return true;
|
|
|
ad10ea |
|
|
|
ad10ea |
return false;
|
|
|
ad10ea |
}
|
|
|
ad10ea |
|
|
|
ad10ea |
static bool
|
|
|
ad10ea |
sh_is_init (state_t *state)
|
|
|
ad10ea |
{
|
|
|
ad10ea |
const char *init_string;
|
|
|
ad10ea |
size_t length;
|
|
|
ad10ea |
|
|
|
ad10ea |
init_string = command_line_get_string_after_prefix (state->kernel_command_line, "init=");
|
|
|
ad10ea |
|
|
|
ad10ea |
if (init_string)
|
|
|
ad10ea |
{
|
|
|
ad10ea |
length = strcspn (init_string, " \n");
|
|
|
ad10ea |
if (length > 2 && ply_string_has_prefix (init_string + length - 2, "sh"))
|
|
|
ad10ea |
return true;
|
|
|
ad10ea |
}
|
|
|
ad10ea |
|
|
|
ad10ea |
--
|
|
|
ad10ea |
2.25.1
|
|
|
ad10ea |
|