summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.am10
-rw-r--r--src/sulogin-shell/.gitignore1
-rwxr-xr-xsrc/sulogin-shell/systemd-sulogin-shell.in14
-rw-r--r--units/emergency.service.in4
-rw-r--r--units/rescue.service.in4
5 files changed, 27 insertions, 6 deletions
diff --git a/Makefile.am b/Makefile.am
index ad0f202b90..1fe86fd543 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -443,6 +443,12 @@ userenvgenerator_PROGRAMS = \
30-systemd-environment-d-generator
endif
+rootlibexec_SCRIPTS = \
+ src/sulogin-shell/systemd-sulogin-shell
+
+EXTRA_DIST += \
+ src/sulogin-shell/systemd-sulogin-shell.in
+
dist_bashcompletion_data = \
shell-completion/bash/busctl \
shell-completion/bash/journalctl \
@@ -6329,6 +6335,10 @@ src/core/%.systemd: src/core/%.systemd.in
src/%.policy.in: src/%.policy.in.in
$(SED_PROCESS)
+src/sulogin-shell/%: src/sulogin-shell/%.in
+ $(SED_PROCESS)
+ $(AM_V_GEN)chmod +x $@
+
shell-completion/%: shell-completion/%.in
$(SED_PROCESS)
diff --git a/src/sulogin-shell/.gitignore b/src/sulogin-shell/.gitignore
new file mode 100644
index 0000000000..01a315524b
--- /dev/null
+++ b/src/sulogin-shell/.gitignore
@@ -0,0 +1 @@
+systemd-sulogin-shell
diff --git a/src/sulogin-shell/systemd-sulogin-shell.in b/src/sulogin-shell/systemd-sulogin-shell.in
new file mode 100755
index 0000000000..d4f32af5f9
--- /dev/null
+++ b/src/sulogin-shell/systemd-sulogin-shell.in
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+if [ -x /bin/plymouth ]; then
+ /bin/plymouth --wait quit
+fi
+
+cat <<EOF
+You are in $1 mode. After logging in, type "journalctl -xb" to view
+system logs, "systemctl reboot" to reboot, "systemctl default" or ^D to
+boot into default mode.
+EOF
+
+@SULOGIN@
+@SYSTEMCTL@ --job-mode=fail --no-block default
diff --git a/units/emergency.service.in b/units/emergency.service.in
index 9f60931a9f..e9eb238b98 100644
--- a/units/emergency.service.in
+++ b/units/emergency.service.in
@@ -17,9 +17,7 @@ Before=shutdown.target
[Service]
Environment=HOME=/root
WorkingDirectory=-/root
-ExecStartPre=-/bin/sh -c "[ -x /bin/plymouth ] && /bin/plymouth --wait quit"
-ExecStartPre=-/bin/echo -e 'You are in emergency mode. After logging in, type "journalctl -xb" to view\\nsystem logs, "systemctl reboot" to reboot, "systemctl default" or ^D to\\ntry again to boot into default mode.'
-ExecStart=-/bin/sh -c "@SULOGIN@; @SYSTEMCTL@ --job-mode=fail --no-block default"
+ExecStart=-@rootlibexecdir@/systemd-sulogin-shell emergency
Type=idle
StandardInput=tty-force
StandardOutput=inherit
diff --git a/units/rescue.service.in b/units/rescue.service.in
index dc6d14b25a..4ab66f4856 100644
--- a/units/rescue.service.in
+++ b/units/rescue.service.in
@@ -16,9 +16,7 @@ Before=shutdown.target
[Service]
Environment=HOME=/root
WorkingDirectory=-/root
-ExecStartPre=-/bin/sh -c "[ -x /bin/plymouth ] && /bin/plymouth --wait quit"
-ExecStartPre=-/bin/echo -e 'You are in rescue mode. After logging in, type "journalctl -xb" to view\\nsystem logs, "systemctl reboot" to reboot, "systemctl default" or ^D to\\nboot into default mode.'
-ExecStart=-/bin/sh -c "@SULOGIN@; @SYSTEMCTL@ --job-mode=fail --no-block default"
+ExecStart=-@rootlibexecdir@/systemd-sulogin-shell rescue
Type=idle
StandardInput=tty-force
StandardOutput=inherit