Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 519418
Collapse All | Expand All

(-)a/Makefile-man.am (-1 / +5 lines)
Lines 63-68 MANPAGES += \ Link Here
63
	man/systemd-delta.1 \
63
	man/systemd-delta.1 \
64
	man/systemd-detect-virt.1 \
64
	man/systemd-detect-virt.1 \
65
	man/systemd-efi-boot-generator.8 \
65
	man/systemd-efi-boot-generator.8 \
66
	man/systemd-escape.1 \
66
	man/systemd-fsck@.service.8 \
67
	man/systemd-fsck@.service.8 \
67
	man/systemd-fstab-generator.8 \
68
	man/systemd-fstab-generator.8 \
68
	man/systemd-getty-generator.8 \
69
	man/systemd-getty-generator.8 \
Lines 680-686 endif Link Here
680
if ENABLE_COREDUMP
681
if ENABLE_COREDUMP
681
MANPAGES += \
682
MANPAGES += \
682
	man/coredump.conf.5 \
683
	man/coredump.conf.5 \
683
	man/coredumpctl.1
684
	man/coredumpctl.1 \
685
	man/systemd-coredump.8
684
MANPAGES_ALIAS += \
686
MANPAGES_ALIAS += \
685
	#
687
	#
686
688
Lines 1594-1605 EXTRA_DIST += \ Link Here
1594
	man/systemd-cat.xml \
1596
	man/systemd-cat.xml \
1595
	man/systemd-cgls.xml \
1597
	man/systemd-cgls.xml \
1596
	man/systemd-cgtop.xml \
1598
	man/systemd-cgtop.xml \
1599
	man/systemd-coredump.xml \
1597
	man/systemd-cryptsetup-generator.xml \
1600
	man/systemd-cryptsetup-generator.xml \
1598
	man/systemd-cryptsetup@.service.xml \
1601
	man/systemd-cryptsetup@.service.xml \
1599
	man/systemd-debug-generator.xml \
1602
	man/systemd-debug-generator.xml \
1600
	man/systemd-delta.xml \
1603
	man/systemd-delta.xml \
1601
	man/systemd-detect-virt.xml \
1604
	man/systemd-detect-virt.xml \
1602
	man/systemd-efi-boot-generator.xml \
1605
	man/systemd-efi-boot-generator.xml \
1606
	man/systemd-escape.xml \
1603
	man/systemd-fsck@.service.xml \
1607
	man/systemd-fsck@.service.xml \
1604
	man/systemd-fstab-generator.xml \
1608
	man/systemd-fstab-generator.xml \
1605
	man/systemd-getty-generator.xml \
1609
	man/systemd-getty-generator.xml \
(-)a/Makefile.am (-16 / +29 lines)
Lines 337-343 rootbin_PROGRAMS = \ Link Here
337
	systemd-notify \
337
	systemd-notify \
338
	systemd-ask-password \
338
	systemd-ask-password \
339
	systemd-tty-ask-password-agent \
339
	systemd-tty-ask-password-agent \
340
	systemd-machine-id-setup
340
	systemd-machine-id-setup \
341
	systemd-escape
341
342
342
bin_PROGRAMS = \
343
bin_PROGRAMS = \
343
	systemd-cgls \
344
	systemd-cgls \
Lines 382-388 systemgenerator_PROGRAMS = \ Link Here
382
dist_bashcompletion_DATA = \
383
dist_bashcompletion_DATA = \
383
	shell-completion/bash/busctl \
384
	shell-completion/bash/busctl \
384
	shell-completion/bash/journalctl \
385
	shell-completion/bash/journalctl \
385
	shell-completion/bash/systemctl \
386
	shell-completion/bash/systemd-analyze \
386
	shell-completion/bash/systemd-analyze \
387
	shell-completion/bash/systemd-cat \
387
	shell-completion/bash/systemd-cat \
388
	shell-completion/bash/systemd-cgls \
388
	shell-completion/bash/systemd-cgls \
Lines 394-401 dist_bashcompletion_DATA = \ Link Here
394
	shell-completion/bash/udevadm \
394
	shell-completion/bash/udevadm \
395
	shell-completion/bash/kernel-install
395
	shell-completion/bash/kernel-install
396
396
397
nodist_bashcompletion_DATA = \
398
	shell-completion/bash/systemctl
399
397
dist_zshcompletion_DATA = \
400
dist_zshcompletion_DATA = \
398
	shell-completion/zsh/_systemctl \
399
	shell-completion/zsh/_journalctl \
401
	shell-completion/zsh/_journalctl \
400
	shell-completion/zsh/_udevadm \
402
	shell-completion/zsh/_udevadm \
401
	shell-completion/zsh/_kernel-install \
403
	shell-completion/zsh/_kernel-install \
Lines 406-418 dist_zshcompletion_DATA = \ Link Here
406
	shell-completion/zsh/_systemd-delta \
408
	shell-completion/zsh/_systemd-delta \
407
	shell-completion/zsh/_systemd
409
	shell-completion/zsh/_systemd
408
410
411
nodist_zshcompletion_DATA = \
412
	shell-completion/zsh/_systemctl
413
414
EXTRA_DIST += \
415
	shell-completion/bash/systemctl.in \
416
	shell-completion/zsh/_systemctl.in
417
418
CLEANFILES += \
419
	$(nodist_bashcompletion_DATA) \
420
	$(nodist_zshcompletion_DATA)
421
409
dist_sysctl_DATA = \
422
dist_sysctl_DATA = \
410
	sysctl.d/50-default.conf
423
	sysctl.d/50-default.conf
411
424
412
dist_systemunit_DATA = \
425
dist_systemunit_DATA = \
413
	units/graphical.target \
426
	units/graphical.target \
414
	units/multi-user.target \
427
	units/multi-user.target \
415
	units/emergency.service \
416
	units/emergency.target \
428
	units/emergency.target \
417
	units/sysinit.target \
429
	units/sysinit.target \
418
	units/basic.target \
430
	units/basic.target \
Lines 1712-1717 systemd_update_done_SOURCES = \ Link Here
1712
1724
1713
systemd_update_done_LDADD = \
1725
systemd_update_done_LDADD = \
1714
	libsystemd-internal.la \
1726
	libsystemd-internal.la \
1727
	libsystemd-label.la \
1715
	libsystemd-shared.la
1728
	libsystemd-shared.la
1716
1729
1717
# ------------------------------------------------------------------------------
1730
# ------------------------------------------------------------------------------
Lines 2079-2084 systemd_cgroups_agent_LDADD = \ Link Here
2079
	libsystemd-shared.la
2092
	libsystemd-shared.la
2080
2093
2081
# ------------------------------------------------------------------------------
2094
# ------------------------------------------------------------------------------
2095
systemd_escape_SOURCES = \
2096
	src/escape/escape.c
2097
2098
systemd_escape_LDADD = \
2099
	libsystemd-shared.la
2100
2101
# -----------------------------------------------------------------------------
2082
systemctl_SOURCES = \
2102
systemctl_SOURCES = \
2083
	src/systemctl/systemctl.c
2103
	src/systemctl/systemctl.c
2084
2104
Lines 3319-3334 typelibs_DATA = \ Link Here
3319
3339
3320
CLEANFILES += $(gir_DATA) $(typelibs_DATA)
3340
CLEANFILES += $(gir_DATA) $(typelibs_DATA)
3321
endif # HAVE_INTROSPECTION
3341
endif # HAVE_INTROSPECTION
3322
3323
# move lib from $(libdir) to $(rootlibdir) and update devel link, if needed
3324
libgudev-install-hook:
3325
	libname=libgudev-1.0.so && $(move-to-rootlibdir)
3326
3327
libgudev-uninstall-hook:
3328
	rm -f $(DESTDIR)$(rootlibdir)/libgudev-1.0.so*
3329
3330
INSTALL_EXEC_HOOKS += libgudev-install-hook
3331
UNINSTALL_EXEC_HOOKS += libgudev-uninstall-hook
3332
endif
3342
endif
3333
3343
3334
EXTRA_DIST += \
3344
EXTRA_DIST += \
Lines 4337-4343 nodist_systemunit_DATA += \ Link Here
4337
	units/systemd-timesyncd.service
4347
	units/systemd-timesyncd.service
4338
4348
4339
GENERAL_ALIASES += \
4349
GENERAL_ALIASES += \
4340
	$(systemunitdir)/systemd-timesyncd.service $(pkgsysconfdir)/system/multi-user.target.wants/systemd-timesyncd.service
4350
	$(systemunitdir)/systemd-timesyncd.service $(pkgsysconfdir)/system/sysinit.target.wants/systemd-timesyncd.service
4341
4351
4342
EXTRA_DIST += \
4352
EXTRA_DIST += \
4343
	units/systemd-timesyncd.service.in
4353
	units/systemd-timesyncd.service.in
Lines 5189-5194 src/core/macros.%: src/core/macros.%.in Link Here
5189
src/%.policy.in: src/%.policy.in.in
5199
src/%.policy.in: src/%.policy.in.in
5190
	$(SED_PROCESS)
5200
	$(SED_PROCESS)
5191
5201
5202
shell-completion/%: shell-completion/%.in
5203
	$(SED_PROCESS)
5204
5192
%.rules: %.rules.in
5205
%.rules: %.rules.in
5193
	$(SED_PROCESS)
5206
	$(SED_PROCESS)
5194
5207
Lines 5216-5222 units/user/%: units/%.m4 Link Here
5216
	$(AM_V_M4)$(M4) -P $(M4_DEFINES) -DFOR_USER=1 < $< > $@
5229
	$(AM_V_M4)$(M4) -P $(M4_DEFINES) -DFOR_USER=1 < $< > $@
5217
5230
5218
if ENABLE_POLKIT
5231
if ENABLE_POLKIT
5219
dist_polkitpolicy_DATA = \
5232
nodist_polkitpolicy_DATA = \
5220
	$(polkitpolicy_files) \
5233
	$(polkitpolicy_files) \
5221
	$(polkitpolicy_in_in_files:.policy.in.in=.policy)
5234
	$(polkitpolicy_in_in_files:.policy.in.in=.policy)
