Skip to content

Commit 5e6afdd

Browse files
committed
units: add distribution-specific units
1 parent f0b02ca commit 5e6afdd

20 files changed

+532
-16
lines changed

Makefile.am

Lines changed: 106 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,15 @@ dist_udevrules_DATA = \
6666

6767
dist_systemunit_DATA = \
6868
units/emergency.service \
69+
units/getty.target \
70+
units/halt.target \
6971
units/local-fs.target \
7072
units/network.target \
7173
units/nss-lookup.target \
74+
units/poweroff.target \
75+
units/reboot.target \
7276
units/remote-fs.target \
77+
units/rescue.target \
7378
units/rpcbind.target \
7479
units/rtc-set.target \
7580
units/shutdown.target \
@@ -80,17 +85,36 @@ dist_systemunit_DATA = \
8085
units/systemd-logger.socket
8186

8287
systemunit_DATA = \
88+
units/basic.target \
89+
units/getty@.service \
90+
units/graphical.target \
91+
units/multi-user.target \
8392
units/systemd-initctl.service \
8493
units/systemd-logger.service \
8594
units/syslog.target
8695

8796
EXTRA_DIST = \
97+
units/basic.target.m4 \
98+
units/getty@.service.m4 \
99+
units/graphical.target.m4 \
100+
units/multi-user.target.m4 \
88101
units/systemd-initctl.service.in \
89102
units/systemd-logger.service.in \
90103
units/syslog.target.in \
91104
LICENSE \
92105
README
93106

107+
if TARGET_FEDORA
108+
dist_systemunit_DATA += \
109+
units/fedora/halt.service \
110+
units/fedora/killall.service \
111+
units/fedora/poweroff.service \
112+
units/fedora/prefdm.service \
113+
units/fedora/rc-local.service \
114+
units/fedora/reboot.service \
115+
units/fedora/sysinit.service
116+
endif
117+
94118
# This is needed because automake is buggy in how it generates the
95119
# rules for C programs, but not Vala programs. We therefore can't
96120
# list the .h files as dependencies if we want make dist to work.
@@ -275,30 +299,55 @@ systemadm_SOURCES = \
275299
systemadm_CPPFLAGS = $(AM_CPPFLAGS) $(DBUSGLIB_CFLAGS) $(GTK_CFLAGS) $(VALA_CFLAGS)
276300
systemadm_LDADD = $(DBUSGLIB_LIBS) $(GTK_LIBS)
277301

278-
units/systemd-initctl.service: units/systemd-initctl.service.in Makefile
279-
$(MKDIR_P) units
280-
$(SED) -e 's,@libexecdir\@,$(libexecdir),g' \
302+
SED_PROCESS = \
303+
$(MKDIR_P) units && \
304+
$(SED) -e 's,@libexecdir\@,$(libexecdir),g' \
281305
-e 's,@pkglibexecdir\@,$(pkglibexecdir),g' \
306+
-e 's,@SPECIAL_SYSLOG_SERVICE\@,$(SPECIAL_SYSLOG_SERVICE),g' \
282307
< $< > $@
283308

309+
units/systemd-initctl.service: units/systemd-initctl.service.in Makefile
310+
$(SED_PROCESS)
311+
284312
units/systemd-logger.service: units/systemd-logger.service.in Makefile
285-
$(MKDIR_P) units
286-
$(SED) -e 's,@libexecdir\@,$(libexecdir),g' \
287-
-e 's,@pkglibexecdir\@,$(pkglibexecdir),g' \
288-
< $< > $@
313+
$(SED_PROCESS)
289314

