systemd-units/plymouth-reboot.service
systemd-units/plymouth-start.service
systemd-units/plymouth-switch-root.service
+ systemd-units/plymouth-switch-root-initramfs.service
systemd-units/systemd-ask-password-plymouth.path
systemd-units/systemd-ask-password-plymouth.service
systemd-units/Makefile
[ -z "$PLYMOUTH_POLICYDIR" ] && PLYMOUTH_POLICYDIR="@PLYMOUTH_POLICY_DIR@"
[ -z "$PLYMOUTH_DAEMON_PATH" ] && PLYMOUTH_DAEMON_PATH="@PLYMOUTH_DAEMON_DIR@/plymouthd"
[ -z "$PLYMOUTH_CLIENT_PATH" ] && PLYMOUTH_CLIENT_PATH="@PLYMOUTH_CLIENT_DIR@/plymouth"
+[ -z "$PLYMOUTH_DRM_ESCROW_PATH" ] && PLYMOUTH_DRM_ESCROW_PATH="@PLYMOUTH_LIBEXECDIR@/plymouth/plymouth-drm-escrow"
[ -z "$SYSTEMD_UNIT_DIR" ] && SYSTEMD_UNIT_DIR="@SYSTEMD_UNIT_DIR@"
# Generic substring function. If $2 is in $1, return 0.
mkdir -p ${INITRDDIR}${PLYMOUTH_DATADIR}/plymouth/themes
inst ${PLYMOUTH_DAEMON_PATH} $INITRDDIR
inst ${PLYMOUTH_CLIENT_PATH} $INITRDDIR
+inst ${PLYMOUTH_DRM_ESCROW_PATH} $INITRDDIR
inst ${PLYMOUTH_DATADIR}/plymouth/themes/text/text.plymouth $INITRDDIR
inst ${PLYMOUTH_PLUGIN_PATH}/text.so $INITRDDIR
inst ${PLYMOUTH_DATADIR}/plymouth/themes/details/details.plymouth $INITRDDIR
-I$(srcdir)/libply \
-I$(srcdir)/libply-splash-core \
-I$(srcdir) \
+ -DPLYMOUTH_DRM_ESCROW_DIRECTORY=\"$(libexecdir)/plymouth\" \
-DPLYMOUTH_LOG_DIRECTORY=\"$(localstatedir)/log\" \
-DPLYMOUTH_SPOOL_DIRECTORY=\"$(localstatedir)/spool/plymouth\" \
-DPLYMOUTH_TIME_DIRECTORY=\"$(localstatedir)/lib/plymouth/\" \
plugins/splash/details/plugin.c \
main.c
+escrowdir = $(libexecdir)/plymouth
+escrow_PROGRAMS = plymouthd-drm-escrow
+
+plymouthd_drm_escrow_LDFLAGS = -all-static
+plymouthd_drm_escrow_SOURCES = plymouthd-drm-escrow.c
+
plymouthdrundir = $(localstatedir)/run/plymouth
plymouthdspooldir = $(localstatedir)/spool/plymouth
plymouthdtimedir = $(localstatedir)/lib/plymouth
}
/* Make the first byte in argv be '@' so that we can survive systemd's killing
- * spree when going from initrd to /, and so we stay alive all the way until
- * the power is killed at shutdown.
+ * spree when going from initrd to /
* http://www.freedesktop.org/wiki/Software/systemd/RootStorageDaemons
+ *
+ * If the system is shutting down, we let systemd slay us because otherwise we
+ * may prevent the root fs from getting remounted read-only.
*/
- argv[0][0] = '@';
+ if (state.mode != PLY_BOOT_SPLASH_MODE_SHUTDOWN &&
+ state.mode != PLY_BOOT_SPLASH_MODE_REBOOT) {
+ argv[0][0] = '@';
+ }
state.boot_server = start_boot_server (&state);
-I$(srcdir)/../../.. \
-I$(srcdir)/../.. \
-I$(srcdir)/.. \
- -I$(srcdir)
+ -I$(srcdir) \
+ -DPLYMOUTH_DRM_ESCROW_DIRECTORY=\"$(libexecdir)/plymouth\"
plugindir = $(libdir)/plymouth/renderers
plugin_LTLIBRARIES = drm.la
uint32_t is_active : 1;
uint32_t requires_explicit_flushing : 1;
uint32_t use_preferred_mode : 1;
+ uint32_t watching_for_termination : 1;
int panel_width;
int panel_height;
static void flush_head (ply_renderer_backend_t *backend,
ply_renderer_head_t *head);
+static void close_device (ply_renderer_backend_t *backend);
+
+static void watch_for_termination (ply_renderer_backend_t *backend);
+static void stop_watching_for_termination (ply_renderer_backend_t *backend);
+
/* A small helper to determine if we should try to keep the current mode
* or pick the best mode ourselves, we keep the current mode only if the
* user specified a specific mode using video= on the commandline.
flush_head (backend, head);
node = ply_list_get_next_node (backend->heads, node);
}
+
+ watch_for_termination (backend);
}
static void
ply_trace ("dropping master");
drmDropMaster (backend->device_fd);
backend->is_active = false;
+
+ stop_watching_for_termination (backend);
}
static void
}
+static void
+on_term_signal (ply_renderer_backend_t *backend)
+{
+ pid_t pid;
+
+ ply_trace ("got SIGTERM, launching drm escrow to protect splash, and dying");
+
+ pid = fork();
+
+ if (pid == 0) {
+ const char *argv[] = { PLYMOUTH_DRM_ESCROW_DIRECTORY "/plymouthd-drm-escrow", NULL };
+
+ dup (backend->device_fd);
+ execve (argv[0], (char * const *) argv, NULL);
+
+ ply_trace ("could not launch drm escrow process: %m");
+
+ _exit (1);
+ }
+
+
+ close_device (backend);
+
+ exit (0);
+}
+
+static void
+watch_for_termination (ply_renderer_backend_t *backend)
+{
+ if (backend->watching_for_termination)
+ return;
+
+ ply_trace ("watching for termination signal");
+ ply_event_loop_watch_signal (backend->loop, SIGTERM, (ply_event_handler_t) on_term_signal, backend);
+ backend->watching_for_termination = true;
+}
+
+static void
+stop_watching_for_termination (ply_renderer_backend_t *backend)
+{
+ if (!backend->watching_for_termination)
+ return;
+
+ ply_trace ("stopping watching for termination signal");
+ ply_event_loop_stop_watching_signal (backend->loop, SIGTERM);
+ backend->watching_for_termination = false;
+}
+
static bool
open_device (ply_renderer_backend_t *backend)
{
on_active_vt_changed,
backend);
+ watch_for_termination (backend);
+
return true;
}
free_heads (backend);
+ stop_watching_for_termination (backend);
+
if (backend->terminal != NULL) {
ply_terminal_stop_watching_for_active_vt_change (backend->terminal,
(ply_terminal_active_vt_changed_handler_t)
--- /dev/null
+#include <signal.h>
+#include <unistd.h>
+
+int
+main(int argc, char **argv)
+{
+ signal (SIGTERM, SIG_IGN);
+
+ /* Make the first byte in argv be '@' so that we can survive systemd's killing
+ * spree until the power is killed at shutdown.
+ * http://www.freedesktop.org/wiki/Software/systemd/RootStorageDaemons
+ */
+ argv[0][0] = '@';
+
+ while (pause());
+
+ return 0;
+}
systemd_unit_templates = \
plymouth-switch-root.service.in \
+ plymouth-switch-root-initramfs.service.in \
plymouth-start.service.in \
plymouth-read-write.service.in \
plymouth-quit.service.in \
$(LN_S) ../plymouth-quit.service && \
$(LN_S) ../plymouth-quit-wait.service)
(cd $(DESTDIR)$(SYSTEMD_UNIT_DIR)/reboot.target.wants && \
- rm -f plymouth-reboot.service && \
- $(LN_S) ../plymouth-reboot.service)
+ rm -f plymouth-reboot.service \
+ plymouth-switch-root-initramfs.service && \
+ $(LN_S) ../plymouth-reboot.service && \
+ $(LN_S) ../plymouth-switch-root-initramfs.service)
(cd $(DESTDIR)$(SYSTEMD_UNIT_DIR)/kexec.target.wants && \
rm -f plymouth-kexec.service && \
$(LN_S) ../plymouth-kexec.service)
(cd $(DESTDIR)$(SYSTEMD_UNIT_DIR)/poweroff.target.wants && \
- rm -f plymouth-poweroff.service && \
- $(LN_S) ../plymouth-poweroff.service)
+ rm -f plymouth-poweroff.service \
+ plymouth-switch-root-initramfs.service && \
+ $(LN_S) ../plymouth-poweroff.service && \
+ $(LN_S) ../plymouth-switch-root-initramf.services)
(cd $(DESTDIR)$(SYSTEMD_UNIT_DIR)/halt.target.wants && \
- rm -f plymouth-halt.service && \
- $(LN_S) ../plymouth-halt.service)
+ rm -f plymouth-halt.service \
+ plymouth-switch-root-initramfs.service && \
+ $(LN_S) ../plymouth-halt.service && \
+ $(LN_S) ../plymouth-switch-root-initramfs.service)
uninstall-hook:
(cd $(DESTDIR)$(SYSTEMD_UNIT_DIR)/initrd-switch-root.target.wants && \
(cd $(DESTDIR)$(SYSTEMD_UNIT_DIR)/multi-user.target.wants && \
rm -f plymouth-quit.service plymouth-quit-wait.service)
(cd $(DESTDIR)$(SYSTEMD_UNIT_DIR)/reboot.target.wants && \
- rm -f plymouth-reboot.service)
+ rm -f plymouth-reboot.service \
+ plymouth-switch-root-initramfs.service)
(cd $(DESTDIR)$(SYSTEMD_UNIT_DIR)/kexec.target.wants && \
rm -f plymouth-kexec.service)
(cd $(DESTDIR)$(SYSTEMD_UNIT_DIR)/poweroff.target.wants && \
- rm -f plymouth-poweroff.service)
+ rm -f plymouth-poweroff.service \
+ plymouth-switch-root-initramfs.service)
(cd $(DESTDIR)$(SYSTEMD_UNIT_DIR)/halt.target.wants && \
- rm -f plymouth-halt.service)
+ rm -f plymouth-halt.service \
+ plymouth-switch-root-initramfs.service)
rmdir --ignore-fail-on-non-empty \
$(DESTDIR)$(SYSTEMD_UNIT_DIR)/sysinit.target.wants \
$(DESTDIR)$(SYSTEMD_UNIT_DIR)/multi-user.target.wants \
[Service]
ExecStart=@PLYMOUTH_DAEMON_DIR@/plymouthd --mode=shutdown --attach-to-session
ExecStartPost=-@PLYMOUTH_CLIENT_DIR@/plymouth show-splash
+KillMode=none
Type=forking
RemainAfterExit=yes
[Service]
ExecStart=@PLYMOUTH_DAEMON_DIR@/plymouthd --mode=shutdown --attach-to-session
ExecStartPost=-@PLYMOUTH_CLIENT_DIR@/plymouth show-splash
+KillMode=none
Type=forking
RemainAfterExit=yes
[Service]
ExecStart=@PLYMOUTH_DAEMON_DIR@/plymouthd --mode=reboot --attach-to-session
ExecStartPost=-@PLYMOUTH_CLIENT_DIR@/plymouth show-splash
+KillMode=none
Type=forking
RemainAfterExit=yes
--- /dev/null
+[Unit]
+Description=Tell Plymouth To Jump To initramfs
+DefaultDependencies=no
+After=plymouth-halt.service plymouth-reboot.service plymouth-poweroff.service dracut-shutdown.service
+ConditionPathExists=/run/initramfs/bin/sh
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=-@PLYMOUTH_CLIENT_DIR@/plymouth update-root-fs --new-root-dir=/run/initramfs
+Type=oneshot
+RemainAfterExit=yes