teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone

Blame 0040-units-make-ExecStopPost-action-part-of-ExecStart.patch

Zbigniew Jędrzejewski-Szmek 43ff24
From 7a4ab10135c2b8fdeedb53c0585c67a0d6448ce6 Mon Sep 17 00:00:00 2001
Zbigniew Jędrzejewski-Szmek 43ff24
From: Michal Sekletar <msekleta@redhat.com>
Zbigniew Jędrzejewski-Szmek 43ff24
Date: Tue, 8 Jul 2014 17:42:23 +0200
Zbigniew Jędrzejewski-Szmek 43ff24
Subject: [PATCH] units: make ExecStopPost action part of ExecStart
Zbigniew Jędrzejewski-Szmek 43ff24
Zbigniew Jędrzejewski-Szmek 43ff24
Currently after exiting rescue shell we isolate default target. User
Zbigniew Jędrzejewski-Szmek 43ff24
might want to isolate to some other target than default one. However
Zbigniew Jędrzejewski-Szmek 43ff24
issuing systemctl isolate command to desired target would bring system
Zbigniew Jędrzejewski-Szmek 43ff24
to default target as a consequence of running ExecStopPost action.
Zbigniew Jędrzejewski-Szmek 43ff24
Zbigniew Jędrzejewski-Szmek 43ff24
Having common ancestor for rescue shell and possible followup systemctl
Zbigniew Jędrzejewski-Szmek 43ff24
default command should fix this. If user exits rescue shell we will
Zbigniew Jędrzejewski-Szmek 43ff24
proceed with isolating default target, otherwise, on manual isolate,
Zbigniew Jędrzejewski-Szmek 43ff24
parent shell process is terminated and we don't isolate default target,
Zbigniew Jędrzejewski-Szmek 43ff24
but target chosen by user.
Zbigniew Jędrzejewski-Szmek 43ff24
Zbigniew Jędrzejewski-Szmek 43ff24
Suggested-by: Michal Schmidt <mschmidt@redhat.com>
Zbigniew Jędrzejewski-Szmek 43ff24
(cherry picked from commit d3381512282f2ca1c7669f77fb736a90fdce6982)
Zbigniew Jędrzejewski-Szmek 43ff24
---
Zbigniew Jędrzejewski-Szmek 43ff24
 units/emergency.service.in | 3 +--
Zbigniew Jędrzejewski-Szmek 43ff24
 units/rescue.service.m4.in | 3 +--
Zbigniew Jędrzejewski-Szmek 43ff24
 2 files changed, 2 insertions(+), 4 deletions(-)
Zbigniew Jędrzejewski-Szmek 43ff24
Zbigniew Jędrzejewski-Szmek 43ff24
diff --git a/units/emergency.service.in b/units/emergency.service.in
Zbigniew Jędrzejewski-Szmek 43ff24
index 94c090f654..91fc1bbf51 100644
Zbigniew Jędrzejewski-Szmek 43ff24
--- a/units/emergency.service.in
Zbigniew Jędrzejewski-Szmek 43ff24
+++ b/units/emergency.service.in
Zbigniew Jędrzejewski-Szmek 43ff24
@@ -17,8 +17,7 @@ Environment=HOME=/root
Zbigniew Jędrzejewski-Szmek 43ff24
 WorkingDirectory=/root
Zbigniew Jędrzejewski-Szmek 43ff24
 ExecStartPre=-/bin/plymouth quit
Zbigniew Jędrzejewski-Szmek 43ff24
 ExecStartPre=-/bin/echo -e 'Welcome to emergency mode! After logging in, type "journalctl -xb" to view\\nsystem logs, "systemctl reboot" to reboot, "systemctl default" to try again\\nto boot into default mode.'
Zbigniew Jędrzejewski-Szmek 43ff24
-ExecStart=-/sbin/sulogin
Zbigniew Jędrzejewski-Szmek 43ff24
-ExecStopPost=@SYSTEMCTL@ --fail --no-block default
Zbigniew Jędrzejewski-Szmek 43ff24
+ExecStart=-/bin/sh -c "/sbin/sulogin; @SYSTEMCTL@ --fail --no-block default"
Zbigniew Jędrzejewski-Szmek 43ff24
 Type=idle
Zbigniew Jędrzejewski-Szmek 43ff24
 StandardInput=tty-force
Zbigniew Jędrzejewski-Szmek 43ff24
 StandardOutput=inherit
Zbigniew Jędrzejewski-Szmek 43ff24
diff --git a/units/rescue.service.m4.in b/units/rescue.service.m4.in
Zbigniew Jędrzejewski-Szmek 43ff24
index 552ef8981b..ef5436960f 100644
Zbigniew Jędrzejewski-Szmek 43ff24
--- a/units/rescue.service.m4.in
Zbigniew Jędrzejewski-Szmek 43ff24
+++ b/units/rescue.service.m4.in
Zbigniew Jędrzejewski-Szmek 43ff24
@@ -18,8 +18,7 @@ Environment=HOME=/root
Zbigniew Jędrzejewski-Szmek 43ff24
 WorkingDirectory=/root
Zbigniew Jędrzejewski-Szmek 43ff24
 ExecStartPre=-/bin/plymouth quit
Zbigniew Jędrzejewski-Szmek 43ff24
 ExecStartPre=-/bin/echo -e 'Welcome to rescue mode! Type "systemctl default" or ^D to enter default mode.\\nType "journalctl -xb" to view system logs. Type "systemctl reboot" to reboot.'
Zbigniew Jędrzejewski-Szmek 43ff24
-ExecStart=-/sbin/sulogin
Zbigniew Jędrzejewski-Szmek 43ff24
-ExecStopPost=-@SYSTEMCTL@ --fail --no-block default
Zbigniew Jędrzejewski-Szmek 43ff24
+ExecStart=-/bin/sh -c "/sbin/sulogin; @SYSTEMCTL@ --fail --no-block default"
Zbigniew Jędrzejewski-Szmek 43ff24
 Type=idle
Zbigniew Jędrzejewski-Szmek 43ff24
 StandardInput=tty-force
Zbigniew Jędrzejewski-Szmek 43ff24
 StandardOutput=inherit