290315
units/syslog.target: units/syslog.target.in Makefile
291-
$(MKDIR_P) units
292-
$(SED) -e 's,@SPECIAL_SYSLOG_SERVICE\@,$(SPECIAL_SYSLOG_SERVICE),g' \
293-
< $< > $@
316+
$(SED_PROCESS)
317+
318+
M4_FLAGS =
319+
320+
if TARGET_FEDORA
321+
M4_FLAGS += -DTARGET_FEDORA=1
322+
endif
323+
324+
M4_PROCESS = \
325+
$(MKDIR_P) units && \
326+
$(M4) -P $(M4_FLAGS) < $< > $@
327+
328+
units/basic.target: units/basic.target.m4 Makefile
329+
$(M4_PROCESS)
330+
331+
units/graphical.target: units/graphical.target.m4 Makefile
332+
$(M4_PROCESS)
333+
334+
units/multi-user.target: units/multi-user.target.m4 Makefile
335+
$(M4_PROCESS)
336+
337+
units/getty@.service: units/getty@.service.m4 Makefile
338+
$(M4_PROCESS)
294339

295340
CLEANFILES = \
296341
src/systemd-interfaces.c \
297342
src/systemctl.c \
298343
src/systemadm.c \
299344
units/systemd-initctl.service \
300345
units/systemd-logger.service \
301-
units/syslog.target
346+
units/syslog.target \
347+
units/basic.target \
348+
units/getty@.service \
349+
units/graphical.target \
350+
units/multi-user.target
302351

303352
if HAVE_XSLTPROC
304353
man/%.5 man/%.7: man/%.xml
@@ -318,22 +367,63 @@ install-data-hook:
318367
$(MKDIR_P) -m 0755 \
319368
$(DESTDIR)$(systemunitdir) \
320369
$(DESTDIR)$(sessionunitdir) \
370+
$(DESTDIR)$(systemunitdir)/sockets.target.wants \
321371
$(DESTDIR)$(pkgsysconfdir)/system \
322-
$(DESTDIR)$(pkgsysconfdir)/system/sockets.target.wants \
372+
$(DESTDIR)$(pkgsysconfdir)/system/getty.target.wants \
373+
$(DESTDIR)$(pkgsysconfdir)/system/multi-user.target.wants \
374+
$(DESTDIR)$(pkgsysconfdir)/system/graphical.target.wants \
323375
$(DESTDIR)$(pkgsysconfdir)/session \
324376
$(DESTDIR)$(sysconfdir)/xdg/systemd \
325377
$(DESTDIR)/cgroup/debug
326378
( cd $(DESTDIR)$(sysconfdir)/xdg/systemd/ && \
327379
rm -f session && \
328-
$(LN_S) $(DESTDIR)$(pkgsysconfdir)/session session )
329-
( cd $(DESTDIR)$(pkgsysconfdir)/system/sockets.target.wants && \
380+
$(LN_S) $(pkgsysconfdir)/session session )
381+
( cd $(DESTDIR)$(systemunitdir)/sockets.target.wants && \
330382
rm -f systemd-initctl.socket systemd-logger.socket && \
331-
$(LN_S) $(DESTDIR)$(systemunitdir)/systemd-logger.socket systemd-logger.socket && \
332-
$(LN_S) $(DESTDIR)$(systemunitdir)/systemd-initctl.socket systemd-initctl.socket )
383+
$(LN_S) ../systemd-logger.socket systemd-logger.socket && \
384+
$(LN_S) ../systemd-initctl.socket systemd-initctl.socket )
333385
( cd $(DESTDIR)$(sessionunitdir) && \
334386
rm -f shutdown.target sockets.target && \
335387
$(LN_S) ../system/shutdown.target shutdown.target && \
336388
$(LN_S) ../system/sockets.target sockets.target )
389+
( cd $(DESTDIR)$(systemunitdir) && \
390+
rm -f runlevel0.target runlevel1.target runlevel6.target && \
391+
$(LN_S) poweroff.target runlevel0.target && \
392+
$(LN_S) rescue.target runlevel1.target && \
393+
$(LN_S) reboot.target runlevel6.target )
394+
( cd $(DESTDIR)$(pkgsysconfdir)/system && \
395+
rm -f default.target ctrl-alt-del.target kbrequest.target && \
396+
$(LN_S) $(systemunitdir)/graphical.target default.target && \
397+
$(LN_S) $(systemunitdir)/reboot.target ctrl-alt-del.target && \
398+
$(LN_S) $(systemunitdir)/rescue.target kbrequest.target && \
399+
rm -f runlevel2.target runlevel3.target runlevel4.target runlevel5.target && \
400+
$(LN_S) $(systemunitdir)/multi-user.target runlevel2.target && \
401+
$(LN_S) $(systemunitdir)/multi-user.target runlevel3.target && \
402+
$(LN_S) $(systemunitdir)/multi-user.target runlevel4.target && \
403+
$(LN_S) $(systemunitdir)/graphical.target runlevel5.target )
404+
( cd $(DESTDIR)$(pkgsysconfdir)/system/getty.target.wants && \
405+
rm -f getty@tty1.service getty@tty2.service getty@tty3.service getty@tty4.service getty@tty5.service getty@tty6.service && \
406+
$(LN_S) $(systemunitdir)/getty@.service getty@tty1.service && \
407+
$(LN_S) $(systemunitdir)/getty@.service getty@tty2.service && \
408+
$(LN_S) $(systemunitdir)/getty@.service getty@tty3.service && \
409+
$(LN_S) $(systemunitdir)/getty@.service getty@tty4.service && \
410+
$(LN_S) $(systemunitdir)/getty@.service getty@tty5.service && \
411+
$(LN_S) $(systemunitdir)/getty@.service getty@tty6.service )
412+
( cd $(DESTDIR)$(pkgsysconfdir)/system/multi-user.target.wants && \
413+
rm -f getty.target && \
414+
$(LN_S) $(systemunitdir)/getty.target getty.target )
415+
if TARGET_FEDORA
416+
( cd $(DESTDIR)$(pkgsysconfdir)/system/graphical.target.wants && \
417+
rm -f prefdm.service && \
418+
$(LN_S) $(systemunitdir)/prefdm.service prefdm.service )
419+
( cd $(DESTDIR)$(pkgsysconfdir)/system/multi-user.target.wants && \
420+
rm -f rc-local.service && \
421+
$(LN_S) $(systemunitdir)/rc-local.service rc-local.service )
422+
( cd $(DESTDIR)$(systemunitdir) && \
423+
rm -f local.service && \
424+
$(LN_S) rc-local.service local.service )
425+
endif
426+
337427

