[systemd-devel] [PATCH] units: make ExecStopPost action part of ExecStart

Colin Guthrie gmane at colin.guthr.ie
Tue Jul 8 10:50:49 PDT 2014


'Twas brillig, and Andrey Borzenkov at 08/07/14 17:18 did gyre and gimble:
> В Tue,  8 Jul 2014 18:01:12 +0200
> Michal Sekletar <msekleta at redhat.com> пишет:
> 
>> > Currently after exiting rescue shell we isolate default target. User
>> > might want to isolate to some other target than default one. However
>> > issuing systemctl isolate command to desired target would bring system
>> > to default target as a consequence of running ExecStopPost action.
>> > 
>> > Having common ancestor for rescue shell and possible followup systemctl
>> > default command should fix this. If user exits rescue shell we will
>> > proceed with isolating default target, otherwise, on manual isolate,
>> > parent shell process is terminated and we don't isolate default target,
>> > but target chosen by user.
>> > 
>> > Suggested-by: Michal Schmidt <mschmidt at redhat.com>
>> > ---
>> >  units/emergency.service.in | 3 +--
>> >  units/rescue.service.m4.in | 3 +--
>> >  2 files changed, 2 insertions(+), 4 deletions(-)
>> > 
>> > diff --git a/units/emergency.service.in b/units/emergency.service.in
>> > index 94c090f..91fc1bb 100644
>> > --- a/units/emergency.service.in
>> > +++ b/units/emergency.service.in
>> > @@ -17,8 +17,7 @@ Environment=HOME=/root
>> >  WorkingDirectory=/root
>> >  ExecStartPre=-/bin/plymouth quit
>> >  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.'
>> > -ExecStart=-/sbin/sulogin
>> > -ExecStopPost=@SYSTEMCTL@ --fail --no-block default
>> > +ExecStart=-/bin/sh -c "/sbin/sulogin; @SYSTEMCTL@ --fail --no-block default"
> You do not really need /bin/sh here, right?


Well according to the description, yes you do need it as you want it to
be part of the same ExecStart... two commands in one is not supported
natively by ExecStart, so  it's wrapped in bash. Not ideal, but such is
life.

Col


-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/



More information about the systemd-devel mailing list