65878a
From 9af28110933ae9cdd96477dd2911c19295bc74ce Mon Sep 17 00:00:00 2001
65878a
From: Michal Sekletar <msekleta@redhat.com>
65878a
Date: Tue, 8 Jul 2014 17:42:23 +0200
65878a
Subject: [PATCH] units: make ExecStopPost action part of ExecStart
65878a
65878a
Currently after exiting rescue shell we isolate default target. User
65878a
might want to isolate to some other target than default one. However
65878a
issuing systemctl isolate command to desired target would bring system
65878a
to default target as a consequence of running ExecStopPost action.
65878a
65878a
Having common ancestor for rescue shell and possible followup systemctl
65878a
default command should fix this. If user exits rescue shell we will
65878a
proceed with isolating default target, otherwise, on manual isolate,
65878a
parent shell process is terminated and we don't isolate default target,
65878a
but target chosen by user.
65878a
65878a
Suggested-by: Michal Schmidt <mschmidt@redhat.com>
65878a
65878a
(cherry picked from commit d3381512282f2ca1c7669f77fb736a90fdce6982)
65878a
65878a
Resolves: #1036276
65878a
---
65878a
 units/emergency.service.in | 3 +--
65878a
 units/rescue.service.m4.in | 3 +--
65878a
 2 files changed, 2 insertions(+), 4 deletions(-)
65878a
65878a
diff --git a/units/emergency.service.in b/units/emergency.service.in
65878a
index 94c090f..91fc1bb 100644
65878a
--- a/units/emergency.service.in
65878a
+++ b/units/emergency.service.in
65878a
@@ -17,8 +17,7 @@ Environment=HOME=/root
65878a
 WorkingDirectory=/root
65878a
 ExecStartPre=-/bin/plymouth quit
65878a
 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.'
65878a
-ExecStart=-/sbin/sulogin
65878a
-ExecStopPost=@SYSTEMCTL@ --fail --no-block default
65878a
+ExecStart=-/bin/sh -c "/sbin/sulogin; @SYSTEMCTL@ --fail --no-block default"
65878a
 Type=idle
65878a
 StandardInput=tty-force
65878a
 StandardOutput=inherit
65878a
diff --git a/units/rescue.service.m4.in b/units/rescue.service.m4.in
65878a
index 552ef89..ef54369 100644
65878a
--- a/units/rescue.service.m4.in
65878a
+++ b/units/rescue.service.m4.in
65878a
@@ -18,8 +18,7 @@ Environment=HOME=/root
65878a
 WorkingDirectory=/root
65878a
 ExecStartPre=-/bin/plymouth quit
65878a
 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.'
65878a
-ExecStart=-/sbin/sulogin
65878a
-ExecStopPost=-@SYSTEMCTL@ --fail --no-block default
65878a
+ExecStart=-/bin/sh -c "/sbin/sulogin; @SYSTEMCTL@ --fail --no-block default"
65878a
 Type=idle
65878a
 StandardInput=tty-force
65878a
 StandardOutput=inherit