338428
DISTCHECK_CONFIGURE_FLAGS = \
339429
--with-udevrulesdir=$$dc_install_base/$(udevrulesdir)

configure.ac

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ AC_SUBST(VAPIDIR)
142142
AC_PATH_PROG([XSLTPROC], [xsltproc])
143143
AM_CONDITIONAL(HAVE_XSLTPROC, test x"$XSLTPROC" != x)
144144

145+
AC_PATH_PROG([M4], [m4])
146+
145147
AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO],[Specify the distribution to target: One of fedora, suse, debian, arch, gentoo or other]))
146148
if test "z$with_distro" = "z"; then
147149
if test "$cross_compiling" = yes; then

units/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
systemd-initctl.service
22
systemd-logger.service
33
syslog.target
4+
basic.target
5+
graphical.target
6+
multi-user.target
7+
getty@.service

units/basic.target.m4

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# This file is part of systemd.
2+
#
3+
# Copyright 2010 Lennart Poettering
4+
#
5+
# systemd is free software; you can redistribute it and/or modify it
6+
# under the terms of the GNU General Public License as published by
7+
# the Free Software Foundation; either version 2 of the License, or
8+
# (at your option) any later version.
9+
#
10+
# systemd is distributed in the hope that it will be useful, but
11+
# WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
# General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU General Public License
16+
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
17+
18+
# See systemd.special(7) for details
19+
20+
[Unit]
21+
Description=Basic System
22+
Requires=local-fs.target swap.target sockets.target
23+
After=local-fs.target swap.target sockets.target
24+
25+
m4_ifdef(`TARGET_FEDORA',
26+
# Hook in Fedora's /etc/rc.d/rc.sysinit
27+
Requires=sysinit.service
28+
After=sysinit.service)

units/fedora/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../src/Makefile

units/fedora/halt.service

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# This file is part of systemd.
2+
#
3+
# Copyright 2010 Lennart Poettering
4+
#
5+
# systemd is free software; you can redistribute it and/or modify it
6+
# under the terms of the GNU General Public License as published by
7+
# the Free Software Foundation; either version 2 of the License, or
8+
# (at your option) any later version.
9+
#
10+
# systemd is distributed in the hope that it will be useful, but
11+
# WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
# General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU General Public License
16+
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
17+
18+
# See systemd.special(7) for details
19+
20+
[Unit]
21+
Description=Halt
22+
Requires=shutdown.target killall.service
23+
After=shutdown.target killall.service
24+
25+
[Service]
26+
Type=finish
27+
Environment=INIT_HALT=HALT
28+
Environment=RUNLEVEL=0
29+
ExecStart=/etc/init.d/halt start

units/fedora/killall.service

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# This file is part of systemd.
2+
#
3+
# Copyright 2010 Lennart Poettering
4+
#
5+
# systemd is free software; you can redistribute it and/or modify it
6+
# under the terms of the GNU General Public License as published by
7+
# the Free Software Foundation; either version 2 of the License, or
8+
# (at your option) any later version.
9+
#
10+
# systemd is distributed in the hope that it will be useful, but
11+
# WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
# General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU General Public License
16+
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
17+
18+
# See systemd.special(7) for details
19+
20+
[Unit]
21+
Description=Kill All Processes
22+
23+
[Service]
24+
Type=finish
25+
ExecStart=/etc/init.d/killall start

units/fedora/poweroff.service

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# This file is part of systemd.
2+
#
3+
# Copyright 2010 Lennart Poettering
4+
#
5+
# systemd is free software; you can redistribute it and/or modify it
6+
# under the terms of the GNU General Public License as published by
7+
# the Free Software Foundation; either version 2 of the License, or
8+
# (at your option) any later version.
9+
#
10+
# systemd is distributed in the hope that it will be useful, but
11+
# WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
# General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU General Public License
16+
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
17+
18+
# See systemd.special(7) for details
19+
20+
[Unit]
21+
Description=Power-Off
22+
Requires=shutdown.target killall.service
23+
After=shutdown.target killall.service
24+
25+
[Service]
26+
Type=finish
27+
Environment=RUNLEVEL=0
28+
ExecStart=/etc/init.d/halt start

units/fedora/prefdm.service

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# This file is part of systemd.
2+
#
3+
# Copyright 2010 Lennart Poettering
4+
#
5+
# systemd is free software; you can redistribute it and/or modify it
6+
# under the terms of the GNU General Public License as published by
7+
# the Free Software Foundation; either version 2 of the License, or
8+
# (at your option) any later version.
9+
#
10+
# systemd is distributed in the hope that it will be useful, but
11+
# WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
# General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU General Public License
16+
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
17+
18+
# See systemd.special(7) for details
19+
20+
[Unit]
21+
Description=Display Manager
22+
Before=graphical.target
23+
After=basic.target syslog.target messagebus.service haldaemon.service
24+
25+
[Service]
26+
ExecStart=/etc/X11/prefdm -nodaemon
27+
Type=simple

units/fedora/rc-local.service

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# This file is part of systemd.
2+
#
3+
# Copyright 2010 Lennart Poettering
4+
#
5+
# systemd is free software; you can redistribute it and/or modify it
6+
# under the terms of the GNU General Public License as published by
7+
# the Free Software Foundation; either version 2 of the License, or
8+
# (at your option) any later version.
9+
#
10+
# systemd is distributed in the hope that it will be useful, but
11+
# WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
# General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU General Public License
16+
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
17+
18+
# See systemd.special(7) for details
19+
20+
[Unit]
21+
Description=/etc/rc.local Compatibility
22+
Requires=basic.target
23+
24+
# The rcN.d symlink uses the name "local" while the script itself is
25+
# called "rc.local", hence carry both names here.
26+
Names=rc-local.service local.service
27+
28+
[Service]
29+
ExecStart=/etc/rc.local start
30+
Type=simple
31+
SysVStartPriority=99

0 commit comments

Comments
 (0)