summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-07-12 23:49:20 +0200
committerLennart Poettering <lennart@poettering.net>2010-07-12 23:49:20 +0200
commitf057408c9c3b54b6eeb96cd9f0a1333f30610614 (patch)
tree3e3b4ba0a2718333350891c967b8096160514893
parent2edd4434e5bc6e5c7948df742d82f4bcd6c415f3 (diff)
units: introduce emergency.target
-rw-r--r--Makefile.am10
-rw-r--r--man/systemctl.xml2
-rw-r--r--man/systemd.special.xml.in6
-rw-r--r--src/manager.c2
-rw-r--r--src/special.h2
-rw-r--r--src/systemctl.c2
-rw-r--r--units/emergency.service9
-rw-r--r--units/fedora/halt.service6
-rw-r--r--units/fedora/poweroff.service6
-rw-r--r--units/fedora/reboot.service6
-rw-r--r--units/fedora/sysinit.service4
-rw-r--r--units/multi-user.target.m44
-rw-r--r--units/rescue.target7
-rw-r--r--units/sysinit.target.m43
14 files changed, 38 insertions, 31 deletions
diff --git a/Makefile.am b/Makefile.am
index 6351537fad..51fe5a9461 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -113,6 +113,7 @@ dbusinterface_DATA = \
dist_systemunit_DATA = \
units/emergency.service \
+ units/emergency.target \
units/basic.target \
units/getty.target \
units/halt.target \
@@ -183,7 +184,8 @@ dist_systemunit_DATA += \
units/fedora/prefdm.service \
units/fedora/rc-local.service \
units/fedora/reboot.service \
- units/fedora/sysinit.service
+ units/fedora/sysinit.service \
+ units/fedora/single.service
endif
if TARGET_SUSE
@@ -755,7 +757,8 @@ install-data-hook:
$(LN_S) ../system-services/org.freedesktop.systemd1.service org.freedesktop.systemd1.service )
if TARGET_FEDORA
$(MKDIR_P) -m 0755 \
- $(DESTDIR)$(SYSTEM_SYSVINIT_PATH)
+ $(DESTDIR)$(SYSTEM_SYSVINIT_PATH) \
+ $(DESTDIR)$(systemunitdir)/rescue.target.wants
( cd $(DESTDIR)$(pkgsysconfdir)/system && \
rm -f display-manager.service && \
$(LN_S) $(systemunitdir)/prefdm.service display-manager.service )
@@ -765,6 +768,9 @@ if TARGET_FEDORA
( cd $(DESTDIR)$(pkgsysconfdir)/system/multi-user.target.wants && \
rm -f rc-local.service && \
$(LN_S) $(systemunitdir)/rc-local.service rc-local.service )
+ ( cd $(DESTDIR)$(systemunitdir)/rescue.target.wants && \
+ rm -f single.service && \
+ $(LN_S) $(systemunitdir)/single.service single.service )
( cd $(DESTDIR)$(systemunitdir) && \
rm -f local.service && \
$(LN_S) rc-local.service local.service )
diff --git a/man/systemctl.xml b/man/systemctl.xml
index f0de186ea5..22d3f6ee5e 100644
--- a/man/systemctl.xml
+++ b/man/systemctl.xml
@@ -501,7 +501,7 @@
<listitem><para>Enter emergency
mode. This is mostly equivalent to
<command>isolate
- emergency.service</command> but also
+ emergency.target</command> but also
prints a wall message to all
users.</para></listitem>
</varlistentry>
diff --git a/man/systemd.special.xml.in b/man/systemd.special.xml.in
index 64e37d1149..c6c2393fc3 100644
--- a/man/systemd.special.xml.in
+++ b/man/systemd.special.xml.in
@@ -54,7 +54,7 @@
<filename>dbus.target</filename>,
<filename>default.target</filename>,
<filename>display-manager.service</filename>,
- <filename>emergency.service</filename>,
+ <filename>emergency.target</filename>,
<filename>exit.service</filename>,
<filename>graphical.target</filename>,
<filename>halt.target</filename>,
@@ -205,9 +205,9 @@
</listitem>
</varlistentry>
<varlistentry>
- <term><filename>emergency.service</filename></term>
+ <term><filename>emergency.target</filename></term>
<listitem>
- <para>A special service unit
+ <para>A special target unit
that starts an emergency
shell on the main
console. This unit is supposed
diff --git a/src/manager.c b/src/manager.c
index 6dfef713ed..9667e299f3 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -1947,7 +1947,7 @@ static int manager_process_signal_fd(Manager *m) {
static const char * const table[] = {
[0] = SPECIAL_DEFAULT_TARGET,
[1] = SPECIAL_RESCUE_TARGET,
- [2] = SPECIAL_EMERGENCY_SERVICE,
+ [2] = SPECIAL_EMERGENCY_TARGET,
[3] = SPECIAL_HALT_TARGET,
[4] = SPECIAL_POWEROFF_TARGET,
[5] = SPECIAL_REBOOT_TARGET
diff --git a/src/special.h b/src/special.h
index 5ecdd3ccfa..9ffd3d8922 100644
--- a/src/special.h
+++ b/src/special.h
@@ -53,7 +53,7 @@
#define SPECIAL_SYSINIT_TARGET "sysinit.target"
#define SPECIAL_RESCUE_TARGET "rescue.target"
#define SPECIAL_EXIT_SERVICE "exit.service"
-#define SPECIAL_EMERGENCY_SERVICE "emergency.service"
+#define SPECIAL_EMERGENCY_TARGET "emergency.target"
#define SPECIAL_HALT_TARGET "halt.target"
#define SPECIAL_POWEROFF_TARGET "poweroff.target"
#define SPECIAL_REBOOT_TARGET "reboot.target"
diff --git a/src/systemctl.c b/src/systemctl.c
index 32974aecce..4218a22b97 100644
--- a/src/systemctl.c
+++ b/src/systemctl.c
@@ -720,7 +720,7 @@ static int start_unit(DBusConnection *bus, char **args, unsigned n) {
[ACTION_RUNLEVEL4] = SPECIAL_RUNLEVEL4_TARGET,
[ACTION_RUNLEVEL5] = SPECIAL_RUNLEVEL5_TARGET,
[ACTION_RESCUE] = SPECIAL_RESCUE_TARGET,
- [ACTION_EMERGENCY] = SPECIAL_EMERGENCY_SERVICE,
+ [ACTION_EMERGENCY] = SPECIAL_EMERGENCY_TARGET,
[ACTION_DEFAULT] = SPECIAL_DEFAULT_TARGET
};
diff --git a/units/emergency.service b/units/emergency.service
index bcedebfa08..a5a54bc9d2 100644
--- a/units/emergency.service
+++ b/units/emergency.service
@@ -10,16 +10,17 @@
[Unit]
Description=Emergency Shell
DefaultDependencies=no
-Requires=shutdown.target umount.target
-After=shutdown.target umount.target
+After=shutdown.target
[Service]
+ExecStartPre=-/bin/plymouth --hide-splash
+ExecStartPre=-/bin/echo 'Welcome to emergency mode. Use "systemctl default" to activate default mode.'
ExecStart=/bin/sh
-StandardInput=tty
+StandardInput=tty-force
Restart=restart-always
RestartSec=0
KillMode=process-group
# Bash ignores SIGTERM, so we send SIGHUP first, to ensure that bash
# terminates cleanly.
-ExecStop=/bin/kill -HUP $(MAINPID)
+ExecStop=-/bin/kill -HUP $(MAINPID)
diff --git a/units/fedora/halt.service b/units/fedora/halt.service
index b957a3fe30..4fe0d532f6 100644
--- a/units/fedora/halt.service
+++ b/units/fedora/halt.service
@@ -8,9 +8,9 @@
[Unit]
Description=Halt
DefaultDependencies=no
-Requires=shutdown.target killall.service
-After=shutdown.target killall.service
-Conflicts=dev-hugepages.automount dev-mqueue.automount proc-sys-fs-binfmt_misc.automount sys-kernel-debug.automount sys-kernel-security.automount
+Requires=shutdown.target umount.target killall.service
+Conflicts=sysinit.service
+After=shutdown.target umount.target killall.service sysinit.service
[Service]
Type=finish
diff --git a/units/fedora/poweroff.service b/units/fedora/poweroff.service
index 76d030c041..3a53875707 100644
--- a/units/fedora/poweroff.service
+++ b/units/fedora/poweroff.service
@@ -8,9 +8,9 @@
[Unit]
Description=Power-Off
DefaultDependencies=no
-Requires=shutdown.target killall.service
-After=shutdown.target killall.service
-Conflicts=dev-hugepages.automount dev-mqueue.automount proc-sys-fs-binfmt_misc.automount sys-kernel-debug.automount sys-kernel-security.automount
+Requires=shutdown.target umount.target killall.service
+Conflicts=sysinit.service
+After=shutdown.target umount.target killall.service sysinit.service
[Service]
Type=finish
diff --git a/units/fedora/reboot.service b/units/fedora/reboot.service
index 6a93c0b557..0f3e206eb0 100644
--- a/units/fedora/reboot.service
+++ b/units/fedora/reboot.service
@@ -8,9 +8,9 @@
[Unit]
Description=Reboot
DefaultDependencies=no
-Requires=shutdown.target killall.service
-After=shutdown.target killall.service
-Conflicts=dev-hugepages.automount dev-mqueue.automount proc-sys-fs-binfmt_misc.automount sys-kernel-debug.automount sys-kernel-security.automount
+Requires=shutdown.target umount.target killall.service
+Conflicts=sysinit.service
+After=shutdown.target umount.target killall.service sysinit.service
[Service]
Type=finish
diff --git a/units/fedora/sysinit.service b/units/fedora/sysinit.service
index 884de8d1d6..21872e8d8a 100644
--- a/units/fedora/sysinit.service
+++ b/units/fedora/sysinit.service
@@ -8,9 +8,7 @@
[Unit]
Description=System Initialization
DefaultDependencies=no
-Before=local-fs.target remote-fs.target swap.target sockets.target
-Conflicts=shutdown.target
-Before=shutdown.target
+Before=emergency.service emergency.target
[Service]
ExecStart=/etc/rc.d/rc.sysinit
diff --git a/units/multi-user.target.m4 b/units/multi-user.target.m4
index 010e7d8474..323ba01a60 100644
--- a/units/multi-user.target.m4
+++ b/units/multi-user.target.m4
@@ -10,8 +10,8 @@
[Unit]
Description=Multi-User
Requires=basic.target
-After=basic.target
-Conflicts=rescue.target
+Conflicts=rescue.target shutdown.target
+After=basic.target rescue.target
m4_dnl
m4_ifdef(`TARGET_FEDORA',
m4_dnl On Fedora Runlevel 3 is multi-user
diff --git a/units/rescue.target b/units/rescue.target
index 0398f9bfb4..638f47c1e8 100644
--- a/units/rescue.target
+++ b/units/rescue.target
@@ -8,9 +8,10 @@
# See systemd.special(7) for details
[Unit]
-Description=Rescue Prompt
-Requires=basic.target
-After=basic.target
+Description=Rescue Mode
+Requires=sysinit.target local-fs.target swap.target shutdown.target
+Conflicts=emergency.service emergency.target
+After=sysinit.target local-fs.target swap.target shutdown.target emergency.service emergency.target
Names=runlevel1.target
[Install]
diff --git a/units/sysinit.target.m4 b/units/sysinit.target.m4
index 48e55a4358..29693b3ff2 100644
--- a/units/sysinit.target.m4
+++ b/units/sysinit.target.m4
@@ -9,7 +9,8 @@
[Unit]
Description=Systemd Initialization
-Conflicts=emergency.service
+Conflicts=emergency.service emergency.target
+After=emergency.service emergency.target
OnlyByDependency=yes
m4_dnl
m4_ifdef(`TARGET_FEDORA',