Also drop SysV rc.local script support (#40295)
Continuation of #39770.
This commit is contained in:
@@ -121,9 +121,6 @@ policy:
|
||||
- name: sysusers
|
||||
keys: ['systemd-sysusers']
|
||||
|
||||
- name: sysv
|
||||
keys: ['systemd-sysv-generator']
|
||||
|
||||
- name: tests
|
||||
keys: ['tests']
|
||||
|
||||
|
||||
@@ -172,9 +172,6 @@ pstore:
|
||||
random-seed:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: '**/*random-seed*'
|
||||
rc-local-generator:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: 'src/rc-local-generator/*'
|
||||
remount-fs:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: '**/*remount-fs*'
|
||||
@@ -268,12 +265,6 @@ sysupdate:
|
||||
sysusers:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: '**/*sysusers*'
|
||||
sysv-generator:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: '**/*sysv-generator*'
|
||||
sysvcompat:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: '**/*sysv*'
|
||||
tests:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: [
|
||||
|
||||
@@ -4,6 +4,20 @@ CHANGES WITH 260 in spe:
|
||||
|
||||
Feature Removals and Incompatible Changes:
|
||||
|
||||
* Support for System V service scripts has been removed. Please make
|
||||
sure to update your software *now* to include a native systemd unit
|
||||
file instead of a legacy System V script.
|
||||
|
||||
The following components have been removed:
|
||||
|
||||
* systemd-rc-local-generator and rc-local.service,
|
||||
* systemd-sysv-generator,
|
||||
* systemd-sysv-install (hook for systemctl enable/disable/is-enabled).
|
||||
|
||||
The corresponding meson options '-Drc-local=', '-Dsysvinit-path=',
|
||||
and '-Dsysvrcnd-path=' are deprecated, and will be dropped in a future
|
||||
release.
|
||||
|
||||
* Meson options '-Dintegration-tests=' and '-Dcryptolib=' (deprecated
|
||||
in v258) have been removed.
|
||||
|
||||
|
||||
@@ -434,17 +434,6 @@ GLIBC NSS:
|
||||
gshadow: files systemd
|
||||
hosts: mymachines resolve [!UNAVAIL=return] files myhostname dns
|
||||
|
||||
SYSV INIT.D SCRIPTS:
|
||||
When calling "systemctl enable/disable/is-enabled" on a unit which is a
|
||||
SysV init.d script, it calls /usr/lib/systemd/systemd-sysv-install;
|
||||
this needs to translate the action into the distribution specific
|
||||
mechanism such as chkconfig or update-rc.d. Packagers need to provide
|
||||
this script if you need this functionality (you don't if you disabled
|
||||
SysV init support).
|
||||
|
||||
Please see src/systemctl/systemd-sysv-install.SKELETON for how this
|
||||
needs to look like, and provide an implementation at the marked places.
|
||||
|
||||
WARNINGS and TAINT FLAGS:
|
||||
systemd requires that the /run mount point exists. systemd also
|
||||
requires that /var/run is a symlink to /run. Taint flag 'var-run-bad'
|
||||
|
||||
@@ -2261,7 +2261,7 @@ Features:
|
||||
being properly synchronous we just keep open the fd and close it
|
||||
when done. That means clients do not get a successful method reply,
|
||||
but much rather a disconnect on success.
|
||||
- when breaking cycles drop sysv services first, then services from /run, then from /etc, then from /usr
|
||||
- when breaking cycles drop services from /run first, then from /etc, then from /usr
|
||||
- when a bus name of a service disappears from the bus make sure to queue further activation requests
|
||||
- maybe introduce CoreScheduling=yes/no to optionally set a PR_SCHED_CORE cookie, so that all
|
||||
processes in a service's cgroup share the same cookie and are guaranteed not to share SMT cores
|
||||
@@ -2688,7 +2688,6 @@ Features:
|
||||
* document:
|
||||
- document that deps in [Unit] sections ignore Alias= fields in
|
||||
[Install] units of other units, unless those units are disabled
|
||||
- man: clarify that time-sync.target is not only sysv compat but also useful otherwise. Same for similar targets
|
||||
- document that service reload may be implemented as service reexec
|
||||
- add a man page containing packaging guidelines and recommending usage of things like Documentation=, PrivateTmp=, PrivateNetwork= and ReadOnlyDirectories=/etc /usr.
|
||||
- document systemd-journal-flush.service properly
|
||||
|
||||
@@ -13,7 +13,6 @@ You need to make the follow changes to adapt systemd to your distribution:
|
||||
|
||||
1. Find the right configure parameters for:
|
||||
|
||||
* `-Drc-local=`
|
||||
* `-Dloadkeys-path=`
|
||||
* `-Dsetfont-path=`
|
||||
* `-Dtty-gid=`
|
||||
|
||||
@@ -138,8 +138,6 @@ All tools:
|
||||
* `$SYSTEMCTL_INSTALL_CLIENT_SIDE=1` — if set, enable or disable unit files on
|
||||
the client side, instead of asking PID 1 to do this.
|
||||
|
||||
* `$SYSTEMCTL_SKIP_SYSV=1` — if set, do not call SysV compatibility hooks.
|
||||
|
||||
* `$SYSTEMCTL_SKIP_AUTO_KEXEC=1` — if set, do not automatically kexec instead of
|
||||
reboot when a new kernel has been loaded.
|
||||
|
||||
|
||||
@@ -81,10 +81,6 @@ Or you can even check /proc/$PID/cgroup directly. Also see [this blog story](htt
|
||||
|
||||
A: Unfortunately that would be a racy operation. For an explanation why and how we tried to improve the situation, see [the bugzilla report about this](https://bugzilla.redhat.com/show_bug.cgi?id=615527).
|
||||
|
||||
**Q: I have a native systemd service file and a SysV init script installed which share the same basename, e.g. /usr/lib/systemd/system/foobar.service vs. /etc/init.d/foobar -- which one wins?**
|
||||
|
||||
A: If both files are available the native unit file always takes precedence and the SysV init script is ignored, regardless whether either is enabled or disabled. Note that a SysV service that is enabled but overridden by a native service does not have the effect that the native service would be enabled, too. Enabling of native and SysV services is completely independent. Or in other words: you cannot enable a native service by enabling a SysV service by the same name, and if a SysV service is enabled but the respective native service is not, this will not have the effect that the SysV script is executed.
|
||||
|
||||
**Q: How can I use journalctl to display full (= not truncated) messages even if less is not used?**
|
||||
|
||||
A: Use:
|
||||
|
||||
@@ -70,16 +70,10 @@ For more details about those targets, see the
|
||||
[systemd.special(7)](https://www.freedesktop.org/software/systemd/man/systemd.special.html)
|
||||
man page.
|
||||
|
||||
## Compatibility with SysV init
|
||||
|
||||
LSB defines a `$network` dependency for legacy init scripts. Whenever systemd
|
||||
encounters a `$network` dependency in LSB headers of init scripts it will
|
||||
translate this to `Wants=` and `After=` dependencies on
|
||||
`network-online.target`, staying relatively close to traditional LSB behaviour.
|
||||
|
||||
# Discussion
|
||||
|
||||
The meaning of `$network` is defined [only very
|
||||
LSB defines a `$network` dependency for legacy init scripts.
|
||||
However, it is defined [only very
|
||||
unprecisely](http://refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/facilname.html)
|
||||
and people tend to have different ideas what it is supposed to mean. Here are a
|
||||
couple of ideas people came up with so far:
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
systemd is a suite of basic building blocks for a Linux system. It provides a system and service manager that runs as PID 1 and starts the rest of the system.
|
||||
|
||||
systemd provides aggressive parallelization capabilities, uses socket and D-Bus activation for starting services, offers on-demand starting of daemons, keeps track of processes using Linux control groups, maintains mount and automount points, and implements an elaborate transactional dependency-based service control logic. systemd supports SysV and LSB init scripts and works as a replacement for sysvinit.
|
||||
systemd provides aggressive parallelization capabilities, uses socket and D-Bus activation for starting services, offers on-demand starting of daemons, keeps track of processes using Linux control groups, maintains mount and automount points, and implements an elaborate transactional dependency-based service control logic.
|
||||
|
||||
Other parts include a logging daemon, utilities to control basic system configuration like the hostname, date, locale, maintain a list of logged-in users and running containers and virtual machines, system accounts, runtime directories and settings, and daemons to manage simple network configuration, network time synchronization, log forwarding, and name resolution.
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
<!ENTITY KILL_USER_PROCESSES "{{ 'yes' if KILL_USER_PROCESSES else 'no' }}">
|
||||
<!ENTITY JOURNAL_STORAGE_DEFAULT "{{JOURNAL_STORAGE_DEFAULT}}">
|
||||
<!ENTITY DEBUGTTY "{{DEBUGTTY}}">
|
||||
<!ENTITY SYSTEM_SYSVRCLOCAL_PATH "{{SYSTEM_SYSVRCLOCAL_PATH}}">
|
||||
<!ENTITY HIGH_RLIMIT_NOFILE "{{HIGH_RLIMIT_NOFILE}}">
|
||||
<!ENTITY DEFAULT_DNSSEC_MODE "{{DEFAULT_DNSSEC_MODE_STR}}">
|
||||
<!ENTITY DEFAULT_DNS_OVER_TLS_MODE "{{DEFAULT_DNS_OVER_TLS_MODE_STR}}">
|
||||
|
||||
@@ -1130,10 +1130,6 @@ manpages = [
|
||||
'8',
|
||||
['systemd-random-seed'],
|
||||
'ENABLE_RANDOMSEED'],
|
||||
['systemd-rc-local-generator',
|
||||
'8',
|
||||
['rc-local.service'],
|
||||
'HAVE_SYSV_RC_LOCAL'],
|
||||
['systemd-remount-fs.service', '8', ['systemd-remount-fs'], ''],
|
||||
['systemd-repart', '8', ['systemd-repart.service'], 'ENABLE_REPART'],
|
||||
['systemd-resolved.service', '8', ['systemd-resolved'], 'ENABLE_RESOLVE'],
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
<?xml version='1.0'?>
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % entities SYSTEM "custom-entities.ent" >
|
||||
%entities;
|
||||
]>
|
||||
<!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
|
||||
|
||||
<refentry id="systemd-rc-local-generator" conditional='HAVE_SYSV_RC_LOCAL'>
|
||||
<refentryinfo>
|
||||
<title>systemd-rc-local-generator</title>
|
||||
<productname>systemd</productname>
|
||||
</refentryinfo>
|
||||
|
||||
<refmeta>
|
||||
<refentrytitle>systemd-rc-local-generator</refentrytitle>
|
||||
<manvolnum>8</manvolnum>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>systemd-rc-local-generator</refname>
|
||||
<refname>rc-local.service</refname>
|
||||
<refpurpose>Compatibility generator and service to start <filename>&SYSTEM_SYSVRCLOCAL_PATH;</filename> during boot</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<para><filename>/usr/lib/systemd/system-generators/systemd-rc-local-generator</filename></para>
|
||||
<para><filename>rc-local.service</filename></para>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
|
||||
<para><command>systemd-rc-local-generator</command> is a generator that checks whether
|
||||
<filename>&SYSTEM_SYSVRCLOCAL_PATH;</filename> exists and is executable, and if it is, pulls the
|
||||
<filename>rc-local.service</filename> unit into the boot process. This unit is responsible for running
|
||||
this script during late boot. The script is run after <filename>network.target</filename>, but in
|
||||
parallel with most other regular system services.</para>
|
||||
|
||||
<para>Note that <filename>rc-local.service</filename> runs with slightly different semantics than the
|
||||
original System V version, which was executed "last" in the boot process, which is a concept that does
|
||||
not translate to systemd.</para>
|
||||
|
||||
<para>Also note that <filename>rc-local.service</filename> is ordered after
|
||||
<filename>network.target</filename>, which does not mean that the network is functional, see
|
||||
<citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>.
|
||||
If the script requires a configured network connection, it may be desirable to pull in and order it after
|
||||
<filename>network-online.target</filename> with a drop-in:</para>
|
||||
|
||||
<programlisting># /etc/systemd/system/rc-local.service.d/network.conf
|
||||
[Unit]
|
||||
Wants=network-online.target
|
||||
After=network-online.target
|
||||
</programlisting>
|
||||
|
||||
<para>Support for <filename>&SYSTEM_SYSVRCLOCAL_PATH;</filename> is provided for compatibility with specific
|
||||
System V systems only. However, it is strongly recommended to avoid using this script today, and instead
|
||||
provide proper unit files with appropriate dependencies for any scripts to run during the boot process.
|
||||
Note that the path to the script is set at compile time and varies between distributions.</para>
|
||||
|
||||
<para><filename>systemd-rc-local-generator</filename> implements
|
||||
<citerefentry><refentrytitle>systemd.generator</refentrytitle><manvolnum>7</manvolnum></citerefentry>.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Notes</title>
|
||||
|
||||
<para>On systems with SELinux, when creating the file, make sure to set the appropriate context, e.g.
|
||||
with "<command>sudo restorecon -v &SYSTEM_SYSVRCLOCAL_PATH;</command>".
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>See Also</title>
|
||||
<para><simplelist type="inline">
|
||||
<member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
|
||||
<member><citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
|
||||
</simplelist></para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
@@ -405,7 +405,6 @@ find $dir</programlisting>
|
||||
<member><citerefentry><refentrytitle>systemd-getty-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
|
||||
<member><citerefentry><refentrytitle>systemd-gpt-auto-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
|
||||
<member><citerefentry><refentrytitle>systemd-hibernate-resume-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
|
||||
<member><citerefentry><refentrytitle>systemd-rc-local-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
|
||||
<member><citerefentry><refentrytitle>systemd-system-update-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
|
||||
<member><citerefentry><refentrytitle>systemd-xdg-autostart-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
|
||||
<member><citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>
|
||||
|
||||
+3
-20
@@ -583,10 +583,6 @@
|
||||
functionality to other hosts (as opposed to <emphasis>consume</emphasis> functionality of other
|
||||
hosts) generally do not need to pull this in.</para>
|
||||
|
||||
<para>systemd automatically adds dependencies of type <varname>Wants=</varname> and
|
||||
<varname>After=</varname> for this target unit to all SysV init script service units
|
||||
with an LSB header referring to the <literal>$network</literal> facility.</para>
|
||||
|
||||
<para>Note that this unit is only useful during the original system start-up
|
||||
logic. After the system has completed booting up, it will not track the online state of
|
||||
the system anymore. Due to this it cannot be used as a network connection monitor
|
||||
@@ -679,11 +675,6 @@
|
||||
<listitem>
|
||||
<para>Similar to <filename>local-fs.target</filename>, but
|
||||
for remote mount points.</para>
|
||||
|
||||
<para>systemd automatically adds dependencies of type
|
||||
<varname>After=</varname> for this target unit to all SysV
|
||||
init script service units with an LSB header referring to
|
||||
the <literal>$remote_fs</literal> facility.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
@@ -1185,9 +1176,7 @@ WantedBy=sleep.target</programlisting>
|
||||
service lookups. Note that this is independent of UNIX user/group name lookups for which
|
||||
<filename>nss-user-lookup.target</filename> should be used. All services for which the
|
||||
availability of full host/network name resolution is essential should be ordered after
|
||||
this target, but not pull it in. systemd automatically adds dependencies of type
|
||||
<varname>After=</varname> for this target unit to all SysV init script service units
|
||||
with an LSB header referring to the <literal>$named</literal> facility.</para>
|
||||
this target, but not pull it in.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
@@ -1224,11 +1213,7 @@ WantedBy=sleep.target</programlisting>
|
||||
<term><filename>rpcbind.target</filename></term>
|
||||
<listitem>
|
||||
<para>The portmapper/rpcbind pulls in this target and orders
|
||||
itself before it, to indicate its availability. systemd
|
||||
automatically adds dependencies of type
|
||||
<varname>After=</varname> for this target unit to all SysV
|
||||
init script service units with an LSB header referring to
|
||||
the <literal>$portmap</literal> facility.</para>
|
||||
itself before it, to indicate its availability.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
@@ -1289,9 +1274,7 @@ WantedBy=sleep.target</programlisting>
|
||||
unit, but not pull it in.</para>
|
||||
|
||||
<para>The service manager automatically adds dependencies of type <varname>After=</varname> for
|
||||
this target unit to all SysV init script service units with an LSB header referring to the
|
||||
<literal>$time</literal> facility, as well to all timer units with at least one
|
||||
<varname>OnCalendar=</varname> directive.</para>
|
||||
this target unit to all timer units with at least one <varname>OnCalendar=</varname> directive.</para>
|
||||
|
||||
<para>This target provides stricter clock accuracy guarantees than
|
||||
<filename>time-set.target</filename> (see above), but likely requires
|
||||
|
||||
@@ -90,8 +90,6 @@ conf.set10('HAVE_SPLIT_BIN', split_bin,
|
||||
|
||||
have_standalone_binaries = get_option('standalone-binaries')
|
||||
|
||||
sysvrclocal_path = get_option('rc-local')
|
||||
conf.set10('HAVE_SYSV_RC_LOCAL', sysvrclocal_path != '')
|
||||
conf.set10('CREATE_LOG_DIRS', get_option('create-log-dirs'))
|
||||
|
||||
if get_option('hibernate') and not get_option('initrd')
|
||||
@@ -299,7 +297,6 @@ conf.set_quoted('SYSTEM_GENERATOR_DIR', systemgeneratordir
|
||||
conf.set_quoted('SYSTEM_PRESET_DIR', systempresetdir)
|
||||
conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir)
|
||||
conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir)
|
||||
conf.set_quoted('SYSTEM_SYSVRCLOCAL_PATH', sysvrclocal_path)
|
||||
conf.set_quoted('SYSUSERS_DIR', sysusersdir)
|
||||
conf.set_quoted('TMPFILES_DIR', tmpfilesdir)
|
||||
conf.set_quoted('USER_TMPFILES_DIR', usertmpfilesdir)
|
||||
@@ -2401,7 +2398,6 @@ subdir('src/pstore')
|
||||
subdir('src/ptyfwd')
|
||||
subdir('src/quotacheck')
|
||||
subdir('src/random-seed')
|
||||
subdir('src/rc-local-generator')
|
||||
subdir('src/remount-fs')
|
||||
subdir('src/repart')
|
||||
subdir('src/reply-password')
|
||||
@@ -3022,7 +3018,6 @@ summary({
|
||||
'sysconf directory' : sysconfdir,
|
||||
'include directory' : includedir,
|
||||
'lib directory' : libdir,
|
||||
'SysV rc.local script' : sysvrclocal_path,
|
||||
'PAM modules directory' : pamlibdir,
|
||||
'PAM configuration directory' : pamconfdir,
|
||||
'ssh server configuration directory' : sshdconfdir,
|
||||
@@ -3188,7 +3183,6 @@ foreach tuple : [
|
||||
['man pages', want_man],
|
||||
['html pages', want_html],
|
||||
['man page indices', want_man and have_lxml],
|
||||
['SysV compat'],
|
||||
['compat-mutable-uid-boundaries'],
|
||||
['utmp'],
|
||||
['ldconfig'],
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ option('sysvinit-path', type : 'string', value : '/etc/init.d', deprecated : tru
|
||||
description : 'This option is deprecated and will be removed in a future release')
|
||||
option('sysvrcnd-path', type : 'string', value : '/etc/rc.d', deprecated : true,
|
||||
description : 'This option is deprecated and will be removed in a future release')
|
||||
option('rc-local', type : 'string', value : '/etc/rc.local',
|
||||
option('rc-local', type : 'string', value : '/etc/rc.local', deprecated : true,
|
||||
description : 'path to SysV rc.local script')
|
||||
option('initrd', type : 'boolean',
|
||||
description : 'install services for use when running systemd in initrd')
|
||||
|
||||
@@ -16,6 +16,5 @@ VolatilePackages=
|
||||
systemd-networkd-debuginfo
|
||||
systemd-portable-debuginfo
|
||||
systemd-resolved-debuginfo
|
||||
systemd-sysvcompat-debuginfo
|
||||
systemd-testsuite-debuginfo
|
||||
udev-debuginfo
|
||||
|
||||
@@ -27,6 +27,7 @@ while read -r filelist; do
|
||||
-e '/(initctl|runlevel|telinit)/ d' \
|
||||
-e 's/systemd-quotacheck.service.8/systemd-quotacheck@.service.8/' \
|
||||
-e '/systemd-sysv-generator/d' \
|
||||
-e '/rc-local/d' \
|
||||
"$filelist" >"/tmp/$(basename "$filelist")"
|
||||
mount --bind "/tmp/$(basename "$filelist")" "$filelist"
|
||||
done < <(find "pkg/$PKG_SUBDIR${GIT_SUBDIR:+/$GIT_SUBDIR}" -name "files.*")
|
||||
|
||||
@@ -9,5 +9,5 @@ Environment=
|
||||
GIT_URL=https://salsa.debian.org/systemd-team/systemd.git
|
||||
GIT_SUBDIR=debian
|
||||
GIT_BRANCH=debian/master
|
||||
GIT_COMMIT=f05328feafba2156f31e17e0e2c144cfa7c66e72
|
||||
GIT_COMMIT=93a222266c23ff73720f4de009a027d3556baee4
|
||||
PKG_SUBDIR=debian
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
executables += [
|
||||
generator_template + {
|
||||
'name' : 'systemd-rc-local-generator',
|
||||
'sources' : files('rc-local-generator.c'),
|
||||
'conditions' : [
|
||||
'HAVE_SYSV_RC_LOCAL',
|
||||
],
|
||||
},
|
||||
]
|
||||
@@ -1,74 +0,0 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include "generator.h"
|
||||
#include "initrd-util.h"
|
||||
#include "log.h"
|
||||
#include "mkdir-label.h"
|
||||
#include "string-util.h"
|
||||
|
||||
static const char *arg_dest = NULL;
|
||||
|
||||
/* So you are reading this, and might wonder: why is this implemented as a generator rather than as a plain, statically
|
||||
* enabled service that carries appropriate ConditionFileIsExecutable= lines? The answer is this: conditions bypass
|
||||
* execution of a service's binary, but they have no influence on unit dependencies. Thus, a service that is
|
||||
* conditioned out will still act as synchronization point in the dependency tree, and we'd rather not have that for
|
||||
* these two legacy scripts. */
|
||||
|
||||
static int add_symlink(const char *service, const char *where) {
|
||||
const char *from, *to;
|
||||
|
||||
assert(service);
|
||||
assert(where);
|
||||
|
||||
from = strjoina(SYSTEM_DATA_UNIT_DIR "/", service);
|
||||
to = strjoina(arg_dest, "/", where, ".wants/", service);
|
||||
|
||||
(void) mkdir_parents_label(to, 0755);
|
||||
|
||||
if (symlink(from, to) < 0) {
|
||||
if (errno == EEXIST)
|
||||
return 0;
|
||||
|
||||
return log_error_errno(errno, "Failed to create symlink %s: %m", to);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int check_executable(const char *path) {
|
||||
assert(path);
|
||||
|
||||
if (access(path, X_OK) < 0) {
|
||||
if (errno == ENOENT)
|
||||
return log_debug_errno(errno, "%s does not exist, skipping.", path);
|
||||
if (errno == EACCES)
|
||||
return log_info_errno(errno, "%s is not marked executable, skipping.", path);
|
||||
|
||||
return log_warning_errno(errno, "Couldn't determine if %s exists and is executable, skipping: %m", path);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int run(const char *dest, const char *dest_early, const char *dest_late) {
|
||||
int r = 0, k = 0;
|
||||
|
||||
assert_se(arg_dest = dest);
|
||||
|
||||
if (in_initrd()) {
|
||||
log_debug("Skipping generator, running in the initrd.");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
if (check_executable(SYSTEM_SYSVRCLOCAL_PATH) >= 0) {
|
||||
log_debug("Automatically adding rc-local.service.");
|
||||
|
||||
r = add_symlink("rc-local.service", "multi-user.target");
|
||||
}
|
||||
|
||||
return r < 0 ? r : k;
|
||||
}
|
||||
|
||||
DEFINE_MAIN_GENERATOR_FUNCTION(run);
|
||||
@@ -29,8 +29,7 @@ fi
|
||||
for unit_file in "${UNIT_FILES[@]}"; do
|
||||
# Skip the check for a couple of units, namely:
|
||||
# - syslog.socket: the corresponding syslog.service might not be installed
|
||||
# - rc-local.service: compat API, /etc/rc.d/rc.local most likely won't be present
|
||||
if [[ "$unit_file" =~ /(syslog.socket|rc-local.service)$ ]]; then
|
||||
if [[ "$unit_file" =~ /syslog.socket$ ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
|
||||
@@ -11,9 +11,6 @@
|
||||
Description=Console Getty
|
||||
Documentation=man:agetty(8) man:systemd-getty-generator(8)
|
||||
After=systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target
|
||||
{% if HAVE_SYSV_RC_LOCAL %}
|
||||
After=rc-local.service
|
||||
{% endif %}
|
||||
Before=getty.target
|
||||
|
||||
# OCI containers may be run without a console
|
||||
|
||||
@@ -12,9 +12,6 @@ Description=Container Getty on /dev/pts/%I
|
||||
Documentation=man:agetty(8) man:systemd-getty-generator(8)
|
||||
Documentation=man:machinectl(1)
|
||||
After=systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target
|
||||
{% if HAVE_SYSV_RC_LOCAL %}
|
||||
After=rc-local.service
|
||||
{% endif %}
|
||||
Before=getty.target
|
||||
IgnoreOnIsolate=yes
|
||||
ConditionPathExists=/dev/pts/%I
|
||||
|
||||
@@ -12,9 +12,6 @@ Description=Getty on %I
|
||||
Documentation=man:agetty(8) man:systemd-getty-generator(8)
|
||||
Documentation=https://0pointer.de/blog/projects/serial-console.html
|
||||
After=systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target
|
||||
{% if HAVE_SYSV_RC_LOCAL %}
|
||||
After=rc-local.service
|
||||
{% endif %}
|
||||
|
||||
# If additional gettys are spawned during boot then we should make
|
||||
# sure that this is synchronized before getty.target, even though
|
||||
|
||||
@@ -174,10 +174,6 @@ units = [
|
||||
'file' : 'quotaon-root.service.in',
|
||||
'conditions' : ['ENABLE_QUOTACHECK'],
|
||||
},
|
||||
{
|
||||
'file' : 'rc-local.service.in',
|
||||
'conditions' : ['HAVE_SYSV_RC_LOCAL'],
|
||||
},
|
||||
{
|
||||
'file' : 'reboot.target',
|
||||
'symlinks' : ['ctrl-alt-del.target'],
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
#
|
||||
# This file is part of systemd.
|
||||
#
|
||||
# systemd is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation; either version 2.1 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This unit gets pulled automatically into multi-user.target by
|
||||
# systemd-rc-local-generator if {{SYSTEM_SYSVRCLOCAL_PATH}} is executable.
|
||||
[Unit]
|
||||
Description={{SYSTEM_SYSVRCLOCAL_PATH}} Compatibility
|
||||
Documentation=man:systemd-rc-local-generator(8)
|
||||
ConditionFileIsExecutable={{SYSTEM_SYSVRCLOCAL_PATH}}
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
ExecStart={{SYSTEM_SYSVRCLOCAL_PATH}} start
|
||||
TimeoutSec=infinity
|
||||
RemainAfterExit=yes
|
||||
GuessMainPID=no
|
||||
@@ -13,9 +13,6 @@ Documentation=man:agetty(8) man:systemd-getty-generator(8)
|
||||
Documentation=https://0pointer.de/blog/projects/serial-console.html
|
||||
BindsTo=dev-%i.device
|
||||
After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target
|
||||
{% if HAVE_SYSV_RC_LOCAL %}
|
||||
After=rc-local.service
|
||||
{% endif %}
|
||||
|
||||
# If additional gettys are spawned during boot then we should make
|
||||
# sure that this is synchronized before getty.target, even though
|
||||
|
||||
Reference in New Issue
Block a user