richardphibel / rpms / systemd

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