From f92a18f5274ad506aed600b2ed8f4a560c510807 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 4 Jun 2010 18:43:40 +0200 Subject: [PATCH] units: introduce and explain sysinit.target --- Makefile.am | 16 +++++---- man/systemd.special.xml.in | 37 ++++++++++++++------ src/manager.h | 1 + src/service.c | 4 +-- units/.gitignore | 2 +- units/basic.target | 14 ++++++++ units/dev-hugepages.automount | 2 +- units/dev-mqueue.automount | 2 +- units/proc-sys-fs-binfmt_misc.automount | 2 +- units/sys-kernel-debug.automount | 2 +- units/sys-kernel-security.automount | 2 +- units/{basic.target.m4 => sysinit.target.m4} | 4 +-- units/systemd-initctl.socket | 1 + units/systemd-logger.socket | 1 + 14 files changed, 62 insertions(+), 28 deletions(-) create mode 100644 units/basic.target rename units/{basic.target.m4 => sysinit.target.m4} (80%) diff --git a/Makefile.am b/Makefile.am index b255b7a1..28e52fee 100644 --- a/Makefile.am +++ b/Makefile.am @@ -87,6 +87,7 @@ interface_DATA = \ dist_systemunit_DATA = \ units/emergency.service \ + units/basic.target \ units/getty.target \ units/halt.target \ units/local-fs.target \ @@ -119,7 +120,7 @@ dist_systemunit_DATA = \ units/var-run.mount systemunit_DATA = \ - units/basic.target \ + units/sysinit.target \ units/getty@.service \ units/graphical.target \ units/multi-user.target \ @@ -135,7 +136,7 @@ sessionunit_DATA = \ units/session/exit.service EXTRA_DIST = \ - units/basic.target.m4 \ + units/sysinit.target.m4 \ units/getty@.service.m4 \ units/graphical.target.m4 \ units/multi-user.target.m4 \ @@ -398,7 +399,7 @@ CLEANFILES = \ units/systemd-initctl.service \ units/systemd-logger.service \ units/syslog.target \ - units/basic.target \ + units/sysinit.target \ units/getty@.service \ units/graphical.target \ units/multi-user.target \ @@ -470,7 +471,7 @@ install-data-hook: $(DESTDIR)$(systemunitdir) \ $(DESTDIR)$(sessionunitdir) \ $(DESTDIR)$(systemunitdir)/sockets.target.wants \ - $(DESTDIR)$(systemunitdir)/basic.target.wants \ + $(DESTDIR)$(systemunitdir)/sysinit.target.wants \ $(DESTDIR)$(pkgsysconfdir)/system \ $(DESTDIR)$(pkgsysconfdir)/system/getty.target.wants \ $(DESTDIR)$(pkgsysconfdir)/system/multi-user.target.wants \ @@ -516,9 +517,10 @@ install-data-hook: $(LN_S) $(systemunitdir)/getty@.service getty@tty5.service && \ $(LN_S) $(systemunitdir)/getty@.service getty@tty6.service ) ( cd $(DESTDIR)$(pkgsysconfdir)/system/multi-user.target.wants && \ - rm -f getty.target && \ - $(LN_S) $(systemunitdir)/getty.target getty.target ) - ( cd $(DESTDIR)$(systemunitdir)/basic.target.wants && \ + rm -f getty.target remote-fs.target && \ + $(LN_S) $(systemunitdir)/getty.target getty.target && \ + $(LN_S) $(systemunitdir)/remote-fs.target remote-fs.target ) + ( cd $(DESTDIR)$(systemunitdir)/sysinit.target.wants && \ rm -f dev-hugepages.automount \ dev-mqueue.automount \ proc-sys-fs-binfmt_misc.automount \ diff --git a/man/systemd.special.xml.in b/man/systemd.special.xml.in index 1d9c1326..a2e1bb2c 100644 --- a/man/systemd.special.xml.in +++ b/man/systemd.special.xml.in @@ -80,6 +80,7 @@ sigpwr.target, sockets.target, swap.target, + sysinit.target, syslog.target, @SPECIAL_SYSLOG_SERVICE@, systemd-initctl.service, @@ -111,16 +112,15 @@ target unit to all SysV service units configured for runlevel 1 to 5. - systemd automatically - adds dependencies of the types - Wants and After for all - SysV service units configured - for runlevels that are not 0 - to 6 to this target unit. - This covers the special - boot-up runlevels some - distributions have, such as S - or b. + Usually this should pull + in all sockets, mount points, + swap devices and other basic + initialization necessary for + the general purpose + daemons. Most normal daemon + should have dependencies of + type After and Requires on + this unit. @@ -586,6 +586,23 @@ service). + + sysinit.target + + A special target unit + covering early boot-up scripts. + systemd automatically + adds dependencies of the types + Wants and After for all + SysV service units configured + for runlevels that are not 0 + to 6 to this target unit. + This covers the special + boot-up runlevels some + distributions have, such as S + or b. + + @SPECIAL_SYSLOG_SERVICE@ diff --git a/src/manager.h b/src/manager.h index 210e6605..a2084e92 100644 --- a/src/manager.h +++ b/src/manager.h @@ -108,6 +108,7 @@ struct Watch { #define SPECIAL_DISPLAY_MANAGER_SERVICE "display-manager.service" /* Debian's $x-display-manager */ #define SPECIAL_MAIL_TRANSFER_AGENT_TARGET "mail-transfer-agent.target" /* Debian's $mail-{transport|transfer-agent */ #define SPECIAL_BASIC_TARGET "basic.target" +#define SPECIAL_SYSINIT_TARGET "sysinit.target" #define SPECIAL_RESCUE_TARGET "rescue.target" #define SPECIAL_EXIT_SERVICE "exit.service" diff --git a/src/service.c b/src/service.c index 2ce95f5a..c276a9a2 100644 --- a/src/service.c +++ b/src/service.c @@ -58,10 +58,10 @@ static const struct { { "rc6.d", SPECIAL_RUNLEVEL6_TARGET, RUNLEVEL_DOWN }, /* SUSE style boot.d */ - { "boot.d", SPECIAL_BASIC_TARGET, RUNLEVEL_BASIC }, + { "boot.d", SPECIAL_SYSINIT_TARGET, RUNLEVEL_BASIC }, /* Debian style rcS.d */ - { "rcS.d", SPECIAL_BASIC_TARGET, RUNLEVEL_BASIC }, + { "rcS.d", SPECIAL_SYSINIT_TARGET, RUNLEVEL_BASIC }, }; #define RUNLEVELS_UP "12345" diff --git a/units/.gitignore b/units/.gitignore index 7e615438..ea85dc08 100644 --- a/units/.gitignore +++ b/units/.gitignore @@ -1,7 +1,7 @@ systemd-initctl.service systemd-logger.service syslog.target -basic.target +sysinit.target graphical.target multi-user.target getty@.service diff --git a/units/basic.target b/units/basic.target new file mode 100644 index 00000000..aa94b94a --- /dev/null +++ b/units/basic.target @@ -0,0 +1,14 @@ +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +# See systemd.special(7) for details + +[Unit] +Description=Basic System +Requires=sysinit.target local-fs.target swap.target sockets.target +After=sysinit.target local-fs.target swap.target sockets.target +OnlyByDependency=yes diff --git a/units/dev-hugepages.automount b/units/dev-hugepages.automount index 9fef9eeb..4e7f8ff5 100644 --- a/units/dev-hugepages.automount +++ b/units/dev-hugepages.automount @@ -7,7 +7,7 @@ [Unit] Description=Huge Pages File System Automount Point -Before=basic.target +Before=sysinit.target [Automount] Where=/dev/hugepages diff --git a/units/dev-mqueue.automount b/units/dev-mqueue.automount index a24ffe68..4df53dca 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=basic.target +Before=sysinit.target [Automount] Where=/dev/mqueue diff --git a/units/proc-sys-fs-binfmt_misc.automount b/units/proc-sys-fs-binfmt_misc.automount index 4e9b23b9..82369c56 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=basic.target +Before=sysinit.target [Automount] Where=/proc/sys/fs/binfmt_misc diff --git a/units/sys-kernel-debug.automount b/units/sys-kernel-debug.automount index 3d5b52d0..4da3f205 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=basic.target +Before=sysinit.target [Automount] Where=/sys/kernel/debug diff --git a/units/sys-kernel-security.automount b/units/sys-kernel-security.automount index 061a5a23..5d8356e5 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=basic.target +Before=sysinit.target [Automount] Where=/sys/kernel/security diff --git a/units/basic.target.m4 b/units/sysinit.target.m4 similarity index 80% rename from units/basic.target.m4 rename to units/sysinit.target.m4 index 537ad8da..68c661ef 100644 --- a/units/basic.target.m4 +++ b/units/sysinit.target.m4 @@ -8,9 +8,7 @@ # See systemd.special(7) for details [Unit] -Description=Basic System -Requires=local-fs.target swap.target sockets.target -After=local-fs.target swap.target sockets.target +Description=Systemd Initialization Conflicts=emergency.service OnlyByDependency=yes m4_dnl diff --git a/units/systemd-initctl.socket b/units/systemd-initctl.socket index fdb95ded..af5cca20 100644 --- a/units/systemd-initctl.socket +++ b/units/systemd-initctl.socket @@ -9,6 +9,7 @@ [Unit] Description=systemd /dev/initctl Compatibility Socket +After=sysinit.target [Socket] ListenFIFO=/dev/initctl diff --git a/units/systemd-logger.socket b/units/systemd-logger.socket index f62b582d..7195a9e8 100644 --- a/units/systemd-logger.socket +++ b/units/systemd-logger.socket @@ -9,6 +9,7 @@ [Unit] Description=systemd Logging Socket +After=sysinit.target [Socket] ListenStream=@/org/freedesktop/systemd1/logger -- 2.39.5