5222
endif
5235
endif
(-)a/configure.ac (-1 / +3 lines)
Lines 310-316 AC_CHECK_DECLS([gettid, pivot_root, name_to_handle_at, setns, LO_FLAGS_PARTSCAN] Link Here
310
#include <linux/loop.h>
310
#include <linux/loop.h>
311
]])
311
]])
312
312
313
AC_CHECK_DECLS([IFLA_PHYS_PORT_ID,
313
AC_CHECK_DECLS([IFLA_MACVLAN_FLAGS,
314
                IFLA_VTI_REMOTE,
315
                IFLA_PHYS_PORT_ID,
314
                IFLA_BOND_AD_INFO,
316
                IFLA_BOND_AD_INFO,
315
                IFLA_VLAN_PROTOCOL,
317
                IFLA_VLAN_PROTOCOL,
316
                IFLA_VXLAN_LOCAL6,
318
                IFLA_VXLAN_LOCAL6,
(-)a/man/coredumpctl.xml (+2 lines)
Lines 210-215 Link Here
210
        <refsect1>
210
        <refsect1>
211
                <title>See Also</title>
211
                <title>See Also</title>
212
                <para>
212
                <para>
213
                        <citerefentry><refentrytitle>systemd-coredump</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
214
                        <citerefentry><refentrytitle>coredump.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
213
                        <citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
215
                        <citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
214
                        <citerefentry><refentrytitle>gdb</refentrytitle><manvolnum>1</manvolnum></citerefentry>
216
                        <citerefentry><refentrytitle>gdb</refentrytitle><manvolnum>1</manvolnum></citerefentry>
215
                </para>
217
                </para>
(-)a/man/crypttab.xml (+15 lines)
Lines 319-324 Link Here
319
                        </varlistentry>
319
                        </varlistentry>
320
320
321
                        <varlistentry>
321
                        <varlistentry>
322
                                <term><option>x-systemd.device-timeout=</option></term>
323
324
                                <listitem><para>Specifies how long
325
                                systemd should wait for a device to
326
                                show up before giving up on the
327
                                entry. The argument is a time in
328
                                seconds or explicitly specifified
329
                                units of <literal>s</literal>,
330
                                <literal>min</literal>,
331
                                <literal>h</literal>,
332
                                <literal>ms</literal>.
333
                                </para></listitem>
334
                        </varlistentry>
335
336
                        <varlistentry>
322
                                <term><option>tmp</option></term>
337
                                <term><option>tmp</option></term>
323
338
324
                                <listitem><para>The encrypted block device will
339
                                <listitem><para>The encrypted block device will
(-)a/man/file-hierarchy.xml (-2 / +5 lines)
Lines 190-196 Link Here
190
                                should prefer using the directory
190
                                should prefer using the directory
191
                                specified in it over directly
191
                                specified in it over directly
192
                                referencing
192
                                referencing
193
                                <filename>/tmp</filename> (see <citerefentry><refentrytitle>environ</refentrytitle><manvolnum>7</manvolnum></citerefentry> for details).</para></listitem>
193
                                <filename>/tmp</filename> (see <citerefentry><refentrytitle>environ</refentrytitle><manvolnum>7</manvolnum></citerefentry>
194
                                and
195
                                <ulink url="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_03">IEEE Std 1003.1</ulink> for details).</para></listitem>
194
                        </varlistentry>
196
                        </varlistentry>
195
197
196
                </variablelist>
198
                </variablelist>
Lines 461-467 Link Here
461
                                set they should prefer using the
463
                                set they should prefer using the
462
                                directory specified in it over
464
                                directory specified in it over
463
                                directly referencing
465
                                directly referencing
464
                                <filename>/var/tmp</filename> (see <citerefentry><refentrytitle>environ</refentrytitle><manvolnum>7</manvolnum></citerefentry> for details).
466
                                <filename>/var/tmp</filename> (see <citerefentry><refentrytitle>environ</refentrytitle><manvolnum>7</manvolnum></citerefentry>
467
                                for details).
465
                                </para></listitem>
468
                                </para></listitem>
466
                        </varlistentry>
469
                        </varlistentry>
467
470
(-)a/man/hostnamectl.xml (-40 / +40 lines)
Lines 102-115 Link Here
102
                        </varlistentry>
102
                        </varlistentry>
103
103
104
                        <varlistentry>
104
                        <varlistentry>
105
                                <term><option>-P</option></term>
106
                                <term><option>--privileged</option></term>
107
108
                                <listitem><para>Acquire privileges via PolicyKit
109
                                before executing the operation.</para></listitem>
110
                        </varlistentry>
111
112
                        <varlistentry>
113
                                <term><option>--static</option></term>
105
                                <term><option>--static</option></term>
114
                                <term><option>--transient</option></term>
106
                                <term><option>--transient</option></term>
115
                                <term><option>--pretty</option></term>
107
                                <term><option>--pretty</option></term>
Lines 149-161 Link Here
149
                        </varlistentry>
141
                        </varlistentry>
150
142
151
                        <varlistentry>
143
                        <varlistentry>
152
                                <term><command>set-hostname [NAME]</command></term>
144
                                <term><command>set-hostname <replaceable>NAME</replaceable></command></term>
153
145
154
                                <listitem><para>Set the system
146
                                <listitem><para>Set the system
155
                                hostname. By default, this will alter
147
                                hostname to
156
                                the pretty, the static, and the
148
                                <replaceable>NAME</replaceable>. By
157
                                transient hostname alike; however, if
149
                                default, this will alter the pretty,
158
                                one or more of
150
                                the static, and the transient hostname
151
                                alike; however, if one or more of
159
                                <option>--static</option>,
152
                                <option>--static</option>,
160
                                <option>--transient</option>,
153
                                <option>--transient</option>,
161
                                <option>--pretty</option> are used,
154
                                <option>--pretty</option> are used,
Lines 176-229 Link Here
176
                                the hostname string is not done if
169
                                the hostname string is not done if
177
                                only the transient and/or static host
170
                                only the transient and/or static host
178
                                names are set, and the pretty host
171
                                names are set, and the pretty host
179
                                name is left untouched. Pass the empty
172
                                name is left untouched.</para>
180
                                string <literal></literal> as the
173
181
                                hostname to reset the selected
174
                                <para>Pass the empty string
182
                                hostnames to their default (usually
175
                                <literal></literal> as the hostname to
176
                                reset the selected hostnames to their
177
                                default (usually
183
                                <literal>localhost</literal>).</para></listitem>
178
                                <literal>localhost</literal>).</para></listitem>
184
                        </varlistentry>
179
                        </varlistentry>
185
180
186
                        <varlistentry>
181
                        <varlistentry>
187
                                <term><command>set-icon-name [NAME]</command></term>
182
                                <term><command>set-icon-name <replaceable>NAME</replaceable></command></term>
188
183
189
                                <listitem><para>Set the system icon
184
                                <listitem><para>Set the system icon
190
                                name. The icon name is used by some
185
                                name to
191
                                graphical applications to visualize
186
                                <replaceable>NAME</replaceable>. The
192
                                this host. The icon name should follow
187
                                icon name is used by some graphical
193
                                the <ulink
188
                                applications to visualize this host.
189
                                The icon name should follow the <ulink
194
                                url="http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html">Icon
190
                                url="http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html">Icon
195
                                Naming Specification</ulink>. Pass an
191
                                Naming Specification</ulink>.</para>
196
                                empty string to this operation to
192
197
                                reset the icon name to the default
193
                                <para>Pass an empty string to reset
198
                                value, which is determined from chassis
194
                                the icon name to the default value,
199
                                type (see below) and possibly other
195
                                which is determined from chassis type
196
                                (see below) and possibly other
200
                                parameters.</para></listitem>
197
                                parameters.</para></listitem>
201
                        </varlistentry>
198
                        </varlistentry>
202
199
203
                        <varlistentry>
200
                        <varlistentry>
204
                                <term><command>set-chassis [TYPE]</command></term>
201
                                <term><command>set-chassis <replaceable>TYPE</replaceable></command></term>
205
202
206
                                <listitem><para>Set the chassis
203
                                <listitem><para>Set the chassis type
207
                                type. The chassis type is used by some
204
                                to <replaceable>TYPE</replaceable>.
205
                                The chassis type is used by some
208
                                graphical applications to visualize
206
                                graphical applications to visualize
209
                                the host or alter user
207
                                the host or alter user interaction.
210
                                interaction. Currently, the following
208
                                Currently, the following chassis types
211
                                chassis types are defined:
209
                                are defined:
212
                                <literal>desktop</literal>,
210
                                <literal>desktop</literal>,
213
                                <literal>laptop</literal>,
211
                                <literal>laptop</literal>,
214
                                <literal>server</literal>,
212
                                <literal>server</literal>,
215
                                <literal>tablet</literal>,
213
                                <literal>tablet</literal>,
216
                                <literal>handset</literal>, as well as
214
                                <literal>handset</literal>,
215
                                <literal>watch</literal>, as well as
217
                                the special chassis types
216
                                the special chassis types
218
                                <literal>vm</literal> and
217
                                <literal>vm</literal> and
219
                                <literal>container</literal> for
218
                                <literal>container</literal> for
220
                                virtualized systems that lack an
219
                                virtualized systems that lack an
221
                                immediate physical chassis. Pass an
220
                                immediate physical chassis.</para>
222
                                empty string to this operation to
221
223
                                reset the chassis type to the default
222
                                <para>Pass an empty string to reset
224
                                value which is determined from the
223
                                the chassis type to the default value
225
                                firmware and possibly other
224
                                which is determined from the firmware
226
                                parameters.</para></listitem>
225
                                and possibly other parameters.</para>
226
                                </listitem>
227
                        </varlistentry>
227
                        </varlistentry>
228
228
229
                </variablelist>
229
                </variablelist>
(-)a/man/journalctl.xml (+1 lines)
Lines 908-913 Link Here
908
                        <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
908
                        <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
909
                        <citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
909
                        <citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
910
                        <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
910
                        <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
911
                        <citerefentry><refentrytitle>coredumpctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
911
                        <citerefentry><refentrytitle>systemd.journal-fields</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
912
                        <citerefentry><refentrytitle>systemd.journal-fields</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
912
                        <citerefentry><refentrytitle>journald.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
913
                        <citerefentry><refentrytitle>journald.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
913
                </para>
914
                </para>
(-)a/man/localectl.xml (-8 lines)
Lines 90-103 Link Here
90
                        </varlistentry>
90
                        </varlistentry>
91
91
92
                        <varlistentry>
92
                        <varlistentry>
93
                                <term><option>-P</option></term>
94
                                <term><option>--privileged</option></term>
95
96
                                <listitem><para>Acquire privileges via PolicyKit
97
                                before executing the operation.</para></listitem>
98
                        </varlistentry>
99
100
                        <varlistentry>
101
                                <term><option>--no-convert</option></term>
93
                                <term><option>--no-convert</option></term>
102
94
103
                                <listitem><para>If
95
                                <listitem><para>If
(-)a/man/machine-info.xml (-1 / +2 lines)
Lines 138-144 Link Here
138
                                <literal>laptop</literal>,
138
                                <literal>laptop</literal>,
139
                                <literal>server</literal>,
139
                                <literal>server</literal>,
140
                                <literal>tablet</literal>,
140
                                <literal>tablet</literal>,
141
                                <literal>handset</literal>, as well as
141
				<literal>handset</literal>,
142
				<literal>watch</literal>, as well as
142
                                the special chassis types
143
                                the special chassis types
143
                                <literal>vm</literal> and
144
                                <literal>vm</literal> and
144
                                <literal>container</literal> for
145
                                <literal>container</literal> for
(-)a/man/sd_journal_get_cutoff_realtime_usec.xml (-13 / +23 lines)
Lines 74-98 Link Here
74
                <title>Description</title>
74
                <title>Description</title>
75
75
76
                <para><function>sd_journal_get_cutoff_realtime_usec()</function>
76
                <para><function>sd_journal_get_cutoff_realtime_usec()</function>
77
                gets the realtime (wallclock) timestamps of the first
77
                retrieves the realtime (wallclock) timestamps of the
78
                and last entries accessible in the journal.  It takes
78
                first and last entries accessible in the journal.  It
79
                three arguments: the journal context object and two
79
                takes three arguments: the journal context object
80
                pointers to 64-bit unsigned integers to store the
80
                <parameter>j</parameter> and two pointers
81
                timestamps in. The timestamps are in microseconds
81
                <parameter>from</parameter> and
82
                since the epoch,
82
                <parameter>to</parameter> pointing at 64-bit unsigned
83
                integers to store the timestamps in. The timestamps
84
                are in microseconds since the epoch,
83
                i.e. <constant>CLOCK_REALTIME</constant>. Either one
85
                i.e. <constant>CLOCK_REALTIME</constant>. Either one
84
                of the two timestamp arguments may be passed as
86
                of the two timestamp arguments may be passed as
85
                <constant>NULL</constant> in case the timestamp is not
87
                <constant>NULL</constant> in case the timestamp is not
86
                needed, but not both.</para>
88
                needed, but not both.</para>
87
89
88
                <para><function>sd_journal_get_cutoff_monotonic_usec()</function>
90
                <para><function>sd_journal_get_cutoff_monotonic_usec()</function>
89
                gets the monotonic timestamps of the first and last
91
                retrieves the monotonic timestamps of the first and
90
                entries accessible in the journal. It takes three
92
                last entries accessible in the journal. It takes three
91
                arguments: the journal context object, a 128-bit
93
                arguments: the journal context object
92
                identifier for the boot, and two pointers to 64-bit
94
                <parameter>j</parameter>, a 128-bit identifier for the
93
                unsigned integers to store the timestamps. The
95
                boot <parameter>boot_id</parameter>, and two pointers
94
                timestamps are in microseconds since boot-up of the
96
                to 64-bit unsigned integers to store the timestamps,
95
                specific boot,
97
                <parameter>from</parameter> and
98
                <parameter>to</parameter>. The timestamps are in
99
                microseconds since boot-up of the specific boot,
96
                i.e. <constant>CLOCK_MONOTONIC</constant>. Since the
100
                i.e. <constant>CLOCK_MONOTONIC</constant>. Since the
97
                monotonic clock begins new with every reboot it only
101
                monotonic clock begins new with every reboot it only
98
                defines a well-defined point in time when used
102
                defines a well-defined point in time when used
Lines 113-118 Link Here
113
                <function>sd_journal_get_cutoff_monotonic_usec()</function>
117
                <function>sd_journal_get_cutoff_monotonic_usec()</function>
114
                return 1 on success, 0 if not suitable entries are in
118
                return 1 on success, 0 if not suitable entries are in
115
                the journal or a negative errno-style error code.</para>
119
                the journal or a negative errno-style error code.</para>
120
121
                <para>Locations pointed to by parameters
122
                <parameter>from</parameter> and
123
                <parameter>to</parameter> will be set only if the
124
                return value is positive, and obviously, the
125
                parameters are non-null.</para>
116
        </refsect1>
126
        </refsect1>
117
127
118
        <refsect1>
128
        <refsect1>
(-)a/man/systemd-coredump.xml (+105 lines)
Line 0 Link Here
1
<?xml version='1.0'?> <!--*-nxml-*-->
2
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3
        "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4
5
<!--
6
  This file is part of systemd.
7
8
  Copyright 2014 Zbigniew Jędrzejewski-Szmek
9
10
  systemd is free software; you can redistribute it and/or modify it
11
  under the terms of the GNU Lesser General Public License as published by
12
  the Free Software Foundation; either version 2.1 of the License, or
13
  (at your option) any later version.
14
15
  systemd is distributed in the hope that it will be useful, but
16
  WITHOUT ANY WARRANTY; without even the implied warranty of
17
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18
  Lesser General Public License for more details.
19
20
  You should have received a copy of the GNU Lesser General Public License
21
  along with systemd; If not, see <http://www.gnu.org/licenses/>.
22
-->
23
24
<refentry id="systemd-coredump" conditional='ENABLE_COREDUMP'
25
          xmlns:xi="http://www.w3.org/2001/XInclude">
26
27
  <refentryinfo>
28
    <title>systemd-coredump</title>
29
    <productname>systemd</productname>
30
31
    <authorgroup>
32
      <author>
33
        <contrib>Developer</contrib>
34
        <firstname>Lennart</firstname>
35
        <surname>Poettering</surname>
36
        <email>lennart@poettering.net</email>
37
      </author>
38
    </authorgroup>
39
  </refentryinfo>
40
41
  <refmeta>
42
    <refentrytitle>systemd-coredump</refentrytitle>
43
    <manvolnum>8</manvolnum>
44
  </refmeta>
45
46
  <refnamediv>
47
    <refname>systemd-coredump</refname>
48
    <refpurpose>Log and store core dumps</refpurpose>
49
  </refnamediv>
50
51
  <refsynopsisdiv>
52
    <para><filename>/usr/lib/systemd/systemd-coredump</filename></para>
53
  </refsynopsisdiv>
54
55
  <refsect1>
56
    <title>Description</title>
57
58
    <para><command>systemd-coredump</command> can be used as a helper
59
    binary by the kernel when a user space program receives a fatal
60
    signal and dumps core. For it to be used in this capacity, it must
61
    be specified by the
62
    <varname>kernel.core_pattern</varname> <citerefentry project='man-pages'><refentrytitle>sysctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>
63
    setting. Systemd installs
64
    <filename>/usr/lib/sysctl.d/50-coredump.conf</filename> which
65
    configures <varname>kernel.core_pattern</varname> to invoke
66
    <command>systemd-coredump</command>. This file may be masked or
67
    overriden to use a different setting following normal
68
    <citerefentry><refentrytitle>sysctl.d</refentrytitle><manvolnum>5</manvolnum></citerefentry> rules.</para>
69
70
    <para>The behaviour of a specific program upon reception of a
71
    signal is governed by a few factors which are described in detail
72
    in <citerefentry project='man-pages'><refentrytitle>core</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
73
    In particular, the coredump will only be processed when the
74
    related resource limits are high enough. For programs started by
75
    <command>systemd</command> those may be set using
76
    <varname>LimitCore=</varname> (see
77
    <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>).
78
    </para>
79
80
    <para><command>systemd-coredump</command> will log the coredump
81
    including a backtrace if possible, and store the core (contents of
82
    process' memory contents) in an external file on disk in
83
    <filename>/var/lib/systemd/coredump</filename>, or directly in
84
    the journal. This behaviour may be modified using
85
    <citerefentry><refentrytitle>coredump.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
86
87
    <para>Apart from the
88
    <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
89
    log viewer,
90
    <citerefentry><refentrytitle>coredumpctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
91
    may be used to list and extract coredumps.</para>
92
  </refsect1>
93
94
  <refsect1>
95
    <title>See Also</title>
96
    <para>
97
      <citerefentry><refentrytitle>coredump.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
98
      <citerefentry><refentrytitle>coredumpctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
99
      <citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
100
      <citerefentry project='man-pages'><refentrytitle>core</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
101
      <citerefentry><refentrytitle>sysctl.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
102
      <citerefentry><refentrytitle>systemd-sysctl.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
103
    </para>
104
  </refsect1>
105
</refentry>
(-)a/man/systemd-escape.xml (+193 lines)
Line 0 Link Here
1
<?xml version='1.0'?> <!--*-nxml-*-->
2
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3
        "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4
5
<!--
6
  This file is part of systemd.
7
8
  Copyright 2014 Lennart Poettering
9
10
  systemd is free software; you can redistribute it and/or modify it
11
  under the terms of the GNU Lesser General Public License as published by
12
  the Free Software Foundation; either version 2.1 of the License, or
13
  (at your option) any later version.
14
15
  systemd is distributed in the hope that it will be useful, but
16
  WITHOUT ANY WARRANTY; without even the implied warranty of
17
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18
  Lesser General Public License for more details.
19
20
  You should have received a copy of the GNU Lesser General Public License
21
  along with systemd; If not, see <http://www.gnu.org/licenses/>.
22
-->
23
24
<refentry id="systemd-escape"
25
          xmlns:xi="http://www.w3.org/2001/XInclude">
26
27
        <refentryinfo>
28
                <title>systemd-escape</title>
29
                <productname>systemd</productname>
30
31
                <authorgroup>
32
                        <author>
33
                                <contrib>Developer</contrib>
34
                                <firstname>Lennart</firstname>
35
                                <surname>Poettering</surname>
36
                                <email>lennart@poettering.net</email>
37
                        </author>
38
                </authorgroup>
39
        </refentryinfo>
40
41
        <refmeta>
42
                <refentrytitle>systemd-escape</refentrytitle>
43
                <manvolnum>1</manvolnum>
44
        </refmeta>
45
46
        <refnamediv>
47
                <refname>systemd-escape</refname>
48
                <refpurpose>Escape strings for usage in system unit names</refpurpose>
49
        </refnamediv>
50
51
        <refsynopsisdiv>
52
                <cmdsynopsis>
53
                        <command>systemd-escape <arg choice="opt" rep="repeat">OPTIONS</arg> <arg choice="opt" rep="repeat">STRING</arg></command>
54
                </cmdsynopsis>
55
        </refsynopsisdiv>
56
57
        <refsect1>
58
                <title>Description</title>
59
60
                <para><command>systemd-escape</command> may be used to
61
                escape strings for inclusion in systemd unit
62
                names. The command may be used to escape and to undo
63
                escaping of strings.</para>
64
65
                <para>The command takes any number of strings on the
66
                command line, and will process them individually, one
67
                after the other. It will output them separated by
68
                spaces to stdout.</para>
69
70
                <para>By default this command will escape the strings
71
                passed, unless <option>--unescape</option> is passed
72
                which results in the inverse operation being
73
                applied. If <option>--mangle</option> a special mode
74
                of escaping is applied instead, which assumes a string
75
                to be already escaped but will escape everything that
76
                appears obviously non-escaped.</para>
77
        </refsect1>
78
79
        <refsect1>
80
                <title>Options</title>
81
82
                <para>The following options are understood:</para>
83
84
                <variablelist>
85
                        <varlistentry>
86
                                <term><option>--suffix=</option></term>
87
88
                                <listitem><para>Appends the specified
89
                                unit type suffix to the escaped
90
                                string. Takes one of the unit types
91
                                supported by systemd, such as
92
                                <literal>.service</literal> or
93
                                <literal>.mount</literal>. May not be
94
                                used in conjunction with
95
                                <option>--template=</option>,
96
                                <option>--unescape</option> or
97
                                <option>--mangle</option>.</para></listitem>
98
                        </varlistentry>
99
100
                        <varlistentry>
101
                                <term><option>--template=</option></term>
102
103
                                <listitem><para>Inserts the escaped
104
                                strings in a unit name template. Takes
105
                                a unit name template such as
106
                                <filename>foobar@.service</filename>
107
                                May not be used in conjunction with
108
                                <option>--suffix=</option>,
109
                                <option>--unescape</option> or
110
                                <option>--mangle</option>.</para></listitem>
111
                        </varlistentry>
112
113
                        <varlistentry>
114
                                <term><option>--path</option></term>
115
                                <term><option>-p</option></term>
116
117
                                <listitem><para>When escaping or
118
                                unescaping a string, assume it refers
119
                                to a file system path. This enables
120
                                special processing of the initial
121
                                <literal>/</literal> of the
122
                                path.</para></listitem>
123
                        </varlistentry>
124
125
                        <varlistentry>
126
                                <term><option>--unescape</option></term>
127
128
                                <listitem><para>Instead of escaping
129
                                the specified strings, undo the
130
                                escaping, reversing the operation. May
131
                                not be used in conjunction with
132
                                <option>--suffix=</option>,
133
                                <option>--template=</option> or
134
                                <option>--mangle</option>.</para></listitem>
135
                        </varlistentry>
136
137
                        <varlistentry>
138
                                <term><option>--mangle</option></term>
139
140
                                <listitem><para>Like
141
                                <option>--escape</option>, but only
142
                                escape characters that are obviously
143
                                not escaped yet, and possibly
144
                                automatically append an appropriate
145
                                unit type suffix to the string. May
146
                                not be used in conjunction with
147
                                <option>--suffix=</option>,
148
                                <option>--template=</option> or
149
                                <option>--unescape</option>.</para></listitem>
150
                        </varlistentry>
151
152
                        <xi:include href="standard-options.xml" xpointer="help" />
153
                        <xi:include href="standard-options.xml" xpointer="version" />
154
                </variablelist>
155
156
        </refsect1>
157
158
        <refsect1>
159
                <title>Examples</title>
160
161
                <para>Escape a single string:</para>
162
                <programlisting>$ systemd-escape 'Hallöchen, Meister'
163
Hall\xc3\xb6chen\x2c\x20Meister</programlisting>
164
165
                <para>To undo escaping on a single string:</para>
166
                <programlisting>$ systemd-escape -u 'Hall\xc3\xb6chen\x2c\x20Meister'
167
Hallöchen, Meister</programlisting>
168
169
                <para>To generate the mount unit for a path:</para>
170
                <programlisting>$ systemd-escape -p --suffix=mount "/tmp//waldi/foobar/"
171
tmp-waldi-foobar.mount</programlisting>
172
173
                <para>To generate instance names of three strings</para>
174
                <programlisting>$ systemd-escape --template=systemd-nspawn@.service 'My Container 1' 'containerb' 'container/III'
175
systemd-nspawn@My\x20Container\x201.service systemd-nspawn@containerb.service systemd-nspawn@container-III.service</programlisting>
176
        </refsect1>
177
178
        <refsect1>
179
                <title>Exit status</title>
180
181
                <para>On success, 0 is returned, a non-zero failure
182
                code otherwise.</para>
183
        </refsect1>
184
185
        <refsect1>
186
                <title>See Also</title>
187
                <para>
188
                        <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
189
                        <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
190
                </para>
191
        </refsect1>
192
193
</refentry>
(-)a/man/systemd-journald.service.xml (+1 lines)
Lines 248-253 Link Here
248
                        <citerefentry><refentrytitle>journald.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
248
                        <citerefentry><refentrytitle>journald.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
249
                        <citerefentry><refentrytitle>systemd.journal-fields</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
249
                        <citerefentry><refentrytitle>systemd.journal-fields</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
250
                        <citerefentry><refentrytitle>sd-journal</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
250
                        <citerefentry><refentrytitle>sd-journal</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
251
                        <citerefentry><refentrytitle>systemd-coredump</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
251
                        <citerefentry><refentrytitle>setfacl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
252
                        <citerefentry><refentrytitle>setfacl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
252
                        <command>pydoc systemd.journal</command>.
253
                        <command>pydoc systemd.journal</command>.
253
                </para>
254
                </para>
(-)a/man/systemd.netdev.xml (-2 / +6 lines)
Lines 60-66 Link Here
60
60
61
                <para>Virtual Network Device files must have the extension
61
                <para>Virtual Network Device files must have the extension
62
                <filename>.netdev</filename>; other extensions are ignored. Virtual
62
                <filename>.netdev</filename>; other extensions are ignored. Virtual
63
                network devices are created as soon as networkd is started.</para>
63
                network devices are created as soon as networkd is started. If a netdev
64
                with the specified name already exists, networkd will use that as-is
65
                rather than create its own. Note that the settings of the pre-existing
66
                netdev will not be changed by networkd.</para>
64
67
65
                <para>The <filename>.netdev</filename> files are read from the files located in the
68
                <para>The <filename>.netdev</filename> files are read from the files located in the
66
                system network directory <filename>/usr/lib/systemd/network</filename>,
69
                system network directory <filename>/usr/lib/systemd/network</filename>,
Lines 163-169 Link Here
163
                                                <literal>macvlan</literal>, <literal>vxlan</literal>,
166
                                                <literal>macvlan</literal>, <literal>vxlan</literal>,
164
                                                <literal>ipip</literal>, <literal>gre</literal>,
167
                                                <literal>ipip</literal>, <literal>gre</literal>,
165
                                                <literal>sit</literal>, <literal>vti</literal>,
168
                                                <literal>sit</literal>, <literal>vti</literal>,
166
                                                <literal>veth</literal>, and <literal>dummy</literal>
169
                                                <literal>veth</literal>, <literal>tun</literal>,
170
                                                <literal>tap</literal> and <literal>dummy</literal>
167
                                                are supported. This option is compulsory.</para>
171
                                                are supported. This option is compulsory.</para>
168
                                        </listitem>
172
                                        </listitem>
169
                                </varlistentry>
173
                                </varlistentry>
(-)a/man/systemd.time.xml (-6 / +12 lines)
Lines 243-254 Link Here
243
243
244
                <para>The special expressions
244
                <para>The special expressions
245
                <literal>hourly</literal>, <literal>daily</literal>,
245
                <literal>hourly</literal>, <literal>daily</literal>,
246
                <literal>monthly</literal> and <literal>weekly</literal>
246
                <literal>monthly</literal>, <literal>weekly</literal>,
247
                may be used as calendar events which refer to
247
                and <literal>yearly</literal> or
248
                <literal>*-*-* *:00:00</literal>, <literal>*-*-*
248
                <literal>annually</literal> may be used as calendar
249
                00:00:00</literal>, <literal>*-*-01 00:00:00</literal> and
249
                events which refer to
250
                <literal>Mon *-*-* 00:00:00</literal>,
250
                <literal>*-*-* *:00:00</literal>,
251
                respectively.</para>
251
                <literal>*-*-* 00:00:00</literal>,
252
                <literal>*-*-01 00:00:00</literal>,
253
                <literal>Mon *-*-* 00:00:00</literal>, and
254
                <literal>*-01-01 00:00:00</literal> respectively.
255
                </para>
252
256
253
                <para>Examples for valid timestamps and their
257
                <para>Examples for valid timestamps and their
254
                normalized form:</para>
258
                normalized form:</para>
Lines 277-282 Wed-Sat,Tue 12-10-15 1:2:3 → Tue-Sat 2012-10-15 01:02:03 Link Here
277
                     daily → *-*-* 00:00:00
281
                     daily → *-*-* 00:00:00
278
                   monthly → *-*-01 00:00:00
282
                   monthly → *-*-01 00:00:00
279
                    weekly → Mon *-*-* 00:00:00
283
                    weekly → Mon *-*-* 00:00:00
284
                    yearly → *-01-01 00:00:00
285
                  annually → *-01-01 00:00:00
280
                     *:2/3 → *-*-* *:02/3:00</programlisting>
286
                     *:2/3 → *-*-* *:02/3:00</programlisting>
281
287
282
                  <para>Calendar events are used by timer units, see
288
                  <para>Calendar events are used by timer units, see
(-)a/man/systemd.unit.xml (-3 / +19 lines)
Lines 74-79 Link Here
74
<filename>$HOME/.config/systemd/user/*</filename>
74
<filename>$HOME/.config/systemd/user/*</filename>
75
<filename>/etc/systemd/user/*</filename>
75
<filename>/etc/systemd/user/*</filename>
76
<filename>/run/systemd/user/*</filename>
76
<filename>/run/systemd/user/*</filename>
77
<filename>$XDG_DATA_HOME/systemd/user/*</filename>
78
<filename>$HOME/.local/share/systemd/user/*</filename>
77
<filename>/usr/lib/systemd/user/*</filename>
79
<filename>/usr/lib/systemd/user/*</filename>
78
<filename>...</filename>
80
<filename>...</filename>
79
                </literallayout></para>
81
                </literallayout></para>
Lines 339-346 Link Here
339
                        <entry>Runtime units</entry>
341
                        <entry>Runtime units</entry>
340
                      </row>
342
                      </row>
341
                      <row>
343
                      <row>
344
                        <entry><filename>$XDG_DATA_HOME/systemd/user</filename></entry>
345
                        <entry>Units of packages that have been installed in the home directory (only used when $XDG_DATA_HOME is set)</entry>
346
                      </row>
347
                      <row>
348
                        <entry><filename>$HOME/.local/share/systemd/user</filename></entry>
349
                        <entry>Units of packages that have been installed in the home directory (only used when $XDG_DATA_HOME is not set)</entry>
350
                      </row>
351
                      <row>
342
                        <entry><filename>/usr/lib/systemd/user</filename></entry>
352
                        <entry><filename>/usr/lib/systemd/user</filename></entry>
343
                        <entry>Units of installed packages</entry>
353
                        <entry>Units of packages that have been installed system-wide</entry>
344
                      </row>
354
                      </row>
345
                    </tbody>
355
                    </tbody>
346
                  </tgroup>
356
                  </tgroup>
Lines 931-937 Link Here
931
                                <varname>x86</varname>,
941
                                <varname>x86</varname>,
932
                                <varname>x86-64</varname>,
942
                                <varname>x86-64</varname>,
933
                                <varname>ppc</varname>,
943
                                <varname>ppc</varname>,
944
                                <varname>ppc-le</varname>,
934
                                <varname>ppc64</varname>,
945
                                <varname>ppc64</varname>,
946
                                <varname>ppc64-le</varname>,
935
                                <varname>ia64</varname>,
947
                                <varname>ia64</varname>,
936
                                <varname>parisc</varname>,
948
                                <varname>parisc</varname>,
937
                                <varname>parisc64</varname>,
949
                                <varname>parisc64</varname>,
Lines 940-946 Link Here
940
                                <varname>sparc</varname>,
952
                                <varname>sparc</varname>,
941
                                <varname>sparc64</varname>,
953
                                <varname>sparc64</varname>,
942
                                <varname>mips</varname>,
954
                                <varname>mips</varname>,
955
                                <varname>mips-le</varname>,
943
                                <varname>mips64</varname>,
956
                                <varname>mips64</varname>,
957
                                <varname>mips64-le</varname>,
944
                                <varname>alpha</varname>,
958
                                <varname>alpha</varname>,
945
                                <varname>arm</varname>,
959
                                <varname>arm</varname>,
946
                                <varname>arm-be</varname>,
960
                                <varname>arm-be</varname>,
Lines 948-954 Link Here
948
                                <varname>arm64-be</varname>,
962
                                <varname>arm64-be</varname>,
949
                                <varname>sh</varname>,
963
                                <varname>sh</varname>,
950
                                <varname>sh64</varname>,
964
                                <varname>sh64</varname>,
951
                                <varname>m86k</varname> to test
965
                                <varname>m86k</varname>,
966
                                <varname>tilegx</varname>,
967
                                <varname>cris</varname> to test
952
                                against a specific architecture. The
968
                                against a specific architecture. The
953
                                architecture is determined from the
969
                                architecture is determined from the
954
                                information returned by
970
                                information returned by
Lines 979-990 Link Here
979
                                virtualization solution, or one of
995
                                virtualization solution, or one of
980
                                <varname>qemu</varname>,
996
                                <varname>qemu</varname>,
981
                                <varname>kvm</varname>,
997
                                <varname>kvm</varname>,
998
                                <varname>zvm</varname>,
982
                                <varname>vmware</varname>,
999
                                <varname>vmware</varname>,
983
                                <varname>microsoft</varname>,
1000
                                <varname>microsoft</varname>,
984
                                <varname>oracle</varname>,
1001
                                <varname>oracle</varname>,
985
                                <varname>xen</varname>,
1002
                                <varname>xen</varname>,
986
                                <varname>bochs</varname>,
1003
                                <varname>bochs</varname>,
987
                                <varname>chroot</varname>,
988
                                <varname>uml</varname>,
1004
                                <varname>uml</varname>,
989
                                <varname>openvz</varname>,
1005
                                <varname>openvz</varname>,
990
                                <varname>lxc</varname>,
1006
                                <varname>lxc</varname>,
(-)a/man/sysusers.d.xml (-21 / +46 lines)
Lines 53-84 Link Here
53
                <title>Description</title>
53
                <title>Description</title>
54
54
55
                <para><command>systemd-sysusers</command> uses the
55
                <para><command>systemd-sysusers</command> uses the
56
                files from <filename>/usr/lib/sysusers.d/</filename>
56
                files from <filename>sysusers.d</filename> directory
57
                to create system users and groups at package
57
                to create system users and groups at package
58
                installation or boot time. This tool may be used for
58
                installation or boot time. This tool may be used to
59
                allocating system users and groups only, it is not
59
                allocate system users and groups only, it is not
60
                useful for creating non-system users and groups, as it
60
                useful for creating non-system users and groups, as it
61
                accessed <filename>/etc/passwd</filename> and
61
                accesses <filename>/etc/passwd</filename> and
62
                <filename>/etc/group</filename> directly, bypassing
62
                <filename>/etc/group</filename> directly, bypassing
63
                any more complex user database, for example any
63
                any more complex user databases, for example any
64
                database involving NIS or LDAP.</para>
64
                database involving NIS or LDAP.</para>
65
66
        </refsect1>
65
        </refsect1>
67
66
68
        <refsect1>
67
        <refsect1>
69
                <title>File Format</title>
68
                <title>Configuration Format</title>
70
71
                <para>Each file shall be named in the style of
72
                <filename><replaceable>package</replaceable>.conf</filename>.</para>
73
69
74
                <para>All files are sorted by their filename in
70
                <para>Each configuration file shall be named in the
75
                lexicographic order, regardless of which of the
71
                style of
76
                directories they reside in. If multiple files specify
72
                <filename><replaceable>package</replaceable>.conf</filename>
77
                the same user or group, the entry in the file with the
73
                or
78
                lexicographically earliest name will be applied, all
74
                <filename><replaceable>package</replaceable>-<replaceable>part</replaceable>.conf</filename>.
79
                all other conflicting entries will be logged as
75
                The second variant should be used when it is desirable
80
                errors. Users and groups are
76
                to make it easy to override just this part of
81
                processed in the order they are listed.</para>
77
                configuration.</para>
82
78
83
                <para>The file format is one line per user or group
79
                <para>The file format is one line per user or group
84
                containing name, ID and GECOS field description:</para>
80
                containing name, ID and GECOS field description:</para>
Lines 106-112 m authd input</programlisting> Link Here
106
                                        group will be set to the group
102
                                        group will be set to the group
107
                                        bearing the same name. The
103
                                        bearing the same name. The
108
                                        user's shell will be set to
104
                                        user's shell will be set to
109
                                        <filename>/sbin/login</filename>,
105
                                        <filename>/sbin/nologin</filename>,
110
                                        the home directory to
106
                                        the home directory to
111
                                        <filename>/</filename>. The
107
                                        <filename>/</filename>. The
112
                                        account will be created
108
                                        account will be created
Lines 142-148 m authd input</programlisting> Link Here
142
                        <title>Name</title>
138
                        <title>Name</title>
143
139
144
                        <para>The name field specifies the user or
140
                        <para>The name field specifies the user or
145
                        group name. It should be be shorter than 256
141
                        group name. It should be be shorter than 31
146
                        characters and avoid any non-ASCII characters,
142
                        characters and avoid any non-ASCII characters,
147
                        and not begin with a numeric character. It is
143
                        and not begin with a numeric character. It is
148
                        strongly recommended to pick user and group
144
                        strongly recommended to pick user and group
Lines 193-202 m authd input</programlisting> Link Here
193
        </refsect1>
189
        </refsect1>
194
190
195
        <refsect1>
191
        <refsect1>
192
                <title>Overriding vendor configuration</title>
193
194
                <para>Note that <command>systemd-sysusers</command>
195
                will do nothing if the specified users or groups
196
                already exist, so normally there no reason to override
197
                <filename>sysusers.d</filename> vendor configuration,
198
                except to block certain users or groups from being
199
                created.</para>
200
201
                <para>Files in <filename>/etc/sysusers.d</filename>
202
                override files with the same name in
203
                <filename>/usr/lib/sysusers.d</filename> and
204
                <filename>/run/sysusers.d</filename>. Files in
205
                <filename>/run/sysusers.d</filename> override files
206
                with the same name in
207
                <filename>/usr/lib/sysusers.d</filename>. The scheme is the same as for
208
                <citerefentry><refentrytitle>tmpfiles.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
209
                except for the directory name.</para>
210
211
                <para>If the administrator wants to disable a
212
                configuration file supplied by the vendor, the
213
                recommended way is to place a symlink to
214
                <filename>/dev/null</filename> in
215
                <filename>/etc/sysusers.d/</filename> bearing the
216
                same filename.</para>
217
        </refsect1>
218
219
        <refsect1>
196
                <title>See Also</title>
220
                <title>See Also</title>
197
                <para>
221
                <para>
198
                        <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
222
                        <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
199
                        <citerefentry><refentrytitle>systemd-sysusers</refentrytitle><manvolnum>8</manvolnum></citerefentry>
223
                        <citerefentry><refentrytitle>systemd-sysusers</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
224
                        <citerefentry><refentrytitle>tmpfiles.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>
200
                </para>
225
                </para>
201
        </refsect1>
226
        </refsect1>
202
227
(-)a/rules/99-systemd.rules.in (-1 / +1 lines)
Lines 43-49 SUBSYSTEM=="net", KERNEL!="lo", TAG+="systemd", ENV{SYSTEMD_ALIAS}+="/sys/subsys Link Here
43
SUBSYSTEM=="bluetooth", TAG+="systemd", ENV{SYSTEMD_ALIAS}+="/sys/subsystem/bluetooth/devices/%k"
43
SUBSYSTEM=="bluetooth", TAG+="systemd", ENV{SYSTEMD_ALIAS}+="/sys/subsystem/bluetooth/devices/%k"
44
44
45
SUBSYSTEM=="bluetooth", TAG+="systemd", ENV{SYSTEMD_WANTS}+="bluetooth.target"
45
SUBSYSTEM=="bluetooth", TAG+="systemd", ENV{SYSTEMD_WANTS}+="bluetooth.target"
46
ENV{ID_SMARTCARD_READER}=="*?", TAG+="systemd", ENV{SYSTEMD_WANTS}+="smartcard.target"
46
ENV{ID_SMARTCARD_READER}=="?*", TAG+="systemd", ENV{SYSTEMD_WANTS}+="smartcard.target"
47
SUBSYSTEM=="sound", KERNEL=="card*", TAG+="systemd", ENV{SYSTEMD_WANTS}+="sound.target"
47
SUBSYSTEM=="sound", KERNEL=="card*", TAG+="systemd", ENV{SYSTEMD_WANTS}+="sound.target"
48
48
49
SUBSYSTEM=="printer", TAG+="systemd", ENV{SYSTEMD_WANTS}+="printer.target"
49
SUBSYSTEM=="printer", TAG+="systemd", ENV{SYSTEMD_WANTS}+="printer.target"
(-)a/shell-completion/bash/.gitignore (+1 lines)
Line 0 Link Here
1
/systemctl
(-)a/shell-completion/bash/hostnamectl (+3 lines)
Lines 39-44 _hostnamectl() { Link Here
39
                [STANDALONE]='status'
39
                [STANDALONE]='status'
40
                     [ICONS]='set-icon-name'
40
                     [ICONS]='set-icon-name'
41
                      [NAME]='set-hostname'
41
                      [NAME]='set-hostname'
42
                   [CHASSIS]='set-chassis'
42
        )
43
        )
43
44
44
        for ((i=0; i < COMP_CWORD; i++)); do
45
        for ((i=0; i < COMP_CWORD; i++)); do
Lines 50-55 _hostnamectl() { Link Here
50
51
51
        if [[ -z $verb ]]; then
52
        if [[ -z $verb ]]; then
52
                comps=${VERBS[*]}
53
                comps=${VERBS[*]}
54
        elif __contains_word "$verb" ${VERBS[CHASSIS]}; then
55
                comps='desktop laptop server tablet handset watch vm container'
53
        elif __contains_word "$verb" ${VERBS[STANDALONE]} ${VERBS[ICONS]} ${VERBS[NAME]}; then
56
        elif __contains_word "$verb" ${VERBS[STANDALONE]} ${VERBS[ICONS]} ${VERBS[NAME]}; then
54
                comps=''
57
                comps=''
55
        fi
58
        fi
(-)a/shell-completion/bash/journalctl (-2 / +7 lines)
Lines 35-40 __journal_fields=(MESSAGE{,_ID} PRIORITY CODE_{FILE,LINE,FUNC} Link Here
35
                  _UDEV_{SYSNAME,DEVNODE,DEVLINK}
35
                  _UDEV_{SYSNAME,DEVNODE,DEVLINK}
36
                  __CURSOR __{REALTIME,MONOTONIC}_TIMESTAMP)
36
                  __CURSOR __{REALTIME,MONOTONIC}_TIMESTAMP)
37
37
38
__syslog_priorities=(emerg alert crit err warning notice info debug)
39
38
_journalctl() {
40
_journalctl() {
39
        local field_vals= cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
41
        local field_vals= cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
40
        local -A OPTS=(
42
        local -A OPTS=(
Lines 44-51 _journalctl() { Link Here
44
                              --no-tail -q --quiet --setup-keys --this-boot --verify
46
                              --no-tail -q --quiet --setup-keys --this-boot --verify
45
                              --version --list-catalog --update-catalog --list-boots'
47
                              --version --list-catalog --update-catalog --list-boots'
46
                       [ARG]='-b --boot --this-boot -D --directory --file -F --field
48
                       [ARG]='-b --boot --this-boot -D --directory --file -F --field
47
                              -o --output -u --unit --user-unit'
49
                              -o --output -u --unit --user-unit -p --priority'
48
                [ARGUNKNOWN]='-c --cursor --interval -n --lines -p --priority --since --until
50
                [ARGUNKNOWN]='-c --cursor --interval -n --lines --since --until
49
                              --verify-key'
51
                              --verify-key'
50
        )
52
        )
51
53
Lines 68-73 _journalctl() { Link Here
68
                        --field|-F)
70
                        --field|-F)
69
                                comps=${__journal_fields[*]}
71
                                comps=${__journal_fields[*]}
70
                        ;;
72
                        ;;
73
                        --priority|-p)
74
                                comps=${__syslog_priorities[*]}
75
                        ;;
71
                        --unit|-u)
76
                        --unit|-u)
72
                                comps=$(journalctl -F '_SYSTEMD_UNIT' 2>/dev/null)
77
                                comps=$(journalctl -F '_SYSTEMD_UNIT' 2>/dev/null)
73
                        ;;
78
                        ;;
(-)a/shell-completion/bash/systemctl (-226 lines)
Lines 1-226 Link Here
1
# systemctl(1) completion                                 -*- shell-script -*-
2
#
3
# This file is part of systemd.
4
#
5
# Copyright 2010 Ran Benita
6
#
7
# systemd is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU Lesser General Public License as published by
9
# the Free Software Foundation; either version 2.1 of the License, or
10
# (at your option) any later version.
11
#
12
# systemd is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
# General Public License for more details.
16
#
17
# You should have received a copy of the GNU Lesser General Public License
18
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
19
20
__systemctl() {
21
        local mode=$1; shift 1
22
        systemctl $mode --full --no-legend "$@"
23
}
24
25
__systemd_properties() {
26
        local mode=$1
27
        { __systemctl -a $mode show;
28
         systemd --dump-configuration-items; } |
29
        while IFS='=' read -r key value; do
30
            [[ $value ]] && echo "$key"
31
        done
32
}
33
34
__contains_word () {
35
        local w word=$1; shift
36
        for w in "$@"; do
37
                [[ $w = "$word" ]] && return
38
        done
39
}
40
41
__filter_units_by_property () {
42
        local mode=$1 property=$2 value=$3 ; shift 3
43
        local units=("$@")
44
        local props
45
        IFS=$'\n' read -rd '' -a props < \
46
            <(__systemctl $mode show --property "$property" -- "${units[@]}")
47
        for ((i=0; $i < ${#units[*]}; i++)); do
48
                if [[ "${props[i]}" = "$property=$value" ]]; then
49
                        echo " ${units[i]}"
50
                fi
51
        done
52
}
53
54
__get_all_units      () { __systemctl $1 list-units --all \
55
        | { while read -r a b; do echo " $a"; done; }; }
56
__get_active_units   () { __systemctl $1 list-units       \
57
        | { while read -r a b; do echo " $a"; done; }; }
58
__get_startable_units () { __systemctl $1 list-units --all -t service,timer,socket,mount,automount,path,snapshot,swap \
59
        | { while read -r a b c d; do [[ $c == "inactive" || $c == "failed" ]] && echo " $a"; done; }; }
60
__get_failed_units   () { __systemctl $1 list-units       \
61
        | { while read -r a b c d; do [[ $c == "failed"   ]] && echo " $a"; done; }; }
62
__get_enabled_units  () { __systemctl $1 list-unit-files  \
63
        | { while read -r a b c  ; do [[ $b == "enabled"  ]] && echo " $a"; done; }; }
64
__get_disabled_units () { __systemctl $1 list-unit-files  \
65
        | { while read -r a b c  ; do [[ $b == "disabled" ]] && echo " $a"; done; }; }
66
__get_masked_units   () { __systemctl $1 list-unit-files  \
67
        | { while read -r a b c  ; do [[ $b == "masked"   ]] && echo " $a"; done; }; }
68
69
_systemctl () {
70
        local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
71
        local i verb comps mode
72
73
        local -A OPTS=(
74
               [STANDALONE]='--all -a --reverse --after --before --defaults --fail --ignore-dependencies --failed --force -f --full -l --global
75
                             --help -h --no-ask-password --no-block --no-legend --no-pager --no-reload --no-wall
76
                             --quiet -q --privileged -P --system --user --version --runtime --recursive -r'
77
                      [ARG]='--host -H --kill-who --property -p --signal -s --type -t --state --root'
78
        )
79
80
        if __contains_word "--user" ${COMP_WORDS[*]}; then
81
            mode=--user
82
        else
83
            mode=--system
84
        fi
85
86
        if __contains_word "$prev" ${OPTS[ARG]}; then
87
                case $prev in
88
                        --signal|-s)
89
                                comps=$(compgen -A signal)
90
                        ;;
91
                        --type|-t)
92
                                comps='automount device mount path service snapshot socket swap target timer'
93
                        ;;
94
                        --state)
95
                                comps='loaded not-found stub
96
                                       active inactive
97
                                       dead elapsed exited listening mounted plugged running waiting'
98
                        ;;
99
                        --kill-who)
100
                                comps='all control main'
101
                        ;;
102
                        --root)
103
                                comps=$(compgen -A directory -- "$cur" )
104
                                compopt -o filenames
105
                        ;;
106
                        --host|-H)
107
                                comps=$(compgen -A hostname)
108
                        ;;
109
                        --property|-p)
110
                                comps=$(__systemd_properties $mode)
111
                        ;;
112
                esac
113
                COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
114
                return 0
115
        fi
116
117
        if [[ "$cur" = -* ]]; then
118
                COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
119
                return 0
120
        fi
121
122
        local -A VERBS=(
123
                [ALL_UNITS]='is-active is-failed is-enabled status show cat mask preset help list-dependencies'
124
            [ENABLED_UNITS]='disable'
125
           [DISABLED_UNITS]='enable'
126
        [REENABLABLE_UNITS]='reenable'
127
             [FAILED_UNITS]='reset-failed'
128
          [STARTABLE_UNITS]='start'
129
          [STOPPABLE_UNITS]='stop condstop kill try-restart condrestart'
130
         [ISOLATABLE_UNITS]='isolate'
131
         [RELOADABLE_UNITS]='reload condreload reload-or-try-restart force-reload'
132
        [RESTARTABLE_UNITS]='restart reload-or-restart'
133
             [MASKED_UNITS]='unmask'
134
                     [JOBS]='cancel'
135
                [SNAPSHOTS]='delete'
136
                     [ENVS]='set-environment unset-environment'
137
               [STANDALONE]='daemon-reexec daemon-reload default
138
                             emergency exit halt hibernate hybrid-sleep kexec list-jobs
139
                             list-sockets list-timers list-units list-unit-files poweroff
140
                             reboot rescue show-environment suspend get-default'
141
                     [NAME]='snapshot'
142
                     [FILE]='link'
143
                  [TARGETS]='set-default'
144
        )
145
146
        for ((i=0; i < COMP_CWORD; i++)); do
147
                if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]} &&
148
                 ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then
149
                        verb=${COMP_WORDS[i]}
150
                        break
151
                fi
152
        done
153
154
        if [[ -z $verb ]]; then
155
                comps="${VERBS[*]}"
156
157
        elif __contains_word "$verb" ${VERBS[ALL_UNITS]}; then
158
                comps=$( __get_all_units $mode )
159
160
        elif __contains_word "$verb" ${VERBS[ENABLED_UNITS]}; then
161
                comps=$( __get_enabled_units $mode )
162
163
        elif __contains_word "$verb" ${VERBS[DISABLED_UNITS]}; then
164
                comps=$( __get_disabled_units $mode )
165
166
        elif __contains_word "$verb" ${VERBS[REENABLABLE_UNITS]}; then
167
                comps=$( __get_disabled_units $mode;
168
                         __get_enabled_units $mode )
169
170
        elif __contains_word "$verb" ${VERBS[STARTABLE_UNITS]}; then
171
                comps=$( __filter_units_by_property $mode CanStart yes \
172
                      $( __get_startable_units $mode))
173
174
        elif __contains_word "$verb" ${VERBS[RESTARTABLE_UNITS]}; then
175
                comps=$( __filter_units_by_property $mode CanStart yes \
176
                      $( __get_all_units $mode \
177
                        | while read -r line; do \
178
                                [[ "$line" =~ \.(device|snapshot|socket|timer)$ ]] || echo " $line"; \
179
                        done ))
180
181
        elif __contains_word "$verb" ${VERBS[STOPPABLE_UNITS]}; then
182
                comps=$( __filter_units_by_property $mode CanStop yes \
183
                      $( __get_active_units $mode ) )
184
185
        elif __contains_word "$verb" ${VERBS[RELOADABLE_UNITS]}; then
186
                comps=$( __filter_units_by_property $mode CanReload yes \
187
                      $( __get_active_units $mode ) )
188
189
        elif __contains_word "$verb" ${VERBS[ISOLATABLE_UNITS]}; then
190
                comps=$( __filter_units_by_property $mode AllowIsolate yes \
191
                      $( __get_all_units $mode ) )
192
193
        elif __contains_word "$verb" ${VERBS[FAILED_UNITS]}; then
194
                comps=$( __get_failed_units $mode )
195
196
        elif __contains_word "$verb" ${VERBS[MASKED_UNITS]}; then
197
                comps=$( __get_masked_units $mode )
198
199
        elif __contains_word "$verb" ${VERBS[STANDALONE]} ${VERBS[NAME]}; then
200
                comps=''
201
202
        elif __contains_word "$verb" ${VERBS[JOBS]}; then
203
                comps=$( __systemctl $mode list-jobs | { while read -r a b; do echo " $a"; done; } )
204
205
        elif __contains_word "$verb" ${VERBS[SNAPSHOTS]}; then
206
                comps=$( __systemctl $mode list-units --type snapshot --full --all \
207
                        | { while read -r a b; do echo " $a"; done; } )
208
209
        elif __contains_word "$verb" ${VERBS[ENVS]}; then
210
                comps=$( __systemctl $mode show-environment \
211
                    | while read -r line; do echo " ${line%%=*}=";done )
212
                compopt -o nospace
213
214
        elif __contains_word "$verb" ${VERBS[FILE]}; then
215
                comps=$( compgen -A file -- "$cur" )
216
                compopt -o filenames
217
        elif __contains_word "$verb" ${VERBS[TARGETS]}; then
218
                comps=$( __systemctl $mode list-unit-files --type target --full --all \
219
                        | { while read -r a b; do echo " $a"; done; } )
220
        fi
221
222
        COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
223
        return 0
224
}
225
226
complete -F _systemctl systemctl
(-)a/shell-completion/bash/systemctl.in (+226 lines)
Line 0 Link Here
1
# systemctl(1) completion                                 -*- shell-script -*-
2
#
3
# This file is part of systemd.
4
#
5
# Copyright 2010 Ran Benita
6
#
7
# systemd is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU Lesser General Public License as published by
9
# the Free Software Foundation; either version 2.1 of the License, or
10
# (at your option) any later version.
11
#
12
# systemd is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
# General Public License for more details.
16
#
17
# You should have received a copy of the GNU Lesser General Public License
18
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
19
20
__systemctl() {
21
        local mode=$1; shift 1
22
        systemctl $mode --full --no-legend "$@"
23
}
24
25
__systemd_properties() {
26
        local mode=$1
27
        { __systemctl $mode show --all;
28
         @rootlibexecdir@/systemd --dump-configuration-items; } |
29
        while IFS='=' read -r key value; do
30
            [[ $value ]] && echo "$key"
31
        done
32
}
33
34
__contains_word () {
35
        local w word=$1; shift
36
        for w in "$@"; do
37
                [[ $w = "$word" ]] && return
38
        done
39
}
40
41
__filter_units_by_property () {
42
        local mode=$1 property=$2 value=$3 ; shift 3
43
        local units=("$@")
44
        local props
45
        IFS=$'\n' read -rd '' -a props < \
46
            <(__systemctl $mode show --property "$property" -- "${units[@]}")
47
        for ((i=0; $i < ${#units[*]}; i++)); do
48
                if [[ "${props[i]}" = "$property=$value" ]]; then
49
                        echo " ${units[i]}"
50
                fi
51
        done
52
}
53
54
__get_all_units      () { __systemctl $1 list-units --all \
55
        | { while read -r a b; do echo " $a"; done; }; }
56
__get_active_units   () { __systemctl $1 list-units       \
57
        | { while read -r a b; do echo " $a"; done; }; }
58
__get_startable_units () { __systemctl $1 list-units --all -t service,timer,socket,mount,automount,path,snapshot,swap \
59
        | { while read -r a b c d; do [[ $c == "inactive" || $c == "failed" ]] && echo " $a"; done; }; }
60
__get_failed_units   () { __systemctl $1 list-units       \
61
        | { while read -r a b c d; do [[ $c == "failed"   ]] && echo " $a"; done; }; }
62
__get_enabled_units  () { __systemctl $1 list-unit-files  \
63
        | { while read -r a b c  ; do [[ $b == "enabled"  ]] && echo " $a"; done; }; }
64
__get_disabled_units () { __systemctl $1 list-unit-files  \
65
        | { while read -r a b c  ; do [[ $b == "disabled" ]] && echo " $a"; done; }; }
66
__get_masked_units   () { __systemctl $1 list-unit-files  \
67
        | { while read -r a b c  ; do [[ $b == "masked"   ]] && echo " $a"; done; }; }
68
69
_systemctl () {
70
        local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
71
        local i verb comps mode
72
73
        local -A OPTS=(
74
               [STANDALONE]='--all -a --reverse --after --before --defaults --fail --ignore-dependencies --failed --force -f --full -l --global
75
                             --help -h --no-ask-password --no-block --no-legend --no-pager --no-reload --no-wall
76
                             --quiet -q --privileged -P --system --user --version --runtime --recursive -r'
77
                      [ARG]='--host -H --kill-who --property -p --signal -s --type -t --state --root'
78
        )
79
80
        if __contains_word "--user" ${COMP_WORDS[*]}; then
81
            mode=--user
82
        else
83
            mode=--system
84
        fi
85
86
        if __contains_word "$prev" ${OPTS[ARG]}; then
87
                case $prev in
88
                        --signal|-s)
89
                                comps=$(compgen -A signal)
90
                        ;;
91
                        --type|-t)
92
                                comps='automount device mount path service snapshot socket swap target timer'
93
                        ;;
94
                        --state)
95
                                comps='loaded not-found stub
96
                                       active inactive
97
                                       dead elapsed exited listening mounted plugged running waiting'
98
                        ;;
99
                        --kill-who)
100
                                comps='all control main'
101
                        ;;
102
                        --root)
103
                                comps=$(compgen -A directory -- "$cur" )
104
                                compopt -o filenames
105
                        ;;
106
                        --host|-H)
107
                                comps=$(compgen -A hostname)
108
                        ;;
109
                        --property|-p)
110
                                comps=$(__systemd_properties $mode)
111
                        ;;
112
                esac
113
                COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
114
                return 0
115
        fi
116
117
        if [[ "$cur" = -* ]]; then
118
                COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
119
                return 0
120
        fi
121
122
        local -A VERBS=(
123
                [ALL_UNITS]='is-active is-failed is-enabled status show cat mask preset help list-dependencies'
124
            [ENABLED_UNITS]='disable'
125
           [DISABLED_UNITS]='enable'
126
        [REENABLABLE_UNITS]='reenable'
127
             [FAILED_UNITS]='reset-failed'
128
          [STARTABLE_UNITS]='start'
129
          [STOPPABLE_UNITS]='stop condstop kill try-restart condrestart'
130
         [ISOLATABLE_UNITS]='isolate'
131
         [RELOADABLE_UNITS]='reload condreload reload-or-try-restart force-reload'
132
        [RESTARTABLE_UNITS]='restart reload-or-restart'
133
             [MASKED_UNITS]='unmask'
134
                     [JOBS]='cancel'
135
                [SNAPSHOTS]='delete'
136
                     [ENVS]='set-environment unset-environment'
137
               [STANDALONE]='daemon-reexec daemon-reload default
138
                             emergency exit halt hibernate hybrid-sleep kexec list-jobs
139
                             list-sockets list-timers list-units list-unit-files poweroff
140
                             reboot rescue show-environment suspend get-default'
141
                     [NAME]='snapshot'
142
                     [FILE]='link'
143
                  [TARGETS]='set-default'
144
        )
145
146
        for ((i=0; i < COMP_CWORD; i++)); do
147
                if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]} &&
148
                 ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then
149
                        verb=${COMP_WORDS[i]}
150
                        break
151
                fi
152
        done
153
154
        if [[ -z $verb ]]; then
155
                comps="${VERBS[*]}"
156
157
        elif __contains_word "$verb" ${VERBS[ALL_UNITS]}; then
158
                comps=$( __get_all_units $mode )
159
160
        elif __contains_word "$verb" ${VERBS[ENABLED_UNITS]}; then
161
                comps=$( __get_enabled_units $mode )
162
163
        elif __contains_word "$verb" ${VERBS[DISABLED_UNITS]}; then
164
                comps=$( __get_disabled_units $mode )
165
166
        elif __contains_word "$verb" ${VERBS[REENABLABLE_UNITS]}; then
167
                comps=$( __get_disabled_units $mode;
168
                         __get_enabled_units $mode )
169
170
        elif __contains_word "$verb" ${VERBS[STARTABLE_UNITS]}; then
171
                comps=$( __filter_units_by_property $mode CanStart yes \
172
                      $( __get_startable_units $mode))
173
174
        elif __contains_word "$verb" ${VERBS[RESTARTABLE_UNITS]}; then
175
                comps=$( __filter_units_by_property $mode CanStart yes \
176
                      $( __get_all_units $mode \
177
                        | while read -r line; do \
178
                                [[ "$line" =~ \.(device|snapshot|socket|timer)$ ]] || echo " $line"; \
179
                        done ))
180
181
        elif __contains_word "$verb" ${VERBS[STOPPABLE_UNITS]}; then
182
                comps=$( __filter_units_by_property $mode CanStop yes \
183
                      $( __get_active_units $mode ) )
184
185
        elif __contains_word "$verb" ${VERBS[RELOADABLE_UNITS]}; then
186
                comps=$( __filter_units_by_property $mode CanReload yes \
187
                      $( __get_active_units $mode ) )
188
189
        elif __contains_word "$verb" ${VERBS[ISOLATABLE_UNITS]}; then
190
                comps=$( __filter_units_by_property $mode AllowIsolate yes \
191
                      $( __get_all_units $mode ) )
192
193
        elif __contains_word "$verb" ${VERBS[FAILED_UNITS]}; then
194
                comps=$( __get_failed_units $mode )
195
196
        elif __contains_word "$verb" ${VERBS[MASKED_UNITS]}; then
197
                comps=$( __get_masked_units $mode )
198
199
        elif __contains_word "$verb" ${VERBS[STANDALONE]} ${VERBS[NAME]}; then
200
                comps=''
201
202
        elif __contains_word "$verb" ${VERBS[JOBS]}; then
203
                comps=$( __systemctl $mode list-jobs | { while read -r a b; do echo " $a"; done; } )
204
205
        elif __contains_word "$verb" ${VERBS[SNAPSHOTS]}; then
206
                comps=$( __systemctl $mode list-units --type snapshot --full --all \
207
                        | { while read -r a b; do echo " $a"; done; } )
208
209
        elif __contains_word "$verb" ${VERBS[ENVS]}; then
210
                comps=$( __systemctl $mode show-environment \
211
                    | while read -r line; do echo " ${line%%=*}=";done )
212
                compopt -o nospace
213
214
        elif __contains_word "$verb" ${VERBS[FILE]}; then
215
                comps=$( compgen -A file -- "$cur" )
216
                compopt -o filenames
217
        elif __contains_word "$verb" ${VERBS[TARGETS]}; then
218
                comps=$( __systemctl $mode list-unit-files --type target --full --all \
219
                        | { while read -r a b; do echo " $a"; done; } )
220
        fi
221
222
        COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
223
        return 0
224
}
225
226
complete -F _systemctl systemctl
(-)a/shell-completion/zsh/.gitignore (+1 lines)
Line 0 Link Here
1
/_systemctl
(-)a/shell-completion/zsh/_hostnamectl (-2 / +30 lines)
Lines 1-5 Link Here
1
#compdef hostnamectl
1
#compdef hostnamectl
2
2
3
_hostnamectl_set-hostname() {
4
    if (( CURRENT <= 3 )); then
5
        _message "new hostname"
6
    else
7
        _message "no more options"
8
    fi
9
}
10
11
_hostnamectl_set-icon-name() {
12
    if (( CURRENT <= 3 )); then
13
        _message "new icon name"
14
    else
15
        _message "no more options"
16
    fi
17
}
18
19
_hostnamectl_set-chassis() {
20
    if (( CURRENT <= 3 )); then
21
        _chassis=( desktop laptop server tablet handset watch vm container )
22
        _describe chassis _chassis
23
    else
24
        _message "no more options"
25
    fi
26
}
27
3
_hostnamectl_command() {
28
_hostnamectl_command() {
4
    local -a _hostnamectl_cmds
29
    local -a _hostnamectl_cmds
5
    _hostnamectl_cmds=(
30
    _hostnamectl_cmds=(
Lines 14-21 _hostnamectl_command() { Link Here
14
        local curcontext="$curcontext"
39
        local curcontext="$curcontext"
15
        cmd="${${_hostnamectl_cmds[(r)$words[1]:*]%%:*}}"
40
        cmd="${${_hostnamectl_cmds[(r)$words[1]:*]%%:*}}"
16
        if (( $#cmd )); then
41
        if (( $#cmd )); then
17
            [[ $cmd == status ]] && msg="no options" || msg="options for $cmd"
42
            if [[ $cmd == status ]]; then
18
            _message "$msg"
43
                _message "no options"
44
            else
45
                _hostnamectl_$cmd
46
            fi
19
        else
47
        else
20
            _message "unknown hostnamectl command: $words[1]"
48
            _message "unknown hostnamectl command: $words[1]"
21
        fi
49
        fi
(-)a/shell-completion/zsh/_localectl (-2 / +2 lines)
Lines 22-29 _localectl_set-locale() { Link Here
22
22
23
_localectl_set-keymap() {
23
_localectl_set-keymap() {
24
    local -a _keymaps
24
    local -a _keymaps
25
    _keymaps=( ${(f)"$(_call_program locales "$service" list-keymaps)"} )
26
    if (( CURRENT <= 3 )); then
25
    if (( CURRENT <= 3 )); then
26
        _keymaps=( ${(f)"$(_call_program locales "$service" list-keymaps)"} )
27
        _describe keymaps _keymaps
27
        _describe keymaps _keymaps
28
    else
28
    else
29
        _message "no more options"
29
        _message "no more options"
Lines 77-83 _localectl_command() { Link Here
77
        if (( $+functions[_localectl_$cmd] )); then
77
        if (( $+functions[_localectl_$cmd] )); then
78
            _localectl_$cmd
78
            _localectl_$cmd
79
        else
79
        else
80
            _message "no more options"
80
            _message "unknown localectl command: $words[1]"
81
        fi
81
        fi
82
    fi
82
    fi
83
}
83
}
(-)a/shell-completion/zsh/_systemctl (-341 lines)
Lines 1-341 Link Here
1
#compdef systemctl
2
3
(( $+functions[_systemctl_command] )) || _systemctl_command()
4
{
5
  local -a _systemctl_cmds
6
  _systemctl_cmds=(
7
    "list-sockets:List sockets"
8
    "list-timers:List timers"
9
    "list-units:List units"
10
    "start:Start (activate) one or more units"
11
    "stop:Stop (deactivate) one or more units"
12
    "reload:Reload one or more units"
13
    "restart:Start or restart one or more units"
14
    "condrestart:Restart one or more units if active"
15
    "try-restart:Restart one or more units if active"
16
    "reload-or-restart:Reload one or more units if possible, otherwise start or restart"
17
    "force-reload:Reload one or more units if possible, otherwise restart if active"
18
    "hibernate:Hibernate the system"
19
    "hybrid-sleep:Hibernate and suspend the system"
20
    "reload-or-try-restart:Reload one or more units if possible, otherwise restart if active"
21
    "isolate:Start one unit and stop all others"
22
    "kill:Send signal to processes of a unit"
23
    "is-active:Check whether units are active"
24
    "is-failed:Check whether units are failed"
25
    "status:Show runtime status of one or more units"
26
    "show:Show properties of one or more units/jobs or the manager"
27
    "cat:Show the source unit files and drop-ins"
28
    "reset-failed:Reset failed state for all, one, or more units"
29
    "list-unit-files:List installed unit files"
30
    "enable:Enable one or more unit files"
31
    "disable:Disable one or more unit files"
32
    "reenable:Reenable one or more unit files"
33
    "preset:Enable/disable one or more unit files based on preset configuration"
34
    "help:Show documentation for specified units"
35
    "list-dependencies:Show unit dependency tree"
36
    "mask:Mask one or more units"
37
    "unmask:Unmask one or more units"
38
    "link:Link one or more units files into the search path"
39
    "is-enabled:Check whether unit files are enabled"
40
    "list-jobs:List jobs"
41
    "cancel:Cancel all, one, or more jobs"
42
    "snapshot:Create a snapshot"
43
    "delete:Remove one or more snapshots"
44
    "show-environment:Dump environment"
45
    "set-environment:Set one or more environment variables"
46
    "unset-environment:Unset one or more environment variables"
47
    "daemon-reload:Reload systemd manager configuration"
48
    "daemon-reexec:Reexecute systemd manager"
49
    "default:Enter system default mode"
50
    "rescue:Enter system rescue mode"
51
    "emergency:Enter system emergency mode"
52
    "halt:Shut down and halt the system"
53
    "suspend:Suspend the system"
54
    "poweroff:Shut down and power-off the system"
55
    "reboot:Shut down and reboot the system"
56
    "kexec:Shut down and reboot the system with kexec"
57
    "exit:Ask for user instance termination"
58
  )
59
60
  if (( CURRENT == 1 )); then
61
    _describe -t commands 'systemctl command' _systemctl_cmds || compadd "$@"
62
  else
63
    local curcontext="$curcontext"
64
65
    cmd="${${_systemctl_cmds[(r)$words[1]:*]%%:*}}"
66
    # Deal with any aliases
67
    case $cmd in
68
      condrestart) cmd="try-restart";;
69
      force-reload) cmd="reload-or-try-restart";;
70
    esac
71
72
    if (( $#cmd )); then
73
      curcontext="${curcontext%:*:*}:systemctl-${cmd}:"
74
75
      local update_policy
76
      zstyle -s ":completion:${curcontext}:" cache-policy update_policy
77
      if [[ -z "$update_policy" ]]; then
78
        zstyle ":completion:${curcontext}:" cache-policy _systemctl_caching_policy
79
      fi
80
81
      _call_function ret _systemctl_$cmd || _message 'no more arguments'
82
    else
83
      _message "unknown systemctl command: $words[1]"
84
    fi
85
    return ret
86
  fi
87
}
88
89
__systemctl()
90
{
91
  local -a _modes
92
  _modes=("--user" "--system")
93
  systemctl ${words:*_modes} --full --no-legend --no-pager "$@"
94
}
95
96
97
# Fills the unit list
98
_systemctl_all_units()
99
{
100
  if ( [[ ${+_sys_all_units} -eq 0 ]] || _cache_invalid SYS_ALL_UNITS ) &&
101
    ! _retrieve_cache SYS_ALL_UNITS;
102
  then
103
    _sys_all_units=( $(__systemctl list-units --all | { while read a b; do echo " $a"; done; }) )
104
    _store_cache SYS_ALL_UNITS _sys_all_units
105
  fi
106
}
107
108
# Fills the unit list including all file units
109
_systemctl_really_all_units()
110
{
111
  local -a all_unit_files;
112
  local -a really_all_units;
113
  if ( [[ ${+_sys_really_all_units} -eq 0 ]] || _cache_invalid SYS_REALLY_ALL_UNITS ) &&
114
    ! _retrieve_cache SYS_REALLY_ALL_UNITS;
115
  then
116
    all_unit_files=( $(__systemctl list-unit-files | { while read a b; do echo " $a"; done; }) )
117
    _systemctl_all_units
118
    really_all_units=($_sys_all_units $all_unit_files)
119
    _sys_really_all_units=(${(u)really_all_units})
120
    _store_cache SYS_REALLY_ALL_UNITS _sys_really_all_units
121
  fi
122
}
123
124
_filter_units_by_property() {
125
  local property=$1 value=$2 ; shift ; shift
126
  local -a units ; units=($*)
127
  local prop unit
128
  for ((i=1; $i <= ${#units[*]}; i++)); do
129
    # FIXME: "Failed to issue method call: Unknown unit" errors are ignored for
130
    # now (related to DBUS_ERROR_UNKNOWN_OBJECT). in the future, we need to
131
    # revert to calling 'systemctl show' once for all units, which is way
132
    # faster
133
    unit=${units[i]}
134
    prop=${(f)"$(_call_program units "$service show --no-pager --property="$property" ${unit} 2>/dev/null")"}
135
    if [[ "${prop}" = "$property=$value" ]]; then
136
      echo " ${unit}"
137
    fi
138
  done
139
}
140
141
_systemctl_active_units()  {_sys_active_units=(  $(__systemctl list-units          | { while read a b; do echo " $a"; done; }) )}
142
_systemctl_inactive_units(){_sys_inactive_units=($(__systemctl list-units --all    | { while read a b c d; do [[ $c == "inactive" || $c == "failed" ]] && echo " $a"; done; }) )}
143
_systemctl_failed_units()  {_sys_failed_units=(  $(__systemctl list-units --failed | { while read a b; do echo " $a"; done; }) )}
144
_systemctl_enabled_units() {_sys_enabled_units=( $(__systemctl list-unit-files     | { while read a b; do [[ $b == "enabled" ]] && echo " $a"; done; }) )}
145
_systemctl_disabled_units(){_sys_disabled_units=($(__systemctl list-unit-files     | { while read a b; do [[ $b == "disabled" ]] && echo " $a"; done; }) )}
146
_systemctl_masked_units()  {_sys_masked_units=(  $(__systemctl list-unit-files     | { while read a b; do [[ $b == "masked" ]] && echo " $a"; done; }) )}
147
148
# Completion functions for ALL_UNITS
149
for fun in is-active is-failed is-enabled status show cat mask preset help list-dependencies ; do
150
  (( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
151
  {
152
    _systemctl_really_all_units
153
    compadd "$@" -a - _sys_really_all_units
154
  }
155
done
156
157
# Completion functions for ENABLED_UNITS
158
for fun in disable reenable ; do
159
  (( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
160
  {
161
    _systemctl_enabled_units
162
    _systemctl_disabled_units
163
    compadd "$@" -a - _sys_enabled_units _sys_disabled_units
164
  }
165
done
166
167
# Completion functions for DISABLED_UNITS
168
(( $+functions[_systemctl_enable] )) || _systemctl_enable()
169
{
170
  _systemctl_disabled_units
171
  compadd "$@" -a - _sys_disabled_units
172
}
173
174
# Completion functions for FAILED_UNITS
175
(( $+functions[_systemctl_reset-failed] )) || _systemctl_reset-failed()
176
{
177
  _systemctl_failed_units
178
  compadd "$@" -a - _sys_failed_units || _message "no failed unit found"
179
}
180
181
# Completion functions for STARTABLE_UNITS
182
(( $+functions[_systemctl_start] )) || _systemctl_start()
183
{
184
  _systemctl_inactive_units
185
  compadd "$@" -a - _sys_inactive_units
186
}
187
188
# Completion functions for STOPPABLE_UNITS
189
for fun in stop kill try-restart condrestart ; do
190
  (( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
191
  {
192
    _systemctl_active_units
193
    compadd "$@" - $( _filter_units_by_property CanStop yes \
194
      ${_sys_active_units[*]} )
195
  }
196
done
197
198
# Completion functions for ISOLATABLE_UNITS
199
(( $+functions[_systemctl_isolate] )) || _systemctl_isolate()
200
{
201
  _systemctl_all_units
202
  compadd "$@" - $( _filter_units_by_property AllowIsolate yes \
203
    ${_sys_all_units[*]} )
204
}
205
206
# Completion functions for RELOADABLE_UNITS
207
for fun in reload reload-or-try-restart force-reload ; do
208
  (( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
209
  {
210
    _systemctl_active_units
211
    compadd "$@" - $( _filter_units_by_property CanReload yes \
212
      ${_sys_active_units[*]} )
213
  }
214
done
215
216
# Completion functions for RESTARTABLE_UNITS
217
for fun in restart reload-or-restart ; do
218
  (( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
219
  {
220
    _systemctl_all_units
221
    compadd "$@" - $( _filter_units_by_property CanStart yes \
222
      ${_sys_all_units[*]} | while read line; do \
223
      [[ "$line" =~ \.device$ ]] || echo " $line"; \
224
      done )
225
  }
226
done
227
228
# Completion functions for MASKED_UNITS
229
(( $+functions[_systemctl_unmask] )) || _systemctl_unmask()
230
{
231
  _systemctl_masked_units
232
  compadd "$@" -a - _sys_masked_units || _message "no masked unit found"
233
}
234
235
# Completion functions for JOBS
236
(( $+functions[_systemctl_cancel] )) || _systemctl_cancel()
237
{
238
  compadd "$@" - $(__systemctl list-jobs \
239
    | cut -d' ' -f1  2>/dev/null ) || _message "no job found"
240
}
241
242
# Completion functions for SNAPSHOTS
243
(( $+functions[_systemctl_delete] )) || _systemctl_delete()
244
{
245
  compadd "$@" - $(__systemctl list-units --type snapshot --all \
246
    | cut -d' ' -f1  2>/dev/null ) || _message "no snapshot found"
247
}
248
249
# Completion functions for ENVS
250
for fun in set-environment unset-environment ; do
251
  (( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
252
  {
253
    local fun=$0 ; fun=${fun##_systemctl_}
254
    local suf
255
    if [[ "${fun}" = "set-environment" ]]; then
256
      suf='-S='
257
    fi
258
259
    compadd "$@" ${suf} - $(systemctl show-environment \
260
      | while read line; do echo " ${line%%\=}";done )
261
  }
262
done
263
264
(( $+functions[_systemctl_link] )) || _systemctl_link() { _files }
265
266
# no systemctl completion for:
267
#    [STANDALONE]='daemon-reexec daemon-reload default
268
#                  emergency exit halt kexec list-jobs list-units
269
#                  list-unit-files poweroff reboot rescue show-environment'
270
#         [NAME]='snapshot'
271
272
_systemctl_caching_policy()
273
{
274
  local _sysunits
275
  local -a oldcache
276
277
  # rebuild if cache is more than a day old
278
  oldcache=( "$1"(mh+1) )
279
  (( $#oldcache )) && return 0
280
281
  _sysunits=($(__systemctl --all | cut -d' ' -f1))
282
283
  if (( $#_sysunits )); then
284
    for unit in $_sysunits; do
285
      [[ "$unit" -nt "$1" ]] && return 0
286
    done
287
  fi
288
289
  return 1
290
}
291
292
_unit_states() {
293
    local -a _states
294
    _states=(loaded failed active inactive not-found listening running waiting plugged mounted exited dead masked)
295
    _values -s , "${_states[@]}"
296
}
297
298
_unit_types() {
299
    local -a _types
300
    _types=(automount device mount path service snapshot socket swap target timer)
301
    _values -s , "${_types[@]}"
302
}
303
304
_arguments -s \
305
    {-h,--help}'[Show help]' \
306
    '--version[Show package version]' \
307
    {-t+,--type=}'[List only units of a particular type]:unit type:_unit_types' \
308
    '--state=[Display units in the specifyied state]:unit state:_unit_states' \
309
    \*{-p+,--property=}'[Show only properties by specific name]:unit property' \
310
    {-a,--all}'[Show all units/properties, including dead/empty ones]' \
311
    '--reverse[Show reverse dependencies]' \
312
    '--after[Show units ordered after]' \
313
    '--before[Show units ordered before]' \
314
    '--failed[Show only failed units]' \
315
    {-l,--full}"[Don't ellipsize unit names on output]" \
316
    '--fail[When queueing a new job, fail if conflicting jobs are pending]' \
317
    '--show-types[When showing sockets, show socket type]' \
318
    '--irreversible[Mark transactions as irreversible]' \
319
    '--ignore-dependencies[When queueing a new job, ignore all its dependencies]' \
320
    {-i,--ignore-inhibitors}'[When executing a job, ignore jobs dependencies]' \
321
    {-q,--quiet}'[Suppress output]' \
322
    '--no-block[Do not wait until operation finished]' \
323
    '--no-legend[Do not print a legend, i.e. the column headers and the footer with hints]' \
324
    '--no-pager[Do not pipe output into a pager]' \
325
    '--system[Connect to system manager]' \
326
    '--user[Connect to user service manager]' \
327
    "--no-wall[Don't send wall message before halt/power-off/reboot]" \
328
    '--global[Enable/disable unit files globally]' \
329
    "--no-reload[When enabling/disabling unit files, don't reload daemon configuration]" \
330
    '--no-ask-password[Do not ask for system passwords]' \
331
    '--kill-who=[Who to send signal to]:killwho:(main control all)' \
332
    {-s+,--signal=}'[Which signal to send]:signal:_signals' \
333
    {-f,--force}'[When enabling unit files, override existing symlinks. When shutting down, execute action immediately]' \
334
    '--root=[Enable unit files in the specified root directory]:directory:_directories' \
335
    '--runtime[Enable unit files only temporarily until next reboot]' \
336
    {-H+,--host=}'[Operate on remote host]:userathost:_sd_hosts_or_user_at_host' \
337
    {-P,--privileged}'[Acquire privileges before execution]' \
338
    {-n+,--lines=}'[Journal entries to show]:number of entries' \
339
    {-o+,--output=}'[Change journal output mode]:modes:_sd_outputmodes' \
340
    '--plain[When used with list-dependencies, print output as a list]' \
341
    '*::systemctl command:_systemctl_command'
(-)a/shell-completion/zsh/_systemctl.in (+354 lines)
Line 0 Link Here
1
#compdef systemctl
2
3
(( $+functions[_systemctl_command] )) || _systemctl_command()
4
{
5
  local -a _systemctl_cmds
6
  _systemctl_cmds=(
7
    "list-sockets:List sockets"
8
    "list-timers:List timers"
9
    "list-units:List units"
10
    "start:Start (activate) one or more units"
11
    "stop:Stop (deactivate) one or more units"
12
    "reload:Reload one or more units"
13
    "restart:Start or restart one or more units"
14
    "condrestart:Restart one or more units if active"
15
    "try-restart:Restart one or more units if active"
16
    "reload-or-restart:Reload one or more units if possible, otherwise start or restart"
17
    "force-reload:Reload one or more units if possible, otherwise restart if active"
18
    "hibernate:Hibernate the system"
19
    "hybrid-sleep:Hibernate and suspend the system"
20
    "reload-or-try-restart:Reload one or more units if possible, otherwise restart if active"
21
    "isolate:Start one unit and stop all others"
22
    "kill:Send signal to processes of a unit"
23
    "is-active:Check whether units are active"
24
    "is-failed:Check whether units are failed"
25
    "status:Show runtime status of one or more units"
26
    "show:Show properties of one or more units/jobs or the manager"
27
    "cat:Show the source unit files and drop-ins"
28
    "reset-failed:Reset failed state for all, one, or more units"
29
    "list-unit-files:List installed unit files"
30
    "enable:Enable one or more unit files"
31
    "disable:Disable one or more unit files"
32
    "reenable:Reenable one or more unit files"
33
    "preset:Enable/disable one or more unit files based on preset configuration"
34
    "help:Show documentation for specified units"
35
    "list-dependencies:Show unit dependency tree"
36
    "mask:Mask one or more units"
37
    "unmask:Unmask one or more units"
38
    "link:Link one or more units files into the search path"
39
    "is-enabled:Check whether unit files are enabled"
40
    "list-jobs:List jobs"
41
    "cancel:Cancel all, one, or more jobs"
42
    "snapshot:Create a snapshot"
43
    "delete:Remove one or more snapshots"
44
    "show-environment:Dump environment"
45
    "set-environment:Set one or more environment variables"
46
    "unset-environment:Unset one or more environment variables"
47
    "daemon-reload:Reload systemd manager configuration"
48
    "daemon-reexec:Reexecute systemd manager"
49
    "default:Enter system default mode"
50
    "rescue:Enter system rescue mode"
51
    "emergency:Enter system emergency mode"
52
    "halt:Shut down and halt the system"
53
    "suspend:Suspend the system"
54
    "poweroff:Shut down and power-off the system"
55
    "reboot:Shut down and reboot the system"
56
    "kexec:Shut down and reboot the system with kexec"
57
    "exit:Ask for user instance termination"
58
  )
59
60
  if (( CURRENT == 1 )); then
61
    _describe -t commands 'systemctl command' _systemctl_cmds || compadd "$@"
62
  else
63
    local curcontext="$curcontext"
64
65
    cmd="${${_systemctl_cmds[(r)$words[1]:*]%%:*}}"
66
    # Deal with any aliases
67
    case $cmd in
68
      condrestart) cmd="try-restart";;
69
      force-reload) cmd="reload-or-try-restart";;
70
    esac
71
72
    if (( $#cmd )); then
73
      curcontext="${curcontext%:*:*}:systemctl-${cmd}:"
74
75
      local update_policy
76
      zstyle -s ":completion:${curcontext}:" cache-policy update_policy
77
      if [[ -z "$update_policy" ]]; then
78
        zstyle ":completion:${curcontext}:" cache-policy _systemctl_caching_policy
79
      fi
80
81
      _call_function ret _systemctl_$cmd || _message 'no more arguments'
82
    else
83
      _message "unknown systemctl command: $words[1]"
84
    fi
85
    return ret
86
  fi
87
}
88
89
__systemctl()
90
{
91
  local -a _modes
92
  _modes=("--user" "--system")
93
  systemctl ${words:*_modes} --full --no-legend --no-pager "$@"
94
}
95
96
97
# Fills the unit list
98
_systemctl_all_units()
99
{
100
  if ( [[ ${+_sys_all_units} -eq 0 ]] || _cache_invalid SYS_ALL_UNITS ) &&
101
    ! _retrieve_cache SYS_ALL_UNITS;
102
  then
103
    _sys_all_units=( $(__systemctl list-units --all | { while read a b; do echo " $a"; done; }) )
104
    _store_cache SYS_ALL_UNITS _sys_all_units
105
  fi
106
}
107
108
# Fills the unit list including all file units
109
_systemctl_really_all_units()
110
{
111
  local -a all_unit_files;
112
  local -a really_all_units;
113
  if ( [[ ${+_sys_really_all_units} -eq 0 ]] || _cache_invalid SYS_REALLY_ALL_UNITS ) &&
114
    ! _retrieve_cache SYS_REALLY_ALL_UNITS;
115
  then
116
    all_unit_files=( $(__systemctl list-unit-files | { while read a b; do echo " $a"; done; }) )
117
    _systemctl_all_units
118
    really_all_units=($_sys_all_units $all_unit_files)
119
    _sys_really_all_units=(${(u)really_all_units})
120
    _store_cache SYS_REALLY_ALL_UNITS _sys_really_all_units
121
  fi
122
}
123
124
_filter_units_by_property() {
125
  local property=$1 value=$2 ; shift ; shift
126
  local -a units ; units=($*)
127
  local prop unit
128
  for ((i=1; $i <= ${#units[*]}; i++)); do
129
    # FIXME: "Failed to issue method call: Unknown unit" errors are ignored for
130
    # now (related to DBUS_ERROR_UNKNOWN_OBJECT). in the future, we need to
131
    # revert to calling 'systemctl show' once for all units, which is way
132
    # faster
133
    unit=${units[i]}
134
    prop=${(f)"$(_call_program units "$service show --no-pager --property="$property" ${unit} 2>/dev/null")"}
135
    if [[ "${prop}" = "$property=$value" ]]; then
136
      echo " ${unit}"
137
    fi
138
  done
139
}
140
141
_systemctl_active_units()  {_sys_active_units=(  $(__systemctl list-units          | { while read a b; do echo " $a"; done; }) )}
142
_systemctl_inactive_units(){_sys_inactive_units=($(__systemctl list-units --all    | { while read a b c d; do [[ $c == "inactive" || $c == "failed" ]] && echo " $a"; done; }) )}
143
_systemctl_failed_units()  {_sys_failed_units=(  $(__systemctl list-units --failed | { while read a b; do echo " $a"; done; }) )}
144
_systemctl_enabled_units() {_sys_enabled_units=( $(__systemctl list-unit-files     | { while read a b; do [[ $b == "enabled" ]] && echo " $a"; done; }) )}
145
_systemctl_disabled_units(){_sys_disabled_units=($(__systemctl list-unit-files     | { while read a b; do [[ $b == "disabled" ]] && echo " $a"; done; }) )}
146
_systemctl_masked_units()  {_sys_masked_units=(  $(__systemctl list-unit-files     | { while read a b; do [[ $b == "masked" ]] && echo " $a"; done; }) )}
147
148
# Completion functions for ALL_UNITS
149
for fun in is-active is-failed is-enabled status show cat mask preset help list-dependencies ; do
150
  (( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
151
  {
152
    _systemctl_really_all_units
153
    compadd "$@" -a - _sys_really_all_units
154
  }
155
done
156
157
# Completion functions for ENABLED_UNITS
158
for fun in disable reenable ; do
159
  (( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
160
  {
161
    _systemctl_enabled_units
162
    _systemctl_disabled_units
163
    compadd "$@" -a - _sys_enabled_units _sys_disabled_units
164
  }
165
done
166
167
# Completion functions for DISABLED_UNITS
168
(( $+functions[_systemctl_enable] )) || _systemctl_enable()
169
{
170
  _systemctl_disabled_units
171
  compadd "$@" -a - _sys_disabled_units
172
}
173
174
# Completion functions for FAILED_UNITS
175
(( $+functions[_systemctl_reset-failed] )) || _systemctl_reset-failed()
176
{
177
  _systemctl_failed_units
178
  compadd "$@" -a - _sys_failed_units || _message "no failed unit found"
179
}
180
181
# Completion functions for STARTABLE_UNITS
182
(( $+functions[_systemctl_start] )) || _systemctl_start()
183
{
184
  _systemctl_inactive_units
185
  compadd "$@" -a - _sys_inactive_units
186
}
187
188
# Completion functions for STOPPABLE_UNITS
189
for fun in stop kill try-restart condrestart ; do
190
  (( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
191
  {
192
    _systemctl_active_units
193
    compadd "$@" - $( _filter_units_by_property CanStop yes \
194
      ${_sys_active_units[*]} )
195
  }
196
done
197
198
# Completion functions for ISOLATABLE_UNITS
199
(( $+functions[_systemctl_isolate] )) || _systemctl_isolate()
200
{
201
  _systemctl_all_units
202
  compadd "$@" - $( _filter_units_by_property AllowIsolate yes \
203
    ${_sys_all_units[*]} )
204
}
205
206
# Completion functions for RELOADABLE_UNITS
207
for fun in reload reload-or-try-restart force-reload ; do
208
  (( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
209
  {
210
    _systemctl_active_units
211
    compadd "$@" - $( _filter_units_by_property CanReload yes \
212
      ${_sys_active_units[*]} )
213
  }
214
done
215
216
# Completion functions for RESTARTABLE_UNITS
217
for fun in restart reload-or-restart ; do
218
  (( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
219
  {
220
    _systemctl_all_units
221
    compadd "$@" - $( _filter_units_by_property CanStart yes \
222
      ${_sys_all_units[*]} | while read line; do \
223
      [[ "$line" =~ \.device$ ]] || echo " $line"; \
224
      done )
225
  }
226
done
227
228
# Completion functions for MASKED_UNITS
229
(( $+functions[_systemctl_unmask] )) || _systemctl_unmask()
230
{
231
  _systemctl_masked_units
232
  compadd "$@" -a - _sys_masked_units || _message "no masked unit found"
233
}
234
235
# Completion functions for JOBS
236
(( $+functions[_systemctl_cancel] )) || _systemctl_cancel()
237
{
238
  compadd "$@" - $(__systemctl list-jobs \
239
    | cut -d' ' -f1  2>/dev/null ) || _message "no job found"
240
}
241
242
# Completion functions for SNAPSHOTS
243
(( $+functions[_systemctl_delete] )) || _systemctl_delete()
244
{
245
  compadd "$@" - $(__systemctl list-units --type snapshot --all \
246
    | cut -d' ' -f1  2>/dev/null ) || _message "no snapshot found"
247
}
248
249
# Completion functions for ENVS
250
for fun in set-environment unset-environment ; do
251
  (( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
252
  {
253
    local fun=$0 ; fun=${fun##_systemctl_}
254
    local suf
255
    if [[ "${fun}" = "set-environment" ]]; then
256
      suf='-S='
257
    fi
258
259
    compadd "$@" ${suf} - $(systemctl show-environment \
260
      | while read line; do echo " ${line%%\=}";done )
261
  }
262
done
263
264
(( $+functions[_systemctl_link] )) || _systemctl_link() { _files }
265
266
# no systemctl completion for:
267
#    [STANDALONE]='daemon-reexec daemon-reload default
268
#                  emergency exit halt kexec list-jobs list-units
269
#                  list-unit-files poweroff reboot rescue show-environment'
270
#         [NAME]='snapshot'
271
272
_systemctl_caching_policy()
273
{
274
  local _sysunits
275
  local -a oldcache
276
277
  # rebuild if cache is more than a day old
278
  oldcache=( "$1"(mh+1) )
279
  (( $#oldcache )) && return 0
280
281
  _sysunits=($(__systemctl --all | cut -d' ' -f1))
282
283
  if (( $#_sysunits )); then
284
    for unit in $_sysunits; do
285
      [[ "$unit" -nt "$1" ]] && return 0
286
    done
287
  fi
288
289
  return 1
290
}
291
292
_unit_states() {
293
    local -a _states
294
    _states=(loaded failed active inactive not-found listening running waiting plugged mounted exited dead masked)
295
    _values -s , "${_states[@]}"
296
}
297
298
_unit_types() {
299
    local -a _types
300
    _types=(automount device mount path service snapshot socket swap target timer)
301
    _values -s , "${_types[@]}"
302
}
303
304
_unit_properties() {
305
  if ( [[ ${+_sys_all_properties} -eq 0 ]] || _cache_invalid SYS_ALL_PROPERTIES ) &&
306
    ! _retrieve_cache SYS_ALL_PROPERTIES;
307
  then
308
    _sys_all_properties=( $( {__systemctl show --all;
309
       @rootlibexecdir@/systemd --dump-configuration-items; } | {
310
       while IFS='=' read -r a b; do [ -n "$b" ] && echo "$a"; done
311
    }) )
312
    _store_cache SYS_ALL_PROPRTIES _sys_all_properties
313
  fi
314
  _values -s , "${_sys_all_properties[@]}"
315
}
316
317
_arguments -s \
318
    {-h,--help}'[Show help]' \
319
    '--version[Show package version]' \
320
    {-t+,--type=}'[List only units of a particular type]:unit type:_unit_types' \
321
    '--state=[Display units in the specifyied state]:unit state:_unit_states' \
322
    {-p+,--property=}'[Show only properties by specific name]:unit property:_unit_properties' \
323
    {-a,--all}'[Show all units/properties, including dead/empty ones]' \
324
    '--reverse[Show reverse dependencies]' \
325
    '--after[Show units ordered after]' \
326
    '--before[Show units ordered before]' \
327
    '--failed[Show only failed units]' \
328
    {-l,--full}"[Don't ellipsize unit names on output]" \
329
    '--fail[When queueing a new job, fail if conflicting jobs are pending]' \
330
    '--show-types[When showing sockets, show socket type]' \
331
    '--irreversible[Mark transactions as irreversible]' \
332
    '--ignore-dependencies[When queueing a new job, ignore all its dependencies]' \
333
    {-i,--ignore-inhibitors}'[When executing a job, ignore jobs dependencies]' \
334
    {-q,--quiet}'[Suppress output]' \
335
    '--no-block[Do not wait until operation finished]' \
336
    '--no-legend[Do not print a legend, i.e. the column headers and the footer with hints]' \
337
    '--no-pager[Do not pipe output into a pager]' \
338
    '--system[Connect to system manager]' \
339
    '--user[Connect to user service manager]' \
340
    "--no-wall[Don't send wall message before halt/power-off/reboot]" \
341
    '--global[Enable/disable unit files globally]' \
342
    "--no-reload[When enabling/disabling unit files, don't reload daemon configuration]" \
343
    '--no-ask-password[Do not ask for system passwords]' \
344
    '--kill-who=[Who to send signal to]:killwho:(main control all)' \
345
    {-s+,--signal=}'[Which signal to send]:signal:_signals' \
346
    {-f,--force}'[When enabling unit files, override existing symlinks. When shutting down, execute action immediately]' \
347
    '--root=[Enable unit files in the specified root directory]:directory:_directories' \
348
    '--runtime[Enable unit files only temporarily until next reboot]' \
349
    {-H+,--host=}'[Operate on remote host]:userathost:_sd_hosts_or_user_at_host' \
350
    {-P,--privileged}'[Acquire privileges before execution]' \
351
    {-n+,--lines=}'[Journal entries to show]:number of entries' \
352
    {-o+,--output=}'[Change journal output mode]:modes:_sd_outputmodes' \
353
    '--plain[When used with list-dependencies, print output as a list]' \
354
    '*::systemctl command:_systemctl_command'
(-)a/src/core/main.c (-1 / +9 lines)
Lines 1543-1549 int main(int argc, char *argv[]) { Link Here
1543
                if (in_initrd())
1543
                if (in_initrd())
1544
                        log_info("Running in initial RAM disk.");
1544
                        log_info("Running in initial RAM disk.");
1545
1545
1546
                empty_etc = dir_is_empty("/etc") > 0;
1546
                /* Let's check whether /etc is already populated. We
1547
                 * don't actually really check for that, but use
1548
                 * /etc/machine-id as flag file. This allows container
1549
                 * managers and installers to provision a couple of
1550
                 * files already. If the container manager wants to
1551
                 * provision the machine ID itself it should pass
1552
                 * $container_uuid to PID 1.*/
1553
1554
                empty_etc = access("/etc/machine-id", F_OK) < 0;
1547
                if (empty_etc)
1555
                if (empty_etc)
1548
                        log_info("Running with unpopulated /etc.");
1556
                        log_info("Running with unpopulated /etc.");
1549
        } else {
1557
        } else {
(-)a/src/core/manager.c (-2 / +3 lines)
Lines 554-560 static int manager_setup_notify(Manager *m) { Link Here
554
                strncpy(sa.un.sun_path, m->notify_socket, sizeof(sa.un.sun_path)-1);
554
                strncpy(sa.un.sun_path, m->notify_socket, sizeof(sa.un.sun_path)-1);
555
                r = bind(fd, &sa.sa, offsetof(struct sockaddr_un, sun_path) + strlen(sa.un.sun_path));
555
                r = bind(fd, &sa.sa, offsetof(struct sockaddr_un, sun_path) + strlen(sa.un.sun_path));
556
                if (r < 0) {
556
                if (r < 0) {
557
                        log_error("bind() failed: %m");
557
                        log_error("bind(@%s) failed: %m", sa.un.sun_path+1);
558
                        return -errno;
558
                        return -errno;
559
                }
559
                }
560
560
Lines 2539-2545 void manager_check_finished(Manager *m) { Link Here
2539
        }
2539
        }
2540
2540
2541
        SET_FOREACH(u, m->startup_units, i)
2541
        SET_FOREACH(u, m->startup_units, i)
2542
                cgroup_context_apply(unit_get_cgroup_context(u), unit_get_cgroup_mask(u), u->cgroup_path, manager_state(m));
2542
                if (u->cgroup_path)
2543
                        cgroup_context_apply(unit_get_cgroup_context(u), unit_get_cgroup_mask(u), u->cgroup_path, manager_state(m));
2543
2544
2544
        bus_manager_send_finished(m, firmware_usec, loader_usec, kernel_usec, initrd_usec, userspace_usec, total_usec);
2545
        bus_manager_send_finished(m, firmware_usec, loader_usec, kernel_usec, initrd_usec, userspace_usec, total_usec);
2545
2546
(-)a/src/core/path.c (-1 / +2 lines)
Lines 99-105 int path_spec_watch(PathSpec *s, sd_event_io_handler_t handler) { Link Here
99
                                break;
99
                                break;
100
                        }
100
                        }
101
101
102
                        log_warning("Failed to add watch on %s: %m", s->path);
102
                        log_warning("Failed to add watch on %s: %s", s->path,
103
                                    errno == ENOSPC ? "too many watches" : strerror(-r));
103
                        r = -errno;
104
                        r = -errno;
104
                        if (cut)
105
                        if (cut)
105
                                *cut = tmp;
106
                                *cut = tmp;
(-)a/src/core/service.c (-1 / +8 lines)
Lines 1699-1704 static int service_start(Unit *u) { Link Here
1699
        s->main_pid_alien = false;
1699
        s->main_pid_alien = false;
1700
        s->forbid_restart = false;
1700
        s->forbid_restart = false;
1701
1701
1702
        free(s->status_text);
1703
        s->status_text = NULL;
1704
1702
        service_enter_start_pre(s);
1705
        service_enter_start_pre(s);
1703
        return 0;
1706
        return 0;
1704
}
1707
}
Lines 2547-2557 static int service_dispatch_timer(sd_event_source *source, usec_t usec, void *us Link Here
2547
2550
2548
static int service_dispatch_watchdog(sd_event_source *source, usec_t usec, void *userdata) {
2551
static int service_dispatch_watchdog(sd_event_source *source, usec_t usec, void *userdata) {
2549
        Service *s = SERVICE(userdata);
2552
        Service *s = SERVICE(userdata);
2553
        char t[FORMAT_TIMESPAN_MAX];
2550
2554
2551
        assert(s);
2555
        assert(s);
2552
        assert(source == s->watchdog_event_source);
2556
        assert(source == s->watchdog_event_source);
2553
2557
2554
        log_error_unit(UNIT(s)->id, "%s watchdog timeout!", UNIT(s)->id);
2558
        log_error_unit(UNIT(s)->id,
2559
                       "%s watchdog timeout (limit %s)!",
2560
                       UNIT(s)->id,
2561
                       format_timespan(t, sizeof(t), s->watchdog_usec, 1));
2555
        service_enter_signal(s, SERVICE_STOP_SIGTERM, SERVICE_FAILURE_WATCHDOG);
2562
        service_enter_signal(s, SERVICE_STOP_SIGTERM, SERVICE_FAILURE_WATCHDOG);
2556
2563
2557
        return 0;
2564
        return 0;
(-)a/src/escape/Makefile (+1 lines)
Line 0 Link Here
1
../Makefile
(-)a/src/escape/escape.c (+239 lines)
Line 0 Link Here
1
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3
/***
4
  This file is part of systemd.
5
6
  Copyright 2014 Michael Biebl
7
8
  systemd is free software; you can redistribute it and/or modify it
9
  under the terms of the GNU Lesser General Public License as published by
10
  the Free Software Foundation; either version 2.1 of the License, or
11
  (at your option) any later version.
12
13
  systemd is distributed in the hope that it will be useful, but
14
  WITHOUT ANY WARRANTY; without even the implied warranty of
15
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
  Lesser General Public License for more details.
17
18
  You should have received a copy of the GNU Lesser General Public License
19
  along with systemd; If not, see <http://www.gnu.org/licenses/>.
20
***/
21
22
#include <stdio.h>
23
#include <stdlib.h>
24
#include <getopt.h>
25
26
#include "log.h"
27
#include "unit-name.h"
28
#include "build.h"
29
#include "strv.h"
30
31
static enum {
32
        ACTION_ESCAPE,
33
        ACTION_UNESCAPE,
34
        ACTION_MANGLE
35
} arg_action = ACTION_ESCAPE;
36
static const char *arg_suffix = NULL;
37
static const char *arg_template = NULL;
38
static bool arg_path = false;
39
40
static int help(void) {
41
42
        printf("%s [OPTIONS...] [NAME...]\n\n"
43
               "Show system and user paths.\n\n"
44
               "  -h --help               Show this help\n"
45
               "     --version            Show package version\n"
46
               "     --suffix=SUFFIX      Unit suffix to append to escaped strings\n"
47
               "     --template=TEMPLATE  Insert strings as instance into template\n"
48
               "  -u --unescape           Unescape strings\n"
49
               "  -m --mangle             Mangle strings\n"
50
               "  -p --path               When escaping/unescaping assume the string is a path\n",
51
               program_invocation_short_name);
52
53
        return 0;
54
}
55
56
static int parse_argv(int argc, char *argv[]) {
57
58
        enum {
59
                ARG_VERSION = 0x100,
60
                ARG_SUFFIX,
61
                ARG_TEMPLATE
62
        };
63
64
        static const struct option options[] = {
65
                { "help",      no_argument,       NULL, 'h'           },
66
                { "version",   no_argument,       NULL, ARG_VERSION   },
67
                { "suffix",    required_argument, NULL, ARG_SUFFIX    },
68
                { "template",  required_argument, NULL, ARG_TEMPLATE  },
69
                { "unescape",  no_argument,       NULL, 'u'           },
70
                { "mangle",    no_argument,       NULL, 'm'           },
71
                { "path",      no_argument,       NULL, 'p'           },
72
                {}
73
        };
74
75
        int c;
76
77
        assert(argc >= 0);
78
        assert(argv);
79
80
        while ((c = getopt_long(argc, argv, "hump", options, NULL)) >= 0) {
81
82
                switch (c) {
83
84
                case 'h':
85
                        return help();
86
87
                case ARG_VERSION:
88
                        puts(PACKAGE_STRING);
89
                        puts(SYSTEMD_FEATURES);
90
                        return 0;
91
92
                case ARG_SUFFIX:
93
94
                        if (unit_type_from_string(optarg) < 0) {
95
                                log_error("Invalid unit suffix type %s.", optarg);
96
                                return -EINVAL;
97
                        }
98
99
                        arg_suffix = optarg;
100
                        break;
101
102
                case ARG_TEMPLATE:
103
104
                        if (!unit_name_is_valid(optarg, true) || !unit_name_is_template(optarg)) {
105
                                log_error("Template name %s is not valid.", optarg);
106
                                return -EINVAL;
107
                        }
108
109
                        arg_template = optarg;
110
                        break;
111
112
                case 'u':
113
                        arg_action = ACTION_UNESCAPE;
114
                        break;
115
116
                case 'm':
117
                        arg_action = ACTION_MANGLE;
118
                        break;
119
120
                case 'p':
121
                        arg_path = true;
122
                        break;
123
124
                case '?':
125
                        return -EINVAL;
126
127
                default:
128
                        assert_not_reached("Unhandled option");
129
                }
130
        }
131
132
        if (optind >= argc) {
133
                log_error("Not enough arguments.");
134
                return -EINVAL;
135
        }
136
137
        if (arg_template && arg_suffix) {
138
                log_error("--suffix= and --template= may not be combined.");
139
                return -EINVAL;
140
        }
141
142
        if ((arg_template || arg_suffix) && arg_action != ACTION_ESCAPE) {
143
                log_error("--suffix= and --template= are not compatible with --unescape or --mangle.");
144
                return -EINVAL;
145
        }
146
147
        if (arg_path && !IN_SET(arg_action, ACTION_ESCAPE, ACTION_UNESCAPE)) {
148
                log_error("--path may not be combined with --mangle.");
149
                return -EINVAL;
150
        }
151
152
        return 1;
153
}
154
155
int main(int argc, char *argv[]) {
156
        char **i;
157
        int r;
158
159
        log_parse_environment();
160
        log_open();
161
162
        r = parse_argv(argc, argv);
163
        if (r <= 0)
164
                goto finish;
165
166
        STRV_FOREACH(i, argv + optind) {
167
                _cleanup_free_ char *e = NULL;
168
169
                switch (arg_action) {
170
171
                case ACTION_ESCAPE:
172
                        if (arg_path)
173
                                e = unit_name_path_escape(*i);
174
                        else
175
                                e = unit_name_escape(*i);
176
177
                        if (!e) {
178
                                r = log_oom();
179
                                goto finish;
180
                        }
181
182
                        if (arg_template) {
183
                                char *x;
184
185
                                x = unit_name_replace_instance(arg_template, e);
186
                                if (!x) {
187
                                        r = log_oom();
188
                                        goto finish;
189
                                }
190
191
                                free(e);
192
                                e = x;
193
                        } else if (arg_suffix) {
194
                                char *x;
195
196
                                x = strjoin(e, ".", arg_suffix, NULL);
197
                                if (!x) {
198
                                        r = log_oom();
199
                                        goto finish;
200
                                }
201
202
                                free(e);
203
                                e = x;
204
                        }
205
206
                        break;
207
208
                case ACTION_UNESCAPE:
209
                        if (arg_path)
210
                                e = unit_name_path_unescape(*i);
211
                        else
212
                                e = unit_name_unescape(*i);
213
214
                        if (!e) {
215
                                r = log_oom();
216
                                goto finish;
217
                        }
218
                        break;
219
220
                case ACTION_MANGLE:
221
                        e = unit_name_mangle(*i, MANGLE_NOGLOB);
222
                        if (!e) {
223
                                r = log_oom();
224
                                goto finish;
225
                        }
226
                        break;
227
                }
228
229
                if (i != argv+optind)
230
                        fputc(' ', stdout);
231
232
                fputs(e, stdout);
233
        }
234
235
        fputc('\n', stdout);
236
237
finish:
238
        return r <= 0 ? EXIT_FAILURE : EXIT_SUCCESS;
239
}
(-)a/src/hostname/hostnamed.c (-3 / +3 lines)
Lines 144-150 static bool valid_chassis(const char *chassis) { Link Here
144
                        "laptop\0"
144
                        "laptop\0"
145
                        "server\0"
145
                        "server\0"
146
                        "tablet\0"
146
                        "tablet\0"
147
                        "handset\0",
147
                        "handset\0"
148
                        "watch\0",
148
                        chassis);
149
                        chassis);
149
}
150
}
150
151
Lines 550-557 static int set_machine_info(Context *c, sd_bus *bus, sd_bus_message *m, int prop Link Here
550
551
551
                if (prop == PROP_ICON_NAME && !filename_is_safe(name))
552
                if (prop == PROP_ICON_NAME && !filename_is_safe(name))
552
                        return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid icon name '%s'", name);
553
                        return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid icon name '%s'", name);
553
                if (prop == PROP_PRETTY_HOSTNAME &&
554
                if (prop == PROP_PRETTY_HOSTNAME && string_has_cc(name, NULL))
554
                    (string_has_cc(name) || chars_intersect(name, "\t")))
555
                        return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid pretty host name '%s'", name);
555
                        return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid pretty host name '%s'", name);
556
                if (prop == PROP_CHASSIS && !valid_chassis(name))
556
                if (prop == PROP_CHASSIS && !valid_chassis(name))
557
                        return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid chassis '%s'", name);
557
                        return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid chassis '%s'", name);
(-)a/src/journal/compress.c (-2 / +12 lines)
Lines 30-35 Link Here
30
#include "util.h"
30
#include "util.h"
31
31
32
bool compress_blob(const void *src, uint64_t src_size, void *dst, uint64_t *dst_size) {
32
bool compress_blob(const void *src, uint64_t src_size, void *dst, uint64_t *dst_size) {
33
        static const lzma_options_lzma opt = {
34
                1u << 20u, NULL, 0, LZMA_LC_DEFAULT, LZMA_LP_DEFAULT,
35
                LZMA_PB_DEFAULT, LZMA_MODE_FAST, 128, LZMA_MF_HC3, 4};
36
        static const lzma_filter filters[2] = {
37
                {LZMA_FILTER_LZMA2, (lzma_options_lzma*) &opt},
38
                {LZMA_VLI_UNKNOWN, NULL}
39
        };
33
        lzma_ret ret;
40
        lzma_ret ret;
34
        size_t out_pos = 0;
41
        size_t out_pos = 0;
35
42
Lines 41-48 bool compress_blob(const void *src, uint64_t src_size, void *dst, uint64_t *dst_ Link Here
41
        /* Returns false if we couldn't compress the data or the
48
        /* Returns false if we couldn't compress the data or the
42
         * compressed result is longer than the original */
49
         * compressed result is longer than the original */
43
50
44
        ret = lzma_easy_buffer_encode(LZMA_PRESET_DEFAULT, LZMA_CHECK_NONE, NULL,
51
        if (src_size < 80)
45
                                      src, src_size, dst, &out_pos, src_size);
52
                return -ENOBUFS;
53
54
        ret = lzma_stream_buffer_encode((lzma_filter*) filters, LZMA_CHECK_NONE, NULL,
55
                                        src, src_size, dst, &out_pos, src_size - 1);
46
        if (ret != LZMA_OK)
56
        if (ret != LZMA_OK)
47
                return false;
57
                return false;
48
58
(-)a/src/journal/coredumpctl.c (-2 / +3 lines)
Lines 595-601 static int save_core(sd_journal *j, int fd, char **path, bool *unlink_temp) { Link Here
595
                retrieve(data, len, "COREDUMP_FILENAME", &filename);
595
                retrieve(data, len, "COREDUMP_FILENAME", &filename);
596
596
597
        if (filename && access(filename, R_OK) < 0) {
597
        if (filename && access(filename, R_OK) < 0) {
598
                log_debug("File %s is not readable: %m", filename);
598
                log_full(errno == ENOENT ? LOG_DEBUG : LOG_WARNING,
599
                         "File %s is not readable: %m", filename);
599
                free(filename);
600
                free(filename);
600
                filename = NULL;
601
                filename = NULL;
601
        }
602
        }
Lines 668-674 static int save_core(sd_journal *j, int fd, char **path, bool *unlink_temp) { Link Here
668
#endif
669
#endif
669
                } else {
670
                } else {
670
                        if (r == -ENOENT)
671
                        if (r == -ENOENT)
671
                                log_error("Coredump neither in journal file nor stored externally on disk.");
672
                                log_error("Cannot retrieve coredump from journal nor disk.");
672
                        else
673
                        else
673
                                log_error("Failed to retrieve COREDUMP field: %s", strerror(-r));
674
                                log_error("Failed to retrieve COREDUMP field: %s", strerror(-r));
674
                        goto error;
675
                        goto error;
(-)a/src/journal/journal-file.c (-6 lines)
Lines 271-282 static int journal_file_verify_header(JournalFile *f) { Link Here
271
            !VALID64(le64toh(f->header->entry_array_offset)))
271
            !VALID64(le64toh(f->header->entry_array_offset)))
272
                return -ENODATA;
272
                return -ENODATA;
273
273
274
        if (le64toh(f->header->data_hash_table_offset) < le64toh(f->header->header_size) ||
275
            le64toh(f->header->field_hash_table_offset) < le64toh(f->header->header_size) ||
276
            le64toh(f->header->tail_object_offset) < le64toh(f->header->header_size) ||
277
            le64toh(f->header->entry_array_offset) < le64toh(f->header->header_size))
278
                return -ENODATA;
279
280
        if (f->writable) {
274
        if (f->writable) {
281
                uint8_t state;
275
                uint8_t state;
282
                sd_id128_t machine_id;
276
                sd_id128_t machine_id;
(-)a/src/journal/journald-native.c (-1 / +1 lines)
Lines 387-393 int server_open_native_socket(Server*s) { Link Here
387
387
388
                r = bind(s->native_fd, &sa.sa, offsetof(union sockaddr_union, un.sun_path) + strlen(sa.un.sun_path));
388
                r = bind(s->native_fd, &sa.sa, offsetof(union sockaddr_union, un.sun_path) + strlen(sa.un.sun_path));
389
                if (r < 0) {
389
                if (r < 0) {
390
                        log_error("bind() failed: %m");
390
                        log_error("bind(%s) failed: %m", sa.un.sun_path);
391
                        return -errno;
391
                        return -errno;
392
                }
392
                }
393
393
(-)a/src/journal/journald-stream.c (-2 / +2 lines)
Lines 450-463 int server_open_stdout_socket(Server *s) { Link Here
450
450
451
                r = bind(s->stdout_fd, &sa.sa, offsetof(union sockaddr_union, un.sun_path) + strlen(sa.un.sun_path));
451
                r = bind(s->stdout_fd, &sa.sa, offsetof(union sockaddr_union, un.sun_path) + strlen(sa.un.sun_path));
452
                if (r < 0) {
452
                if (r < 0) {
453
                        log_error("bind() failed: %m");
453
                        log_error("bind(%s) failed: %m", sa.un.sun_path);
454
                        return -errno;
454
                        return -errno;
455
                }
455
                }
456
456
457
                chmod(sa.un.sun_path, 0666);
457
                chmod(sa.un.sun_path, 0666);
458
458
459
                if (listen(s->stdout_fd, SOMAXCONN) < 0) {
459
                if (listen(s->stdout_fd, SOMAXCONN) < 0) {
460
                        log_error("listen() failed: %m");
460
                        log_error("listen(%s) failed: %m", sa.un.sun_path);
461
                        return -errno;
461
                        return -errno;
462
                }
462
                }
463
        } else
463
        } else
(-)a/src/journal/journald-syslog.c (-1 / +1 lines)
Lines 441-447 int server_open_syslog_socket(Server *s) { Link Here
441
441
442
                r = bind(s->syslog_fd, &sa.sa, offsetof(union sockaddr_union, un.sun_path) + strlen(sa.un.sun_path));
442
                r = bind(s->syslog_fd, &sa.sa, offsetof(union sockaddr_union, un.sun_path) + strlen(sa.un.sun_path));
443
                if (r < 0) {
443
                if (r < 0) {
444
                        log_error("bind() failed: %m");
444
                        log_error("bind(%s) failed: %m", sa.un.sun_path);
445
                        return -errno;
445
                        return -errno;
446
                }
446
                }
447
447
(-)a/src/journal/sd-journal.c (-8 / +8 lines)
Lines 2390-2396 _public_ int sd_journal_get_cutoff_realtime_usec(sd_journal *j, uint64_t *from, Link Here
2390
_public_ int sd_journal_get_cutoff_monotonic_usec(sd_journal *j, sd_id128_t boot_id, uint64_t *from, uint64_t *to) {
2390
_public_ int sd_journal_get_cutoff_monotonic_usec(sd_journal *j, sd_id128_t boot_id, uint64_t *from, uint64_t *to) {
2391
        Iterator i;
2391
        Iterator i;
2392
        JournalFile *f;
2392
        JournalFile *f;
2393
        bool first = true;
2393
        bool found = false;
2394
        int r;
2394
        int r;
2395
2395
2396
        assert_return(j, -EINVAL);
2396
        assert_return(j, -EINVAL);
Lines 2409-2429 _public_ int sd_journal_get_cutoff_monotonic_usec(sd_journal *j, sd_id128_t boot Link Here
2409
                if (r == 0)
2409
                if (r == 0)
2410
                        continue;
2410
                        continue;
2411
2411
2412
                if (first) {
2412
                if (found) {
2413
                        if (from)
2413
                        if (from)
2414
                                *from = fr;
2414
                                *from = MIN(fr, *from);
2415
                        if (to)
2415
                        if (to)
2416
                                *to = t;
2416
                                *to = MAX(t, *to);
2417
                        first = false;
2418
                } else {
2417
                } else {
2419
                        if (from)
2418
                        if (from)
2420
                                *from = MIN(fr, *from);
2419
                                *from = fr;
2421
                        if (to)
2420
                        if (to)
2422
                                *to = MAX(t, *to);
2421
                                *to = t;
2422
                        found = true;
2423
                }
2423
                }
2424
        }
2424
        }
2425
2425
2426
        return first ? 0 : 1;
2426
        return found;
2427
}
2427
}
2428
2428
2429
void journal_print_header(sd_journal *j) {
2429
void journal_print_header(sd_journal *j) {
(-)a/src/journal/test-journal-send.c (-1 / +1 lines)
Lines 72-78 int main(int argc, char *argv[]) { Link Here
72
                        "N_CPUS=%li", sysconf(_SC_NPROCESSORS_ONLN),
72
                        "N_CPUS=%li", sysconf(_SC_NPROCESSORS_ONLN),
73
                        NULL);
73
                        NULL);
74
74
75
        sleep(10);
75
        sleep(1);
76
76
77
        return 0;
77
        return 0;
78
}
78
}
(-)a/src/libsystemd-network/sd-dhcp6-client.c (-1 / +2 lines)
Lines 708-714 static int client_receive_reply(sd_dhcp6_client *client, DHCP6Message *reply, Link Here
708
                        return 0;
708
                        return 0;
709
        }
709
        }
710
710
711
        dhcp6_lease_clear_timers(&client->lease->ia);
711
        if (client->lease)
712
            dhcp6_lease_clear_timers(&client->lease->ia);
712
713
713
        client->lease = sd_dhcp6_lease_unref(client->lease);
714
        client->lease = sd_dhcp6_lease_unref(client->lease);
714
        client->lease = lease;
715
        client->lease = lease;
(-)a/src/libsystemd/sd-path/sd-path.c (+1 lines)
Lines 22-27 Link Here
22
#include "path-util.h"
22
#include "path-util.h"
23
#include "strv.h"
23
#include "strv.h"
24
#include "sd-path.h"
24
#include "sd-path.h"
25
#include "missing.h"
25
26
26
static int from_environment(const char *envname, const char *fallback, const char **ret) {
27
static int from_environment(const char *envname, const char *fallback, const char **ret) {
27
        assert(ret);
28
        assert(ret);
(-)a/src/login/70-uaccess.rules (-6 / +9 lines)
Lines 12-18 ENV{MAJOR}=="", GOTO="uaccess_end" Link Here
12
SUBSYSTEM=="usb", ENV{ID_USB_INTERFACES}=="*:060101:*", TAG+="uaccess"
12
SUBSYSTEM=="usb", ENV{ID_USB_INTERFACES}=="*:060101:*", TAG+="uaccess"
13
13
14
# Digicams with proprietary protocol
14
# Digicams with proprietary protocol
15
ENV{ID_GPHOTO2}=="*?", TAG+="uaccess"
15
ENV{ID_GPHOTO2}=="?*", TAG+="uaccess"
16
16
17
# SCSI and USB scanners
17
# SCSI and USB scanners
18
ENV{libsane_matched}=="yes", TAG+="uaccess"
18
ENV{libsane_matched}=="yes", TAG+="uaccess"
Lines 49-61 SUBSYSTEM=="drm", KERNEL=="card*|renderD*", TAG+="uaccess" Link Here
49
SUBSYSTEM=="misc", KERNEL=="kvm", TAG+="uaccess"
49
SUBSYSTEM=="misc", KERNEL=="kvm", TAG+="uaccess"
50
50
51
# smart-card readers
51
# smart-card readers
52
ENV{ID_SMARTCARD_READER}=="*?", TAG+="uaccess"
52
ENV{ID_SMARTCARD_READER}=="?*", TAG+="uaccess"
53
53
54
# (USB) authentication devices
54
# (USB) authentication devices
55
ENV{ID_SECURITY_TOKEN}=="*?", TAG+="uaccess"
55
ENV{ID_SECURITY_TOKEN}=="?*", TAG+="uaccess"
56
56
57
# PDA devices
57
# PDA devices
58
ENV{ID_PDA}=="*?", TAG+="uaccess"
58
ENV{ID_PDA}=="?*", TAG+="uaccess"
59
59
60
# Programmable remote control
60
# Programmable remote control
61
ENV{ID_REMOTE_CONTROL}=="1", TAG+="uaccess"
61
ENV{ID_REMOTE_CONTROL}=="1", TAG+="uaccess"
Lines 64-75 ENV{ID_REMOTE_CONTROL}=="1", TAG+="uaccess" Link Here
64
SUBSYSTEM=="input", ENV{ID_INPUT_JOYSTICK}=="?*", TAG+="uaccess"
64
SUBSYSTEM=="input", ENV{ID_INPUT_JOYSTICK}=="?*", TAG+="uaccess"
65
65
66
# color measurement devices
66
# color measurement devices
67
ENV{COLOR_MEASUREMENT_DEVICE}=="*?", TAG+="uaccess"
67
ENV{COLOR_MEASUREMENT_DEVICE}=="?*", TAG+="uaccess"
68
68
69
# DDC/CI device, usually high-end monitors such as the DreamColor
69
# DDC/CI device, usually high-end monitors such as the DreamColor
70
ENV{DDC_DEVICE}=="*?", TAG+="uaccess"
70
ENV{DDC_DEVICE}=="?*", TAG+="uaccess"
71
71
72
# media player raw devices (for user-mode drivers, Android SDK, etc.)
72
# media player raw devices (for user-mode drivers, Android SDK, etc.)
73
SUBSYSTEM=="usb", ENV{ID_MEDIA_PLAYER}=="?*", TAG+="uaccess"
73
SUBSYSTEM=="usb", ENV{ID_MEDIA_PLAYER}=="?*", TAG+="uaccess"
74
74
75
# software-defined radio communication devices
76
ENV{ID_SOFTWARE_RADIO}=="?*", TAG+="uaccess"
77
75
LABEL="uaccess_end"
78
LABEL="uaccess_end"
(-)a/src/login/logind-acl.c (-1 / +4 lines)
Lines 277-283 int devnode_acl_all(struct udev *udev, Link Here
277
        SET_FOREACH(n, nodes, i) {
277
        SET_FOREACH(n, nodes, i) {
278
                int k;
278
                int k;
279
279
280
                log_debug("Fixing up ACLs at %s for seat %s", n, seat);
280
                log_debug("Changing ACLs at %s for seat %s (uid "UID_FMT"→"UID_FMT"%s%s)",
281
                          n, seat, old_uid, new_uid,
282
                          del ? " del" : "", add ? " add" : "");
283
281
                k = devnode_acl(n, flush, del, old_uid, add, new_uid);
284
                k = devnode_acl(n, flush, del, old_uid, add, new_uid);
282
                if (k == -ENOENT)
285
                if (k == -ENOENT)
283
                        log_debug("Device %s disappeared while setting ACLs", n);
286
                        log_debug("Device %s disappeared while setting ACLs", n);
(-)a/src/login/logind-seat.c (-1 / +6 lines)
Lines 275-282 int seat_switch_to(Seat *s, unsigned int num) { Link Here
275
        if (!num)
275
        if (!num)
276
                return -EINVAL;
276
                return -EINVAL;
277
277
278
        if (num >= s->position_count || !s->positions[num])
278
        if (num >= s->position_count || !s->positions[num]) {
279
                /* allow switching to unused VTs to trigger auto-activate */
280
                if (seat_has_vts(s) && num < 64)
281
                        return chvt(num);
282
279
                return -EINVAL;
283
                return -EINVAL;
284
        }
280
285
281
        return session_activate(s->positions[num]);
286
        return session_activate(s->positions[num]);
282
}
287
}
(-)a/src/machine/machine.c (-1 / +1 lines)
Lines 371-377 static int machine_stop_scope(Machine *m) { Link Here
371
        free(m->scope_job);
371
        free(m->scope_job);
372
        m->scope_job = job;
372
        m->scope_job = job;
373
373
374
        return r;
374
        return 0;
375
}
375
}
376
376
377
int machine_stop(Machine *m) {
377
int machine_stop(Machine *m) {
(-)a/src/network/networkd-link.c (-28 / +39 lines)
Lines 599-608 static int route_drop_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) Link Here
599
        return 0;
599
        return 0;
600
}
600
}
601
601
602
static int link_get_address_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
603
        _cleanup_link_unref_ Link *link = userdata;
604
        int r;
605
606
        assert(rtnl);
607
        assert(m);
608
        assert(link);
609
        assert(link->manager);
610
611
        for (; m; m = sd_rtnl_message_next(m)) {
612
                r = sd_rtnl_message_get_errno(m);
613
                if (r < 0) {
614
                        log_debug_link(link, "getting address failed: %s", strerror(-r));
615
                        continue;
616
                }
617
618
                r = link_rtnl_process_address(rtnl, m, link->manager);
619
                if (r < 0)
620
                        log_warning_link(link, "could not process address: %s", strerror(-r));
621
        }
622
623
        return 1;
624
}
625
602
static int address_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
626
static int address_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
603
        _cleanup_link_unref_ Link *link = userdata;
627
        _cleanup_link_unref_ Link *link = userdata;
604
        int r;
628
        int r;
605
629
630
        assert(rtnl);
606
        assert(m);
631
        assert(m);
607
        assert(link);
632
        assert(link);
608
        assert(link->ifname);
633
        assert(link->ifname);
Lines 623-628 static int address_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) { Link Here
623
                                link->ifname, strerror(-r),
648
                                link->ifname, strerror(-r),
624
                                "ERRNO=%d", -r,
649
                                "ERRNO=%d", -r,
625
                                NULL);
650
                                NULL);
651
        if (r >= 0) {
652
                /* calling handler directly so take a ref */
653
                link_ref(link);
654
                link_get_address_handler(rtnl, m, link);
655
        }
626
656
627
        if (link->addr_messages == 0) {
657
        if (link->addr_messages == 0) {
628
                log_debug_link(link, "addresses set");
658
                log_debug_link(link, "addresses set");
Lines 2140-2146 int link_rtnl_process_address(sd_rtnl *rtnl, sd_rtnl_message *message, void *use Link Here
2140
2170
2141
        r = address_new_dynamic(&address);
2171
        r = address_new_dynamic(&address);
2142
        if (r < 0)
2172
        if (r < 0)
2143
                return 0;
2173
                return r;
2144
2174
2145
        r = sd_rtnl_message_addr_get_family(message, &address->family);
2175
        r = sd_rtnl_message_addr_get_family(message, &address->family);
2146
        if (r < 0 || !IN_SET(address->family, AF_INET, AF_INET6)) {
2176
        if (r < 0 || !IN_SET(address->family, AF_INET, AF_INET6)) {
Lines 2204-2210 int link_rtnl_process_address(sd_rtnl *rtnl, sd_rtnl_message *message, void *use Link Here
2204
        case RTM_NEWADDR:
2234
        case RTM_NEWADDR:
2205
                if (!address_dropped)
2235
                if (!address_dropped)
2206
                        log_debug_link(link, "added address: %s/%u", buf,
2236
                        log_debug_link(link, "added address: %s/%u", buf,
2207
                                      address->prefixlen);
2237
                                       address->prefixlen);
2238
                else
2239
                        log_debug_link(link, "updated address: %s/%u", buf,
2240
                                       address->prefixlen);
2208
2241
2209
                LIST_PREPEND(addresses, link->addresses, address);
2242
                LIST_PREPEND(addresses, link->addresses, address);
2210
                address = NULL;
2243
                address = NULL;
Lines 2215-2224 int link_rtnl_process_address(sd_rtnl *rtnl, sd_rtnl_message *message, void *use Link Here
2215
        case RTM_DELADDR:
2248
        case RTM_DELADDR:
2216
                if (address_dropped) {
2249
                if (address_dropped) {
2217
                        log_debug_link(link, "removed address: %s/%u", buf,
2250
                        log_debug_link(link, "removed address: %s/%u", buf,
2218
                                      address->prefixlen);
2251
                                       address->prefixlen);
2219
2252
2220
                        link_save(link);
2253
                        link_save(link);
2221
                }
2254
                } else
2255
                        log_warning_link(link, "removing non-existent address: %s/%u",
2256
                                         buf, address->prefixlen);
2222
2257
2223
                break;
2258
                break;
2224
        default:
2259
        default:
Lines 2228-2257 int link_rtnl_process_address(sd_rtnl *rtnl, sd_rtnl_message *message, void *use Link Here
2228
        return 1;
2263
        return 1;
2229
}
2264
}
2230
2265
2231
static int link_get_address_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
2232
        _cleanup_link_unref_ Link *link = userdata;
2233
        int r;
2234
2235
        assert(rtnl);
2236
        assert(m);
2237
        assert(link);
2238
        assert(link->manager);
2239
2240
        for (; m; m = sd_rtnl_message_next(m)) {
2241
                r = sd_rtnl_message_get_errno(m);
2242
                if (r < 0) {
2243
                        log_debug_link(link, "getting address failed: %s", strerror(-r));
2244
                        continue;
2245
                }
2246
2247
                r = link_rtnl_process_address(rtnl, m, link->manager);
2248
                if (r < 0)
2249
                        log_warning_link(link, "could not process address: %s", strerror(-r));
2250
        }
2251
2252
        return 1;
2253
}
2254
2255
int link_add(Manager *m, sd_rtnl_message *message, Link **ret) {
2266
int link_add(Manager *m, sd_rtnl_message *message, Link **ret) {
2256
        Link *link;
2267
        Link *link;
2257
        _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL;
2268
        _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL;
(-)a/src/network/networkd-macvlan.c (+2 lines)
Lines 150-155 int netdev_create_macvlan(NetDev *netdev, Link *link, sd_rtnl_message_handler_t Link Here
150
                return r;
150
                return r;
151
        }
151
        }
152
152
153
        link_ref(link);
154
153
        log_debug_netdev(netdev, "creating netdev");
155
        log_debug_netdev(netdev, "creating netdev");
154
156
155
        netdev->state = NETDEV_STATE_CREATING;
157
        netdev->state = NETDEV_STATE_CREATING;
(-)a/src/network/networkd-network.c (-1 / +1 lines)
Lines 92-98 static int network_load_one(Manager *manager, const char *filename) { Link Here
92
        network->dhcp_routes = true;
92
        network->dhcp_routes = true;
93
        network->dhcp_sendhost = true;
93
        network->dhcp_sendhost = true;
94
94
95
        r = config_parse(NULL, filename, file, "Match\0Network\0Address\0Route\0DHCPv4\0", config_item_perf_lookup,
95
        r = config_parse(NULL, filename, file, "Match\0Network\0Address\0Route\0DHCP\0DHCPv4\0", config_item_perf_lookup,
96
                        (void*) network_network_gperf_lookup, false, false, network);
96
                        (void*) network_network_gperf_lookup, false, false, network);
97
        if (r < 0) {
97
        if (r < 0) {
98
                log_warning("Could not parse config file %s: %s", filename, strerror(-r));
98
                log_warning("Could not parse config file %s: %s", filename, strerror(-r));
(-)a/src/network/networkd-tunnel.c (+2 lines)
Lines 529-534 int netdev_create_tunnel(NetDev *netdev, Link *link, sd_rtnl_message_handler_t c Link Here
529
                return r;
529
                return r;
530
        }
530
        }
531
531
532
        link_ref(link);
533
532
        log_debug_netdev(netdev, "Creating tunnel netdev: %s",
534
        log_debug_netdev(netdev, "Creating tunnel netdev: %s",
533
                         netdev_kind_to_string(netdev->kind));
535
                         netdev_kind_to_string(netdev->kind));
534
536
(-)a/src/network/networkd-vlan.c (+2 lines)
Lines 139-144 int netdev_create_vlan(NetDev *netdev, Link *link, sd_rtnl_message_handler_t cal Link Here
139
                return r;
139
                return r;
140
        }
140
        }
141
141
142
        link_ref(link);
143
142
        log_debug_netdev(netdev, "creating netdev");
144
        log_debug_netdev(netdev, "creating netdev");
143
145
144
        netdev->state = NETDEV_STATE_CREATING;
146
        netdev->state = NETDEV_STATE_CREATING;
(-)a/src/network/networkd-vxlan.c (+2 lines)
Lines 154-159 int netdev_create_vxlan(NetDev *netdev, Link *link, sd_rtnl_message_handler_t ca Link Here
154
                return r;
154
                return r;
155
        }
155
        }
156
156
157
        link_ref(link);
158
157
        log_debug_netdev(netdev, "Creating vxlan netdev: %s",
159
        log_debug_netdev(netdev, "Creating vxlan netdev: %s",
158
                         netdev_kind_to_string(netdev->kind));
160
                         netdev_kind_to_string(netdev->kind));
159
161
(-)a/src/shared/architecture.c (-1 / +2 lines)
Lines 115-121 Architecture uname_architecture(void) { Link Here
115
#elif defined(__tilegx__)
115
#elif defined(__tilegx__)
116
                { "tilegx",     ARCHITECTURE_TILEGX   },
116
                { "tilegx",     ARCHITECTURE_TILEGX   },
117
#elif defined(__cris__)
117
#elif defined(__cris__)
118
                { "cris",       ARCHITECTURE_CRIS     },
119
                { "crisv32",    ARCHITECTURE_CRIS     },
118
                { "crisv32",    ARCHITECTURE_CRIS     },
120
#else
119
#else
121
#error "Please register your architecture here!"
120
#error "Please register your architecture here!"
Lines 154-160 static const char *const architecture_table[_ARCHITECTURE_MAX] = { Link Here
154
        [ARCHITECTURE_SPARC] = "sparc",
153
        [ARCHITECTURE_SPARC] = "sparc",
155
        [ARCHITECTURE_SPARC64] = "sparc64",
154
        [ARCHITECTURE_SPARC64] = "sparc64",
156
        [ARCHITECTURE_MIPS] = "mips",
155
        [ARCHITECTURE_MIPS] = "mips",
156
        [ARCHITECTURE_MIPS_LE] = "mips-le",
157
        [ARCHITECTURE_MIPS64] = "mips64",
157
        [ARCHITECTURE_MIPS64] = "mips64",
158
        [ARCHITECTURE_MIPS64_LE] = "mips64-le",
158
        [ARCHITECTURE_ALPHA] = "alpha",
159
        [ARCHITECTURE_ALPHA] = "alpha",
159
        [ARCHITECTURE_ARM] = "arm",
160
        [ARCHITECTURE_ARM] = "arm",
160
        [ARCHITECTURE_ARM_BE] = "arm-be",
161
        [ARCHITECTURE_ARM_BE] = "arm-be",
(-)a/src/shared/ask-password-api.c (-1 / +1 lines)
Lines 270-276 static int create_socket(char **name) { Link Here
270
270
271
        if (r < 0) {
271
        if (r < 0) {
272
                r = -errno;
272
                r = -errno;
273
                log_error("bind() failed: %m");
273
                log_error("bind(%s) failed: %m", sa.un.sun_path);
274
                goto fail;
274
                goto fail;
275
        }
275
        }
276
276
(-)a/src/shared/base-filesystem.c (-5 / +6 lines)
Lines 42-53 typedef struct BaseFilesystem { Link Here
42
} BaseFilesystem;
42
} BaseFilesystem;
43
43
44
static const BaseFilesystem table[] = {
44
static const BaseFilesystem table[] = {
45
        { "bin",      0, "usr/bin",                             NULL },
45
        { "bin",      0, "usr/bin\0",                  NULL },
46
        { "lib",      0, "usr/lib",                             NULL },
46
        { "lib",      0, "usr/lib\0",                  NULL },
47
        { "root",  0755, NULL,                                  NULL },
47
        { "root",  0755, NULL,                         NULL },
48
        { "sbin",     0, "usr/sbin",                            NULL },
48
        { "sbin",     0, "usr/sbin\0",                 NULL },
49
#if defined(__i386__) || defined(__x86_64__)
49
#if defined(__i386__) || defined(__x86_64__)
50
        { "lib64",    0, "usr/lib/x86_64-linux-gnu\0usr/lib64", "ld-linux-x86-64.so.2" },
50
        { "lib64",    0, "usr/lib/x86_64-linux-gnu\0"
51
                         "usr/lib64\0",                "ld-linux-x86-64.so.2" },
51
#endif
52
#endif
52
};
53
};
53
54
(-)a/src/shared/dropin.h (-1 / +3 lines)
Lines 21-26 Link Here
21
  along with systemd; If not, see <http://www.gnu.org/licenses/>.
21
  along with systemd; If not, see <http://www.gnu.org/licenses/>.
22
***/
22
***/
23
23
24
#include "macro.h"
25
24
int drop_in_file(const char *dir, const char *unit, unsigned level,
26
int drop_in_file(const char *dir, const char *unit, unsigned level,
25
                 const char *name, char **_p, char **_q);
27
                 const char *name, char **_p, char **_q);
26
28
Lines 28-31 int write_drop_in(const char *dir, const char *unit, unsigned level, Link Here
28
                  const char *name, const char *data);
30
                  const char *name, const char *data);
29
31
30
int write_drop_in_format(const char *dir, const char *unit, unsigned level,
32
int write_drop_in_format(const char *dir, const char *unit, unsigned level,
31
                         const char *name, const char *format, ...);
33
                         const char *name, const char *format, ...) _printf_(5, 6);
(-)a/src/shared/env-util.c (-1 / +3 lines)
Lines 78-84 bool env_value_is_valid(const char *e) { Link Here
78
        if (!utf8_is_valid(e))
78
        if (!utf8_is_valid(e))
79
                return false;
79
                return false;
80
80
81
        if (string_has_cc(e))
81
        /* bash allows tabs in environment variables, and so should
82
         * we */
83
        if (string_has_cc(e, "\t"))
82
                return false;
84
                return false;
83
85
84
        /* POSIX says the overall size of the environment block cannot
86
        /* POSIX says the overall size of the environment block cannot
(-)a/src/shared/fileio-label.c (-2 / +18 lines)
Lines 25-36 Link Here
25
25
26
#include "fileio-label.h"
26
#include "fileio-label.h"
27
#include "label.h"
27
#include "label.h"
28
#include "util.h"
28
29
29
int write_string_file_atomic_label(const char *fn, const char *line) {
30
int write_string_file_atomic_label(const char *fn, const char *line) {
30
        int r;
31
        int r;
31
32
32
        r = label_context_set(fn, S_IFREG);
33
        r = label_context_set(fn, S_IFREG);
33
        if (r  < 0)
34
        if (r < 0)
34
                return r;
35
                return r;
35
36
36
        write_string_file_atomic(fn, line);
37
        write_string_file_atomic(fn, line);
Lines 44-50 int write_env_file_label(const char *fname, char **l) { Link Here
44
        int r;
45
        int r;
45
46
46
        r = label_context_set(fname, S_IFREG);
47
        r = label_context_set(fname, S_IFREG);
47
        if (r  < 0)
48
        if (r < 0)
48
                return r;
49
                return r;
49
50
50
        write_env_file(fname, l);
51
        write_env_file(fname, l);
Lines 53-55 int write_env_file_label(const char *fname, char **l) { Link Here
53
54
54
        return r;
55
        return r;
55
}
56
}
57
58
int fopen_temporary_label(const char *target,
59
                          const char *path, FILE **f, char **temp_path) {
60
        int r;
61
62
        r = label_context_set(target, S_IFREG);
63
        if (r < 0)
64
                return r;
65
66
        r = fopen_temporary(path, f, temp_path);
67
68
        label_context_clear();
69
70
        return r;
71
}
(-)a/src/shared/fileio-label.h (+2 lines)
Lines 27-29 Link Here
27
27
28
int write_string_file_atomic_label(const char *fn, const char *line);
28
int write_string_file_atomic_label(const char *fn, const char *line);
29
int write_env_file_label(const char *fname, char **l);
29
int write_env_file_label(const char *fname, char **l);
30
int fopen_temporary_label(const char *target,
31
                          const char *path, FILE **f, char **temp_path);
(-)a/src/shared/fileio.c (-2 / +2 lines)
Lines 738-748 static void write_env_var(FILE *f, const char *v) { Link Here
738
        p++;
738
        p++;
739
        fwrite(v, 1, p-v, f);
739
        fwrite(v, 1, p-v, f);
740
740
741
        if (string_has_cc(p) || chars_intersect(p, WHITESPACE "\'\"\\`$")) {
741
        if (string_has_cc(p, NULL) || chars_intersect(p, WHITESPACE SHELL_NEED_QUOTES)) {
742
                fputc('\"', f);
742
                fputc('\"', f);
743
743
744
                for (; *p; p++) {
744
                for (; *p; p++) {
745
                        if (strchr("\'\"\\`$", *p))
745
                        if (strchr(SHELL_NEED_ESCAPE, *p))
746
                                fputc('\\', f);
746
                                fputc('\\', f);
747
747
748
                        fputc(*p, f);
748
                        fputc(*p, f);
(-)a/src/shared/generator.c (-2 / +2 lines)
Lines 125-131 int generator_write_timeouts(const char *dir, const char *what, const char *wher Link Here
125
                char *prefix, *postfix;
125
                char *prefix, *postfix;
126
126
127
                prefix = strndupa(opts, start - opts - (start != opts));
127
                prefix = strndupa(opts, start - opts - (start != opts));
128
                postfix = timeout + len + (timeout[len] != '\0');
128
                postfix = timeout + len + (start == opts && timeout[len] != '\0');
129
                *filtered = strjoin(prefix, *postfix ? postfix : NULL, NULL);
129
                *filtered = strjoin(prefix, *postfix ? postfix : NULL, NULL);
130
                if (!*filtered)
130
                if (!*filtered)
131
                        return log_oom();
131
                        return log_oom();
Lines 148-154 int generator_write_timeouts(const char *dir, const char *what, const char *wher Link Here
148
148
149
        return write_drop_in_format(dir, unit, 50, "device-timeout",
149
        return write_drop_in_format(dir, unit, 50, "device-timeout",
150
                                    "# Automatically generated by %s\n\n"
150
                                    "# Automatically generated by %s\n\n"
151
                                    "[Unit]\nJobTimeoutSec=%u",
151
                                    "[Unit]\nJobTimeoutSec=" USEC_FMT,
152
                                    program_invocation_short_name,
152
                                    program_invocation_short_name,
153
                                    u / USEC_PER_SEC);
153
                                    u / USEC_PER_SEC);
154
}
154
}
(-)a/src/shared/missing.h (+21 lines)
Lines 371-376 static inline int setns(int fd, int nstype) { Link Here
371
#define LOOP_CTL_GET_FREE 0x4C82
371
#define LOOP_CTL_GET_FREE 0x4C82
372
#endif
372
#endif
373
373
374
#if !HAVE_DECL_IFLA_MACVLAN_FLAGS
375
#define IFLA_MACVLAN_UNSPEC 0
376
#define IFLA_MACVLAN_MODE 1
377
#define IFLA_MACVLAN_FLAGS 2
378
#define __IFLA_MACVLAN_MAX 3
379
380
#define IFLA_MACVLAN_MAX (__IFLA_MACVLAN_MAX - 1)
381
#endif
382
383
#if !HAVE_DECL_IFLA_VTI_REMOTE
384
#define IFLA_VTI_UNSPEC 0
385
#define IFLA_VTI_LINK 1
386
#define IFLA_VTI_IKEY 2
387
#define IFLA_VTI_OKEY 3
388
#define IFLA_VTI_LOCAL 4
389
#define IFLA_VTI_REMOTE 5
390
#define __IFLA_VTI_MAX 6
391
392
#define IFLA_VTI_MAX (__IFLA_VTI_MAX - 1)
393
#endif
394
374
#if !HAVE_DECL_IFLA_PHYS_PORT_ID
395
#if !HAVE_DECL_IFLA_PHYS_PORT_ID
375
#undef IFLA_PROMISCUITY
396
#undef IFLA_PROMISCUITY
376
#define IFLA_PROMISCUITY 30
397
#define IFLA_PROMISCUITY 30
(-)a/src/shared/mkdir.h (+1 lines)
Lines 22-27 Link Here
22
  along with systemd; If not, see <http://www.gnu.org/licenses/>.
22
  along with systemd; If not, see <http://www.gnu.org/licenses/>.
23
***/
23
***/
24
24
25
#include <stdbool.h>
25
#include <sys/types.h>
26
#include <sys/types.h>
26
27
27
int mkdir_safe(const char *path, mode_t mode, uid_t uid, gid_t gid);
28
int mkdir_safe(const char *path, mode_t mode, uid_t uid, gid_t gid);
(-)a/src/shared/path-lookup.c (-18 lines)
Lines 125-150 static char** user_dirs( Link Here
125
                        goto fail;
125
                        goto fail;
126
126
127
        } else if (home) {
127
        } else if (home) {
128
                _cleanup_free_ char *data_home_parent = NULL;
129
130
                if (asprintf(&data_home, "%s/.local/share/systemd/user", home) < 0)
128
                if (asprintf(&data_home, "%s/.local/share/systemd/user", home) < 0)
131
                        goto fail;
129
                        goto fail;
132
133
                /* There is really no need for two unit dirs in $HOME,
134
                 * except to be fully compliant with the XDG spec. We
135
                 * now try to link the two dirs, so that we can
136
                 * minimize disk seeks a little. Further down we'll
137
                 * then filter out this link, if it is actually is
138
                 * one. */
139
140
                if (path_get_parent(data_home, &data_home_parent) >= 0) {
141
                        _cleanup_free_ char *config_home_relative = NULL;
142
143
                        if (path_make_relative(data_home_parent, config_home, &config_home_relative) >= 0) {
144
                                mkdir_parents_label(data_home, 0777);
145
                                (void) symlink(config_home_relative, data_home);
146
                        }
147
                }
148
        }
130
        }
149
131
150
        e = getenv("XDG_DATA_DIRS");
132
        e = getenv("XDG_DATA_DIRS");
(-)a/src/shared/util.c (-8 / +17 lines)
Lines 1608-1615 int read_one_char(FILE *f, char *ret, usec_t t, bool *need_nl) { Link Here
1608
                        return -ETIMEDOUT;
1608
                        return -ETIMEDOUT;
1609
        }
1609
        }
1610
1610
1611
        errno = 0;
1611
        if (!fgets(line, sizeof(line), f))
1612
        if (!fgets(line, sizeof(line), f))
1612
                return -EIO;
1613
                return errno ? -errno : -EIO;
1613
1614
1614
        truncate_nl(line);
1615
        truncate_nl(line);
1615
1616
Lines 5349-5361 bool filename_is_safe(const char *p) { Link Here
5349
bool string_is_safe(const char *p) {
5350
bool string_is_safe(const char *p) {
5350
        const char *t;
5351
        const char *t;
5351
5352
5352
        assert(p);
5353
        if (!p)
5354
                return false;
5353
5355
5354
        for (t = p; *t; t++) {
5356
        for (t = p; *t; t++) {
5355
                if (*t > 0 && *t < ' ')
5357
                if (*t > 0 && *t < ' ')
5356
                        return false;
5358
                        return false;
5357
5359
5358
                if (strchr("\\\"\'", *t))
5360
                if (strchr("\\\"\'\0x7f", *t))
5359
                        return false;
5361
                        return false;
5360
        }
5362
        }
5361
5363
Lines 5363-5380 bool string_is_safe(const char *p) { Link Here
5363
}
5365
}
5364
5366
5365
/**
5367
/**
5366
 * Check if a string contains control characters.
5368
 * Check if a string contains control characters. If 'ok' is non-NULL
5367
 * Spaces and tabs are not considered control characters.
5369
 * it may be a string containing additional CCs to be considered OK.
5368
 */
5370
 */
5369
bool string_has_cc(const char *p) {
5371
bool string_has_cc(const char *p, const char *ok) {
5370
        const char *t;
5372
        const char *t;
5371
5373
5372
        assert(p);
5374
        assert(p);
5373
5375
5374
        for (t = p; *t; t++)
5376
        for (t = p; *t; t++) {
5375
                if (*t > 0 && *t < ' ' && *t != '\t')
5377
                if (ok && strchr(ok, *t))
5378
                        continue;
5379
5380
                if (*t > 0 && *t < ' ')
5376
                        return true;
5381
                        return true;
5377
5382
5383
                if (*t == 127)
5384
                        return true;
5385
        }
5386
5378
        return false;
5387
        return false;
5379
}
5388
}
5380
5389
(-)a/src/shared/util.h (-1 / +7 lines)
Lines 93-98 Link Here
93
#define COMMENTS   "#;"
93
#define COMMENTS   "#;"
94
#define GLOB_CHARS "*?["
94
#define GLOB_CHARS "*?["
95
95
96
/* What characters are special in the shell? */
97
/* must be escaped outside and inside double-quotes */
98
#define SHELL_NEED_ESCAPE "\"\\`$"
99
/* can be escaped or double-quoted */
100
#define SHELL_NEED_QUOTES SHELL_NEED_ESCAPE GLOB_CHARS "'()<>|&;"
101
96
#define FORMAT_BYTES_MAX 8
102
#define FORMAT_BYTES_MAX 8
97
103
98
#define ANSI_HIGHLIGHT_ON "\x1B[1;39m"
104
#define ANSI_HIGHLIGHT_ON "\x1B[1;39m"
Lines 692-698 _alloc_(2, 3) static inline void *memdup_multiply(const void *p, size_t a, size_ Link Here
692
bool filename_is_safe(const char *p) _pure_;
698
bool filename_is_safe(const char *p) _pure_;
693
bool path_is_safe(const char *p) _pure_;
699
bool path_is_safe(const char *p) _pure_;
694
bool string_is_safe(const char *p) _pure_;
700
bool string_is_safe(const char *p) _pure_;
695
bool string_has_cc(const char *p) _pure_;
701
bool string_has_cc(const char *p, const char *ok) _pure_;
696
702
697
/**
703
/**
698
 * Check if a string contains any glob patterns.
704
 * Check if a string contains any glob patterns.
(-)a/src/shared/virt.c (-1 / +18 lines)
Lines 173-179 int detect_vm(const char **id) { Link Here
173
                        if (streq(cap, "control_d"))
173
                        if (streq(cap, "control_d"))
174
                                break;
174
                                break;
175
175
176
                if (!i)  {
176
                if (!cap)  {
177
                        _id = "xen";
177
                        _id = "xen";
178
                        r = 1;
178
                        r = 1;
179
                }
179
                }
Lines 220-225 int detect_vm(const char **id) { Link Here
220
                goto finish;
220
                goto finish;
221
        }
221
        }
222
222
223
#if defined(__s390__)
224
        {
225
                _cleanup_free_ char *t = NULL;
226
227
                r = get_status_field("/proc/sysinfo", "VM00 Control Program:", &t);
228
                if (r >= 0) {
229
                        if (streq(t, "z/VM"))
230
                                _id = "zvm";
231
                        else
232
                                _id = "kvm";
233
                        r = 1;
234
235
                        goto finish;
236
                }
237
        }
238
#endif
239
223
        r = 0;
240
        r = 0;
224
241
225
finish:
242
finish:
(-)a/src/systemctl/systemctl.c (-1 / +1 lines)
Lines 456-462 static int output_units_list(const UnitInfo *unit_infos, unsigned c) { Link Here
456
                }
456
                }
457
457
458
                if (circle_len > 0)
458
                if (circle_len > 0)
459
                        printf("%s%s%s", on_circle, circle ? draw_special_char(DRAW_BLACK_CIRCLE) : "  ", off_circle);
459
                        printf("%s%s%s ", on_circle, circle ? draw_special_char(DRAW_BLACK_CIRCLE) : " ", off_circle);
460
460
461
                printf("%s%-*s%s %s%-*s%s %s%-*s %-*s%s %-*s",
461
                printf("%s%-*s%s %s%-*s%s %s%-*s %-*s%s %-*s",
462
                       on_active, id_len, id, off_active,
462
                       on_active, id_len, id, off_active,
(-)a/src/sysusers/sysusers.c (-22 / +41 lines)
Lines 24-29 Link Here
24
#include <grp.h>
24
#include <grp.h>
25
#include <shadow.h>
25
#include <shadow.h>
26
#include <getopt.h>
26
#include <getopt.h>
27
#include <utmp.h>
27
28
28
#include "util.h"
29
#include "util.h"
29
#include "hashmap.h"
30
#include "hashmap.h"
Lines 34-39 Link Here
34
#include "conf-files.h"
35
#include "conf-files.h"
35
#include "copy.h"
36
#include "copy.h"
36
#include "utf8.h"
37
#include "utf8.h"
38
#include "label.h"
39
#include "fileio-label.h"
37
40
38
typedef enum ItemType {
41
typedef enum ItemType {
39
        ADD_USER = 'u',
42
        ADD_USER = 'u',
Lines 61-66 typedef struct Item { Link Here
61
static char *arg_root = NULL;
64
static char *arg_root = NULL;
62
65
63
static const char conf_file_dirs[] =
66
static const char conf_file_dirs[] =
67
        "/etc/sysusers.d\0"
68
        "/run/sysusers.d\0"
64
        "/usr/local/lib/sysusers.d\0"
69
        "/usr/local/lib/sysusers.d\0"
65
        "/usr/lib/sysusers.d\0"
70
        "/usr/lib/sysusers.d\0"
66
#ifdef HAVE_SPLIT_USR
71
#ifdef HAVE_SPLIT_USR
Lines 190-197 static int load_group_database(void) { Link Here
190
        return 0;
195
        return 0;
191
}
196
}
192
197
193
static int make_backup(const char *x) {
198
static int make_backup(const char *target, const char *x) {
194
        _cleanup_close_ int src = -1, dst = -1;
199
        _cleanup_close_ int src = -1;
200
        _cleanup_fclose_ FILE *dst = NULL;
195
        char *backup, *temp;
201
        char *backup, *temp;
196
        struct timespec ts[2];
202
        struct timespec ts[2];
197
        struct stat st;
203
        struct stat st;
Lines 208-237 static int make_backup(const char *x) { Link Here
208
        if (fstat(src, &st) < 0)
214
        if (fstat(src, &st) < 0)
209
                return -errno;
215
                return -errno;
210
216
211
        temp = strappenda(x, ".XXXXXX");
217
        r = fopen_temporary_label(target, x, &dst, &temp);
212
        dst = mkostemp_safe(temp, O_WRONLY|O_CLOEXEC|O_NOCTTY);
218
        if (r < 0)
213
        if (dst < 0)
219
                return r;
214
                return dst;
215
220
216
        r = copy_bytes(src, dst, (off_t) -1);
221
        r = copy_bytes(src, fileno(dst), (off_t) -1);
217
        if (r < 0)
222
        if (r < 0)
218
                goto fail;
223
                goto fail;
219
224
225
        /* Don't fail on chmod() or chown(). If it stays owned by us
226
         * and/or unreadable by others, then it isn't too bad... */
227
228
        backup = strappenda(x, "-");
229
220
        /* Copy over the access mask */
230
        /* Copy over the access mask */
221
        if (fchmod(dst, st.st_mode & 07777) < 0) {
231
        if (fchmod(fileno(dst), st.st_mode & 07777) < 0)
222
                r = -errno;
232
                log_warning("Failed to change mode on %s: %m", backup);
223
                goto fail;
224
        }
225
233
226
        /* Don't fail on chmod(). If it stays owned by us, then it
234
        if (fchown(fileno(dst), st.st_uid, st.st_gid)< 0)
227
         * isn't too bad... */
235
                log_warning("Failed to change ownership of %s: %m", backup);
228
        fchown(dst, st.st_uid, st.st_gid);
229
236
230
        ts[0] = st.st_atim;
237
        ts[0] = st.st_atim;
231
        ts[1] = st.st_mtim;
238
        ts[1] = st.st_mtim;
232
        futimens(dst, ts);
239
        futimens(fileno(dst), ts);
233
240
234
        backup = strappenda(x, "-");
235
        if (rename(temp, backup) < 0)
241
        if (rename(temp, backup) < 0)
236
                goto fail;
242
                goto fail;
237
243
Lines 309-315 static int write_files(void) { Link Here
309
                _cleanup_fclose_ FILE *original = NULL;
315
                _cleanup_fclose_ FILE *original = NULL;
310
316
311
                group_path = fix_root("/etc/group");
317
                group_path = fix_root("/etc/group");
312
                r = fopen_temporary(group_path, &group, &group_tmp);
318
                r = fopen_temporary_label("/etc/group", group_path, &group, &group_tmp);
313
                if (r < 0)
319
                if (r < 0)
314
                        goto finish;
320
                        goto finish;
315
321
Lines 385-391 static int write_files(void) { Link Here
385
                _cleanup_fclose_ FILE *original = NULL;
391
                _cleanup_fclose_ FILE *original = NULL;
386
392
387
                passwd_path = fix_root("/etc/passwd");
393
                passwd_path = fix_root("/etc/passwd");
388
                r = fopen_temporary(passwd_path, &passwd, &passwd_tmp);
394
                r = fopen_temporary_label("/etc/passwd", passwd_path, &passwd, &passwd_tmp);
389
                if (r < 0)
395
                if (r < 0)
390
                        goto finish;
396
                        goto finish;
391
397
Lines 464-476 static int write_files(void) { Link Here
464
470
465
        /* Make a backup of the old files */
471
        /* Make a backup of the old files */
466
        if (group && group_changed) {
472
        if (group && group_changed) {
467
                r = make_backup(group_path);
473
                r = make_backup("/etc/group", group_path);
468
                if (r < 0)
474
                if (r < 0)
469
                        goto finish;
475
                        goto finish;
470
        }
476
        }
471
477
472
        if (passwd) {
478
        if (passwd) {
473
                r = make_backup(passwd_path);
479
                r = make_backup("/etc/passwd", passwd_path);
474
                if (r < 0)
480
                if (r < 0)
475
                        goto finish;
481
                        goto finish;
476
        }
482
        }
Lines 1095-1100 static bool valid_user_group_name(const char *u) { Link Here
1095
        if ((size_t) (i-u) > (size_t) sz)
1101
        if ((size_t) (i-u) > (size_t) sz)
1096
                return false;
1102
                return false;
1097
1103
1104
        if ((size_t) (i-u) > UT_NAMESIZE - 1)
1105
                return false;
1106
1098
        return true;
1107
        return true;
1099
}
1108
}
1100
1109
Lines 1103-1109 static bool valid_gecos(const char *d) { Link Here
1103
        if (!utf8_is_valid(d))
1112
        if (!utf8_is_valid(d))
1104
                return false;
1113
                return false;
1105
1114
1106
        if (strpbrk(d, ":\n"))
1115
        if (string_has_cc(d, NULL))
1116
                return false;
1117
1118
        /* Colons are used as field separators, and hence not OK */
1119
        if (strchr(d, ':'))
1107
                return false;
1120
                return false;
1108
1121
1109
        return true;
1122
        return true;
Lines 1312-1317 static int parse_line(const char *fname, unsigned line, const char *buffer) { Link Here
1312
1325
1313
                h = groups;
1326
                h = groups;
1314
                break;
1327
                break;
1328
        default:
1329
                return -EBADMSG;
1315
        }
1330
        }
1316
1331
1317
        i->type = action[0];
1332
        i->type = action[0];
Lines 1515-1521 int main(int argc, char *argv[]) { Link Here
1515
1530
1516
        umask(0022);
1531
        umask(0022);
1517
1532
1518
        r = 0;
1533
        r = label_init(NULL);
1534
        if (r < 0) {
1535
                log_error("SELinux setup failed: %s", strerror(-r));
1536
                goto finish;
1537
        }
1519
1538
1520
        if (optind < argc) {
1539
        if (optind < argc) {
1521
                int j;
1540
                int j;
(-)a/src/test/test-util.c (+15 lines)
Lines 731-736 static void test_filename_is_safe(void) { Link Here
731
        assert_se(filename_is_safe("o.o"));
731
        assert_se(filename_is_safe("o.o"));
732
}
732
}
733
733
734
static void test_string_has_cc(void) {
735
        assert_se(string_has_cc("abc\1", NULL));
736
        assert_se(string_has_cc("abc\x7f", NULL));
737
        assert_se(string_has_cc("abc\x7f", NULL));
738
        assert_se(string_has_cc("abc\t\x7f", "\t"));
739
        assert_se(string_has_cc("abc\t\x7f", "\t"));
740
        assert_se(string_has_cc("\x7f", "\t"));
741
        assert_se(string_has_cc("\x7f", "\t\a"));
742
743
        assert_se(!string_has_cc("abc\t\t", "\t"));
744
        assert_se(!string_has_cc("abc\t\t\a", "\t\a"));
745
        assert_se(!string_has_cc("a\ab\tc", "\t\a"));
746
}
747
734
static void test_ascii_strlower(void) {
748
static void test_ascii_strlower(void) {
735
        char a[] = "AabBcC Jk Ii Od LKJJJ kkd LK";
749
        char a[] = "AabBcC Jk Ii Od LKJJJ kkd LK";
736
        assert_se(streq(ascii_strlower(a), "aabbcc jk ii od lkjjj kkd lk"));
750
        assert_se(streq(ascii_strlower(a), "aabbcc jk ii od lkjjj kkd lk"));
Lines 937-942 int main(int argc, char *argv[]) { Link Here
937
        test_log2i();
951
        test_log2i();
938
        test_foreach_string();
952
        test_foreach_string();
939
        test_filename_is_safe();
953
        test_filename_is_safe();
954
        test_string_has_cc();
940
        test_ascii_strlower();
955
        test_ascii_strlower();
941
        test_files_same();
956
        test_files_same();
942
        test_is_valid_documentation_url();
957
        test_is_valid_documentation_url();
(-)a/src/timesync/timesyncd.c (-4 lines)
Lines 1044-1053 static int manager_new(Manager **ret) { Link Here
1044
        if (r < 0)
1044
        if (r < 0)
1045
                return r;
1045
                return r;
1046
1046
1047
        r = manager_clock_watch_setup(m);
1048
        if (r < 0)
1049
                return r;
1050
1051
        *ret = m;
1047
        *ret = m;
1052
        m = NULL;
1048
        m = NULL;
1053
1049
(-)a/src/udev/accelerometer/accelerometer.c (-27 / +6 lines)
Lines 180-186 get_prev_orientation(struct udev_device *dev) Link Here
180
        return string_to_orientation(value);
180
        return string_to_orientation(value);
181
}
181
}
182
182
183
#define SET_AXIS(axis, code_) if (ev[i].code == code_) { if (got_##axis == 0) { axis = ev[i].value; got_##axis = true; } }
183
#define READ_AXIS(axis, var) { memzero(&abs_info, sizeof(abs_info)); r = ioctl(fd, EVIOCGABS(axis), &abs_info); if (r < 0) return; var = abs_info.value; }
184
184
185
/* accelerometers */
185
/* accelerometers */
186
static void test_orientation(struct udev *udev,
186
static void test_orientation(struct udev *udev,
Lines 189-198 static void test_orientation(struct udev *udev, Link Here
189
{
189
{
190
        OrientationUp old, new;
190
        OrientationUp old, new;
191
        _cleanup_close_ int fd = -1;
191
        _cleanup_close_ int fd = -1;
192
        struct input_event ev[64];
192
        struct input_absinfo abs_info;
193
        bool got_syn = false;
194
        bool got_x = false, got_y = false, got_z = false;
195
        int x = 0, y = 0, z = 0;
193
        int x = 0, y = 0, z = 0;
194
        int r;
196
        char text[64];
195
        char text[64];
197
196
198
        old = get_prev_orientation(dev);
197
        old = get_prev_orientation(dev);
Lines 201-230 static void test_orientation(struct udev *udev, Link Here
201
        if (fd < 0)
200
        if (fd < 0)
202
                return;
201
                return;
203
202
204
        while (1) {
203
        READ_AXIS(ABS_X, x);
205
                int i, r;
204
        READ_AXIS(ABS_Y, y);
206
205
        READ_AXIS(ABS_Z, z);
207
                r = read(fd, ev, sizeof(struct input_event) * 64);
208
209
                if (r < (int) sizeof(struct input_event))
210
                        return;
211
212
                for (i = 0; i < r / (int) sizeof(struct input_event); i++) {
213
                        if (got_syn) {
214
                                if (ev[i].type == EV_ABS) {
215
                                        SET_AXIS(x, ABS_X);
216
                                        SET_AXIS(y, ABS_Y);
217
                                        SET_AXIS(z, ABS_Z);
218
                                }
219
                        }
220
                        if (ev[i].type == EV_SYN && ev[i].code == SYN_REPORT)
221
                                got_syn = true;
222
                        if (got_x && got_y && got_z)
223
                                goto read_dev;
224
                }
225
        }
226
206
227
read_dev:
228
        new = orientation_calc(old, x, y, z);
207
        new = orientation_calc(old, x, y, z);
229
        snprintf(text, sizeof(text),
208
        snprintf(text, sizeof(text),
230
                 "ID_INPUT_ACCELEROMETER_ORIENTATION=%s", orientation_to_string(new));
209
                 "ID_INPUT_ACCELEROMETER_ORIENTATION=%s", orientation_to_string(new));
(-)a/src/udev/net/link-config.c (-2 / +6 lines)
Lines 383-389 int link_config_apply(link_config_ctx *ctx, link_config *config, struct udev_dev Link Here
383
                case MACPOLICY_PERSISTENT:
383
                case MACPOLICY_PERSISTENT:
384
                        if (mac_is_random(device)) {
384
                        if (mac_is_random(device)) {
385
                                r = get_mac(device, false, &generated_mac);
385
                                r = get_mac(device, false, &generated_mac);
386
                                if (r < 0)
386
                                if (r == -ENOENT)
387
                                        break;
388
                                else if (r < 0)
387
                                        return r;
389
                                        return r;
388
                                mac = &generated_mac;
390
                                mac = &generated_mac;
389
                        }
391
                        }
Lines 391-397 int link_config_apply(link_config_ctx *ctx, link_config *config, struct udev_dev Link Here
391
                case MACPOLICY_RANDOM:
393
                case MACPOLICY_RANDOM:
392
                        if (!mac_is_random(device)) {
394
                        if (!mac_is_random(device)) {
393
                                r = get_mac(device, true, &generated_mac);
395
                                r = get_mac(device, true, &generated_mac);
394
                                if (r < 0)
396
                                if (r == -ENOENT)
397
                                        break;
398
                                else if (r < 0)
395
                                        return r;
399
                                        return r;
396
                                mac = &generated_mac;
400
                                mac = &generated_mac;
397
                        }
401
                        }
(-)a/src/update-done/update-done.c (-5 / +20 lines)
Lines 20-25 Link Here
20
***/
20
***/
21
21
22
#include "util.h"
22
#include "util.h"
23
#include "label.h"
23
24
24
static int apply_timestamp(const char *path, struct timespec *ts) {
25
static int apply_timestamp(const char *path, struct timespec *ts) {
25
        struct timespec twice[2];
26
        struct timespec twice[2];
Lines 51-60 static int apply_timestamp(const char *path, struct timespec *ts) { Link Here
51
52
52
        } else if (errno == ENOENT) {
53
        } else if (errno == ENOENT) {
53
                _cleanup_close_ int fd = -1;
54
                _cleanup_close_ int fd = -1;
55
                int r;
54
56
55
                /* The timestamp file doesn't exist yet? Then let's create it. */
57
                /* The timestamp file doesn't exist yet? Then let's create it. */
56
58
59
                r = label_context_set(path, S_IFREG);
60
                if (r < 0) {
61
                        log_error("Failed to set SELinux context for %s: %s",
62
                                  path, strerror(-r));
63
                        return r;
64
                }
65
57
                fd = open(path, O_CREAT|O_EXCL|O_WRONLY|O_TRUNC|O_CLOEXEC|O_NOCTTY|O_NOFOLLOW, 0644);
66
                fd = open(path, O_CREAT|O_EXCL|O_WRONLY|O_TRUNC|O_CLOEXEC|O_NOCTTY|O_NOFOLLOW, 0644);
67
                label_context_clear();
68
58
                if (fd < 0) {
69
                if (fd < 0) {
59
70
60
                        if (errno == EROFS) {
71
                        if (errno == EROFS) {
Lines 83-89 static int apply_timestamp(const char *path, struct timespec *ts) { Link Here
83
94
84
int main(int argc, char *argv[]) {
95
int main(int argc, char *argv[]) {
85
        struct stat st;
96
        struct stat st;
86
        int r, q;
97
        int r, q = 0;
87
98
88
        log_set_target(LOG_TARGET_AUTO);
99
        log_set_target(LOG_TARGET_AUTO);
89
        log_parse_environment();
100
        log_parse_environment();
Lines 94-104 int main(int argc, char *argv[]) { Link Here
94
                return EXIT_FAILURE;
105
                return EXIT_FAILURE;
95
        }
106
        }
96
107
97
        r = apply_timestamp("/etc/.updated", &st.st_mtim);
108
        r = label_init(NULL);
109
        if (r < 0) {
110
                log_error("SELinux setup failed: %s", strerror(-r));
111
                goto finish;
112
        }
98
113
114
        r = apply_timestamp("/etc/.updated", &st.st_mtim);
99
        q = apply_timestamp("/var/.updated", &st.st_mtim);
115
        q = apply_timestamp("/var/.updated", &st.st_mtim);
100
        if (q < 0 && r == 0)
101
                r = q;
102
116
103
        return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
117
finish:
118
        return r < 0 || q < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
104
}
119
}
(-)a/src/vconsole/vconsole-setup.c (-25 / +23 lines)
Lines 238-249 static void font_copy_to_all_vcs(int fd) { Link Here
238
238
239
int main(int argc, char **argv) {
239
int main(int argc, char **argv) {
240
        const char *vc;
240
        const char *vc;
241
        char *vc_keymap = NULL;
241
        _cleanup_free_ char
242
        char *vc_keymap_toggle = NULL;
242
                *vc_keymap = NULL, *vc_keymap_toggle = NULL,
243
        char *vc_font = NULL;
243
                *vc_font = NULL, *vc_font_map = NULL, *vc_font_unimap = NULL;
244
        char *vc_font_map = NULL;
244
        _cleanup_close_ int fd = -1;
245
        char *vc_font_unimap = NULL;
246
        int fd = -1;
247
        bool utf8;
245
        bool utf8;
248
        pid_t font_pid = 0, keymap_pid = 0;
246
        pid_t font_pid = 0, keymap_pid = 0;
249
        bool font_copy = false;
247
        bool font_copy = false;
Lines 265-276 int main(int argc, char **argv) { Link Here
265
        fd = open_terminal(vc, O_RDWR|O_CLOEXEC);
263
        fd = open_terminal(vc, O_RDWR|O_CLOEXEC);
266
        if (fd < 0) {
264
        if (fd < 0) {
267
                log_error("Failed to open %s: %m", vc);
265
                log_error("Failed to open %s: %m", vc);
268
                goto finish;
266
                return EXIT_FAILURE;
269
        }
267
        }
270
268
271
        if (!is_vconsole(fd)) {
269
        if (!is_vconsole(fd)) {
272
                log_error("Device %s is not a virtual console.", vc);
270
                log_error("Device %s is not a virtual console.", vc);
273
                goto finish;
271
                return EXIT_FAILURE;
274
        }
272
        }
275
273
276
        utf8 = is_locale_utf8();
274
        utf8 = is_locale_utf8();
Lines 305-331 int main(int argc, char **argv) { Link Here
305
        else
303
        else
306
                disable_utf8(fd);
304
                disable_utf8(fd);
307
305
308
        r = EXIT_FAILURE;
306
        r = font_load(vc, vc_font, vc_font_map, vc_font_unimap, &font_pid);
309
        if (keymap_load(vc, vc_keymap, vc_keymap_toggle, utf8, &keymap_pid) >= 0 &&
307
        if (r < 0) {
310
            font_load(vc, vc_font, vc_font_map, vc_font_unimap, &font_pid) >= 0)
308
                log_error("Failed to start " KBD_SETFONT ": %s", strerror(-r));
311
                r = EXIT_SUCCESS;
309
                return EXIT_FAILURE;
312
310
        }
313
finish:
314
        if (keymap_pid > 0)
315
                wait_for_terminate_and_warn(KBD_LOADKEYS, keymap_pid);
316
311
317
        if (font_pid > 0) {
312
        if (font_pid > 0)
318
                wait_for_terminate_and_warn(KBD_SETFONT, font_pid);
313
                wait_for_terminate_and_warn(KBD_SETFONT, font_pid);
319
                if (font_copy)
314
320
                        font_copy_to_all_vcs(fd);
315
        r = keymap_load(vc, vc_keymap, vc_keymap_toggle, utf8, &keymap_pid);
316
        if (r < 0) {
317
                log_error("Failed to start " KBD_LOADKEYS ": %s", strerror(-r));
318
                return EXIT_FAILURE;
321
        }
319
        }
322
320
323
        free(vc_keymap);
321
        if (keymap_pid > 0)
324
        free(vc_font);
322
                wait_for_terminate_and_warn(KBD_LOADKEYS, keymap_pid);
325
        free(vc_font_map);
326
        free(vc_font_unimap);
327
323
328
        safe_close(fd);
324
        /* Only copy the font when we started setfont successfully */
325
        if (font_copy && font_pid > 0)
326
                font_copy_to_all_vcs(fd);
329
327
330
        return r;
328
        return EXIT_SUCCESS;
331
}
329
}
(-)a/sysctl.d/50-coredump.conf.in (-1 / +3 lines)
Lines 5-10 Link Here
5
#  the Free Software Foundation; either version 2.1 of the License, or
5
#  the Free Software Foundation; either version 2.1 of the License, or
6
#  (at your option) any later version.
6
#  (at your option) any later version.
7
7
8
# See sysctl.d(5) and core(5) for for details.
8
# See sysctl.d(5) for the description of the files in this directory,
9
# and systemd-coredump(8) and core(5) for the explanation of the
10
# setting below.
9
11
10
kernel.core_pattern=|@rootlibexecdir@/systemd-coredump %p %u %g %s %t %e
12
kernel.core_pattern=|@rootlibexecdir@/systemd-coredump %p %u %g %s %t %e
(-)a/units/emergency.service.in (-2 / +1 lines)
Lines 17-24 Environment=HOME=/root Link Here
17
WorkingDirectory=/root
17
WorkingDirectory=/root
18
ExecStartPre=-/bin/plymouth quit
18
ExecStartPre=-/bin/plymouth quit
19
ExecStartPre=-/bin/echo -e 'Welcome to emergency mode! After logging in, type "journalctl -xb" to view\\nsystem logs, "systemctl reboot" to reboot, "systemctl default" to try again\\nto boot into default mode.'
19
ExecStartPre=-/bin/echo -e 'Welcome to emergency mode! After logging in, type "journalctl -xb" to view\\nsystem logs, "systemctl reboot" to reboot, "systemctl default" to try again\\nto boot into default mode.'
20
ExecStart=-/sbin/sulogin
20
ExecStart=-/bin/sh -c "/sbin/sulogin; @SYSTEMCTL@ --fail --no-block default"
21
ExecStopPost=@SYSTEMCTL@ --fail --no-block default
22
Type=idle
21
Type=idle
23
StandardInput=tty-force
22
StandardInput=tty-force
24
StandardOutput=inherit
23
StandardOutput=inherit
(-)a/units/kmod-static-nodes.service.in (-1 / +1 lines)
Lines 9-15 Link Here
9
Description=Create list of required static device nodes for the current kernel
9
Description=Create list of required static device nodes for the current kernel
10
DefaultDependencies=no
10
DefaultDependencies=no
11
Before=sysinit.target systemd-tmpfiles-setup-dev.service
11
Before=sysinit.target systemd-tmpfiles-setup-dev.service
12
ConditionCapability=CAP_MKNOD
12
ConditionCapability=CAP_SYS_MODULE
13
ConditionPathExists=/lib/modules/%v/modules.devname
13
ConditionPathExists=/lib/modules/%v/modules.devname
14
14
15
[Service]
15
[Service]
(-)a/units/rescue.service.m4.in (-2 / +1 lines)
Lines 18-25 Environment=HOME=/root Link Here
18
WorkingDirectory=/root
18
WorkingDirectory=/root
19
ExecStartPre=-/bin/plymouth quit
19
ExecStartPre=-/bin/plymouth quit
20
ExecStartPre=-/bin/echo -e 'Welcome to rescue mode! Type "systemctl default" or ^D to enter default mode.\\nType "journalctl -xb" to view system logs. Type "systemctl reboot" to reboot.'
20
ExecStartPre=-/bin/echo -e 'Welcome to rescue mode! Type "systemctl default" or ^D to enter default mode.\\nType "journalctl -xb" to view system logs. Type "systemctl reboot" to reboot.'
21
ExecStart=-/sbin/sulogin
21
ExecStart=-/bin/sh -c "/sbin/sulogin; @SYSTEMCTL@ --fail --no-block default"
22
ExecStopPost=-@SYSTEMCTL@ --fail --no-block default
23
Type=idle
22
Type=idle
24
StandardInput=tty-force
23
StandardInput=tty-force
25
StandardOutput=inherit
24
StandardOutput=inherit
(-)a/units/serial-getty@.service.m4 (-1 lines)
Lines 25-31 IgnoreOnIsolate=yes Link Here
25
ExecStart=-/sbin/agetty --keep-baud 115200,38400,9600 %I $TERM
25
ExecStart=-/sbin/agetty --keep-baud 115200,38400,9600 %I $TERM
26
Type=idle
26
Type=idle
27
Restart=always
27
Restart=always
28
RestartSec=0
29
UtmpIdentifier=%I
28
UtmpIdentifier=%I
30
TTYPath=/dev/%I
29
TTYPath=/dev/%I
31
TTYReset=yes
30
TTYReset=yes
(-)a/units/sys-kernel-config.mount (+1 lines)
Lines 11-16 Documentation=https://www.kernel.org/doc/Documentation/filesystems/configfs/conf Link Here
11
Documentation=http://www.freedesktop.org/wiki/Software/systemd/APIFileSystems
11
Documentation=http://www.freedesktop.org/wiki/Software/systemd/APIFileSystems
12
DefaultDependencies=no
12
DefaultDependencies=no
13
ConditionPathExists=/sys/kernel/config
13
ConditionPathExists=/sys/kernel/config
14
ConditionCapability=CAP_SYS_RAWIO
14
After=systemd-modules-load.service
15
After=systemd-modules-load.service
15
Before=sysinit.target
16
Before=sysinit.target
16
17
(-)a/units/sys-kernel-debug.mount (+1 lines)
Lines 11-16 Documentation=https://www.kernel.org/doc/Documentation/filesystems/debugfs.txt Link Here
11
Documentation=http://www.freedesktop.org/wiki/Software/systemd/APIFileSystems
11
Documentation=http://www.freedesktop.org/wiki/Software/systemd/APIFileSystems
12
DefaultDependencies=no
12
DefaultDependencies=no
13
ConditionPathExists=/sys/kernel/debug
13
ConditionPathExists=/sys/kernel/debug
14
ConditionCapability=CAP_SYS_RAWIO
14
Before=sysinit.target
15
Before=sysinit.target
15
16
16
[Mount]
17
[Mount]
(-)a/units/systemd-tmpfiles-setup-dev.service.in (-1 / +1 lines)
Lines 12-18 DefaultDependencies=no Link Here
12
Conflicts=shutdown.target
12
Conflicts=shutdown.target
13
After=systemd-readahead-collect.service systemd-readahead-replay.service systemd-sysusers.service
13
After=systemd-readahead-collect.service systemd-readahead-replay.service systemd-sysusers.service
14
Before=sysinit.target local-fs-pre.target systemd-udevd.service shutdown.target
14
Before=sysinit.target local-fs-pre.target systemd-udevd.service shutdown.target
15
ConditionCapability=CAP_MKNOD
15
ConditionCapability=CAP_SYS_MODULE
16
16
17
[Service]
17
[Service]
18
Type=oneshot
18
Type=oneshot

Return to bug 519418