richardphibel / rpms / systemd

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