[systemd-commits] 2 commits - Makefile.am man/systemctl.xml man/systemd.special.xml.in src/automount.c src/manager.c src/mount.c src/special.h src/swap.c src/systemctl.c units/dev-hugepages.automount units/dev-hugepages.mount units/dev-mqueue.automount units/dev-mqueue.mount units/emergency.service units/fedora units/multi-user.target.m4 units/proc-sys-fs-binfmt_misc.automount units/proc-sys-fs-binfmt_misc.mount units/rescue.target units/sysinit.target.m4 units/sys-kernel-debug.automount units/sys-kernel-debug.mount units/sys-kernel-security.automount units/sys-kernel-security.mount
Lennart Poettering
lennart at kemper.freedesktop.org
Mon Jul 12 14:52:09 PDT 2010
Makefile.am | 10 ++++++++--
man/systemctl.xml | 2 +-
man/systemd.special.xml.in | 6 +++---
src/automount.c | 22 +++++++++++++++++++---
src/manager.c | 2 +-
src/mount.c | 24 ++++++++++++++++++++----
src/special.h | 2 +-
src/swap.c | 22 ++++++++++++++++++++++
src/systemctl.c | 2 +-
units/dev-hugepages.automount | 2 +-
units/dev-hugepages.mount | 1 +
units/dev-mqueue.automount | 2 +-
units/dev-mqueue.mount | 1 +
units/emergency.service | 9 +++++----
units/fedora/halt.service | 6 +++---
units/fedora/poweroff.service | 6 +++---
units/fedora/reboot.service | 6 +++---
units/fedora/sysinit.service | 4 +---
units/multi-user.target.m4 | 4 ++--
units/proc-sys-fs-binfmt_misc.automount | 2 +-
units/proc-sys-fs-binfmt_misc.mount | 1 +
units/rescue.target | 7 ++++---
units/sys-kernel-debug.automount | 2 +-
units/sys-kernel-debug.mount | 1 +
units/sys-kernel-security.automount | 2 +-
units/sys-kernel-security.mount | 1 +
units/sysinit.target.m4 | 3 ++-
27 files changed, 109 insertions(+), 43 deletions(-)
New commits:
commit f057408c9c3b54b6eeb96cd9f0a1333f30610614
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Jul 12 23:49:20 2010 +0200
units: introduce emergency.target
diff --git a/Makefile.am b/Makefile.am
index 6351537..51fe5a9 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 f0de186..22d3f6e 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 64e37d1..c6c2393 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 6dfef71..9667e29 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 5ecdd3c..9ffd3d8 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 32974ae..4218a22 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 bcedebf..a5a54bc 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 b957a3f..4fe0d53 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 76d030c..3a53875 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 6a93c0b..0f3e206 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 884de8d..21872e8 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 010e7d8..323ba01 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 0398f9b..638f47c 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 48e55a4..29693b3 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',
commit 2edd4434e5bc6e5c7948df742d82f4bcd6c415f3
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Jul 12 22:55:27 2010 +0200
mount: add automatic start ordering dependencies for mounts
diff --git a/src/automount.c b/src/automount.c
index 934aa5f..00f3736 100644
--- a/src/automount.c
+++ b/src/automount.c
@@ -146,6 +146,23 @@ static int automount_add_mount_links(Automount *a) {
return 0;
}
+static int automount_add_default_dependencies(Automount *a) {
+ int r;
+
+ assert(a);
+
+ if (a->meta.manager->running_as == MANAGER_SYSTEM) {
+
+ if ((r = unit_add_dependency_by_name(UNIT(a), UNIT_AFTER, SPECIAL_SYSINIT_TARGET, NULL, true)) < 0)
+ return r;
+
+ if ((r = unit_add_two_dependencies_by_name(UNIT(a), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true)) < 0)
+ return r;
+ }
+
+ return 0;
+}
+
static int automount_verify(Automount *a) {
bool b;
char *e;
@@ -201,9 +218,8 @@ static int automount_load(Unit *u) {
if ((r = unit_add_dependency(u, UNIT_BEFORE, UNIT(a->mount), true)) < 0)
return r;
- if (a->meta.default_dependencies &&
- a->meta.manager->running_as == MANAGER_SYSTEM)
- if ((r = unit_add_two_dependencies_by_name(UNIT(a), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true)) < 0)
+ if (a->meta.default_dependencies)
+ if ((r = automount_add_default_dependencies(a)) < 0)
return r;
}
diff --git a/src/mount.c b/src/mount.c
index 30390de..5b0bc6b 100644
--- a/src/mount.c
+++ b/src/mount.c
@@ -274,6 +274,24 @@ static int mount_add_target_links(Mount *m) {
}
}
+static int mount_add_default_dependencies(Mount *m) {
+ int r;
+
+ assert(m);
+
+ if (m->meta.manager->running_as == MANAGER_SYSTEM) {
+
+ if ((r = unit_add_dependency_by_name(UNIT(m), UNIT_AFTER, SPECIAL_SYSINIT_TARGET, NULL, true)) < 0)
+ return r;
+
+ if (!path_equal(m->where, "/"))
+ if ((r = unit_add_two_dependencies_by_name(UNIT(m), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true)) < 0)
+ return r;
+ }
+
+ return 0;
+}
+
static int mount_verify(Mount *m) {
bool b;
char *e;
@@ -368,10 +386,8 @@ static int mount_load(Unit *u) {
if ((r = unit_add_default_cgroup(u)) < 0)
return r;
- if (m->meta.default_dependencies &&
- m->meta.manager->running_as == MANAGER_SYSTEM &&
- !path_equal(m->where, "/"))
- if ((r = unit_add_two_dependencies_by_name(UNIT(m), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true)) < 0)
+ if (m->meta.default_dependencies)
+ if ((r = mount_add_default_dependencies(m)) < 0)
return r;
}
diff --git a/src/swap.c b/src/swap.c
index 9203514..de468a0 100644
--- a/src/swap.c
+++ b/src/swap.c
@@ -120,6 +120,24 @@ static int swap_add_target_links(Swap *s) {
return unit_add_dependency(UNIT(s), UNIT_BEFORE, tu, true);
}
+static int swap_add_default_dependencies(Swap *s) {
+ int r;
+
+ assert(s);
+
+ if (s->meta.manager->running_as == MANAGER_SYSTEM) {
+
+ if ((r = unit_add_dependency_by_name(UNIT(s), UNIT_AFTER, SPECIAL_SYSINIT_TARGET, NULL, true)) < 0)
+ return r;
+
+ /* Note that by default we don't disable swap devices
+ * on shutdown. i.e. there is no umount.target
+ * conflicts here. */
+ }
+
+ return 0;
+}
+
static int swap_verify(Swap *s) {
bool b;
char *e;
@@ -185,6 +203,10 @@ static int swap_load(Unit *u) {
if ((r = swap_add_target_links(s)) < 0)
return r;
+
+ if (s->meta.default_dependencies)
+ if ((r = swap_add_default_dependencies(s)) < 0)
+ return r;
}
return swap_verify(s);
diff --git a/units/dev-hugepages.automount b/units/dev-hugepages.automount
index 4e7f8ff..ab8fa7c 100644
--- a/units/dev-hugepages.automount
+++ b/units/dev-hugepages.automount
@@ -7,7 +7,7 @@
[Unit]
Description=Huge Pages File System Automount Point
-Before=sysinit.target
+DefaultDependencies=no
[Automount]
Where=/dev/hugepages
diff --git a/units/dev-hugepages.mount b/units/dev-hugepages.mount
index 2aa1c23..e6014e5 100644
--- a/units/dev-hugepages.mount
+++ b/units/dev-hugepages.mount
@@ -7,6 +7,7 @@
[Unit]
Description=Huge Pages File System
+DefaultDependencies=no
[Mount]
What=hugetlbfs
diff --git a/units/dev-mqueue.automount b/units/dev-mqueue.automount
index 4df53dc..ba45b28 100644
--- a/units/dev-mqueue.automount
+++ b/units/dev-mqueue.automount
@@ -7,7 +7,7 @@
[Unit]
Description=POSIX Message Queue File System Automount Point
-Before=sysinit.target
+DefaultDependencies=no
[Automount]
Where=/dev/mqueue
diff --git a/units/dev-mqueue.mount b/units/dev-mqueue.mount
index 28c757a..8519df5 100644
--- a/units/dev-mqueue.mount
+++ b/units/dev-mqueue.mount
@@ -7,6 +7,7 @@
[Unit]
Description=POSIX Message Queue File System
+DefaultDependencies=no
[Mount]
What=mqueue
diff --git a/units/proc-sys-fs-binfmt_misc.automount b/units/proc-sys-fs-binfmt_misc.automount
index 82369c5..29ae05b 100644
--- a/units/proc-sys-fs-binfmt_misc.automount
+++ b/units/proc-sys-fs-binfmt_misc.automount
@@ -7,7 +7,7 @@
[Unit]
Description=Arbitrary Executable File Formats File System Automount Point
-Before=sysinit.target
+DefaultDependencies=no
[Automount]
Where=/proc/sys/fs/binfmt_misc
diff --git a/units/proc-sys-fs-binfmt_misc.mount b/units/proc-sys-fs-binfmt_misc.mount
index 0d6b196..1829c21 100644
--- a/units/proc-sys-fs-binfmt_misc.mount
+++ b/units/proc-sys-fs-binfmt_misc.mount
@@ -7,6 +7,7 @@
[Unit]
Description=Arbitrary Executable File Formats File System
+DefaultDependencies=no
[Mount]
What=binfmt_misc
diff --git a/units/sys-kernel-debug.automount b/units/sys-kernel-debug.automount
index 4da3f20..3a6306f 100644
--- a/units/sys-kernel-debug.automount
+++ b/units/sys-kernel-debug.automount
@@ -7,7 +7,7 @@
[Unit]
Description=Debug File System Automount Point
-Before=sysinit.target
+DefaultDependencies=no
[Automount]
Where=/sys/kernel/debug
diff --git a/units/sys-kernel-debug.mount b/units/sys-kernel-debug.mount
index 7bf0815..53d1072 100644
--- a/units/sys-kernel-debug.mount
+++ b/units/sys-kernel-debug.mount
@@ -7,6 +7,7 @@
[Unit]
Description=Debug File System
+DefaultDependencies=no
[Mount]
What=debugfs
diff --git a/units/sys-kernel-security.automount b/units/sys-kernel-security.automount
index 5d8356e..a428e0b 100644
--- a/units/sys-kernel-security.automount
+++ b/units/sys-kernel-security.automount
@@ -7,7 +7,7 @@
[Unit]
Description=Security File System Automount Point
-Before=sysinit.target
+DefaultDependencies=no
[Automount]
Where=/sys/kernel/security
diff --git a/units/sys-kernel-security.mount b/units/sys-kernel-security.mount
index db9d672..770207f 100644
--- a/units/sys-kernel-security.mount
+++ b/units/sys-kernel-security.mount
@@ -7,6 +7,7 @@
[Unit]
Description=Security File System
+DefaultDependencies=no
[Mount]
What=securityfs
More information about the systemd-commits
mailing list