Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP6:Update
systemd
1006-sysv-restore-support-for-halt.local.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 1006-sysv-restore-support-for-halt.local.patch of Package systemd
From 0f93d44dc5892105b2cd04a3f3203c7633001480 Mon Sep 17 00:00:00 2001 From: Franck Bui <fbui@suse.com> Date: Wed, 30 Sep 2020 21:20:32 +0200 Subject: [PATCH 1006/1016] sysv: restore support for halt.local This patch basically reverts the following commits: - commit 44508946534eee032927c263b79464832656dd6e. "Drop support for /usr/sbin/halt.local" - commit c0d11245d2bdcf2a4333c3d49c973d83dfbe3791. "Drop no longer needed halt-local.service.in" The paths of the scripts in man/systemd-rc-local-generator.xml have been changed to match those used by SUSE. The use of halt.local is now deprecated and its usage is logged at notice level. --- docs/DISTRO_PORTING.md | 1 + man/custom-entities.ent.in | 1 + man/systemd-rc-local-generator.xml | 17 +++++++++++++--- meson.build | 2 ++ meson_options.txt | 2 ++ src/rc-local-generator/rc-local-generator.c | 8 ++++++++ units/halt-local.service.in | 22 +++++++++++++++++++++ units/meson.build | 4 ++++ 8 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 units/halt-local.service.in diff --git a/docs/DISTRO_PORTING.md b/docs/DISTRO_PORTING.md index 93f36d0844..8a75f8dd1c 100644 --- a/docs/DISTRO_PORTING.md +++ b/docs/DISTRO_PORTING.md @@ -18,6 +18,7 @@ distribution: * `-Dsysvinit-path=` * `-Dsysvrcnd-path=` * `-Drc-local=` + * `-Dhalt-local=` * `-Dloadkeys-path=` * `-Dsetfont-path=` * `-Dtty-gid=` diff --git a/man/custom-entities.ent.in b/man/custom-entities.ent.in index e5aae04f4f..d7b6ff33a1 100644 --- a/man/custom-entities.ent.in +++ b/man/custom-entities.ent.in @@ -12,6 +12,7 @@ <!ENTITY KILL_USER_PROCESSES "{{ 'yes' if KILL_USER_PROCESSES else 'no' }}"> <!ENTITY DEBUGTTY "{{DEBUGTTY}}"> <!ENTITY RC_LOCAL_PATH "{{RC_LOCAL_PATH}}"> +<!ENTITY RC_LOCAL_SCRIPT_PATH_STOP "{{RC_LOCAL_SCRIPT_PATH_STOP}}"> <!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}}"> diff --git a/man/systemd-rc-local-generator.xml b/man/systemd-rc-local-generator.xml index f0e38ead47..39c1fc9340 100644 --- a/man/systemd-rc-local-generator.xml +++ b/man/systemd-rc-local-generator.xml @@ -20,7 +20,7 @@ <refnamediv> <refname>systemd-rc-local-generator</refname> <refname>rc-local.service</refname> - <refpurpose>Compatibility generator and service to start <filename>&RC_LOCAL_PATH;</filename> during boot</refpurpose> + <refpurpose>Compatibility generator and service to start <filename>&RC_LOCAL_PATH;</filename> and <filename>&RC_LOCAL_SCRIPT_PATH_STOP;</filename> during boot and shutdown</refpurpose> </refnamediv> <refsynopsisdiv> @@ -53,11 +53,22 @@ Wants=network-online.target After=network-online.target </programlisting> - <para>Support for <filename>&RC_LOCAL_PATH;</filename> is provided for compatibility with specific System - V systems only. However, it is strongly recommended to avoid making use of this script today, and instead + <para><filename>systemd-rc-local-generator</filename> also checks whether + <filename>&RC_LOCAL_SCRIPT_PATH_STOP;</filename> exists and is executable, and if it is pulls the + <filename>halt-local.service</filename> unit into the shutdown process. This unit is responsible for + running this script during later shutdown.</para> + + <para>Support for <filename>&RC_LOCAL_PATH;</filename> and + <filename>&RC_LOCAL_SCRIPT_PATH_STOP;</filename> is provided for compatibility with specific System V + systems only. However, it is strongly recommended to avoid making use of 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>Please note that the support for <filename>&RC_LOCAL_SCRIPT_PATH_STOP;</filename> will be removed in + the future. It is recommended to use the use the mechanism described in + <citerefentry><refentrytitle>systemd-shutdown</refentrytitle><manvolnum>8</manvolnum></citerefentry> + instead.</para> + <para><filename>systemd-rc-local-generator</filename> implements <citerefentry><refentrytitle>systemd.generator</refentrytitle><manvolnum>7</manvolnum></citerefentry>.</para> </refsect1> diff --git a/meson.build b/meson.build index 6fe4860b81..1d6f499b18 100644 --- a/meson.build +++ b/meson.build @@ -253,6 +253,7 @@ conf.set_quoted('PREFIX', prefixdir) conf.set_quoted('RANDOM_SEED', randomseeddir / 'random-seed') conf.set_quoted('RANDOM_SEED_DIR', randomseeddir) conf.set_quoted('RC_LOCAL_PATH', get_option('rc-local')) +conf.set_quoted('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local')) conf.set_quoted('ROOTBINDIR', rootbindir) conf.set_quoted('ROOTLIBDIR', rootlibdir) conf.set_quoted('ROOTLIBEXECDIR', rootlibexecdir) @@ -4906,6 +4907,7 @@ summary({ 'zsh completions directory' : zshcompletiondir, 'private shared lib version tag' : shared_lib_tag, 'extra start script' : get_option('rc-local'), + 'extra stop script' : get_option('halt-local'), 'debug shell' : '@0@ @ @1@'.format(get_option('debug-shell'), get_option('debug-tty')), 'system UIDs' : '<=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_UID_MAX'), diff --git a/meson_options.txt b/meson_options.txt index 1909323850..ab56df38c3 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -51,6 +51,8 @@ option('telinit-path', type : 'string', value : '/lib/sysvinit/telinit', description : 'path to telinit') option('rc-local', type : 'string', value : '/etc/rc.local') +option('halt-local', type : 'string', + value : '/usr/sbin/halt.local') option('initrd', type : 'boolean', description : 'install services for use when running systemd in initrd') option('compat-mutable-uid-boundaries', type : 'boolean', value : false, diff --git a/src/rc-local-generator/rc-local-generator.c b/src/rc-local-generator/rc-local-generator.c index 89cc5fadb6..4d715537de 100644 --- a/src/rc-local-generator/rc-local-generator.c +++ b/src/rc-local-generator/rc-local-generator.c @@ -70,6 +70,14 @@ static int run(const char *dest, const char *dest_early, const char *dest_late) r = add_symlink("rc-local.service", "multi-user.target"); } + if (check_executable(RC_LOCAL_SCRIPT_PATH_STOP) >= 0) { + log_debug("Automatically adding halt-local.service."); + log_notice("Use of %s is deprecated, see systemd-shutdown(8) man page for an alternative.", + RC_LOCAL_SCRIPT_PATH_STOP); + + k = add_symlink("halt-local.service", "final.target"); + } + return r < 0 ? r : k; } diff --git a/units/halt-local.service.in b/units/halt-local.service.in new file mode 100644 index 0000000000..5fc78b5580 --- /dev/null +++ b/units/halt-local.service.in @@ -0,0 +1,22 @@ +# SPDX-License-Identifier: LGPL-2.1+ +# +# 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. + +[Unit] +Description={{RC_LOCAL_SCRIPT_PATH_STOP}} Compatibility +ConditionFileIsExecutable={{RC_LOCAL_SCRIPT_PATH_STOP}} +DefaultDependencies=no +After=shutdown.target +Before=final.target + +[Service] +Type=oneshot +ExecStart={{RC_LOCAL_SCRIPT_PATH_STOP}} +TimeoutSec=0 +StandardOutput=tty +RemainAfterExit=yes diff --git a/units/meson.build b/units/meson.build index 23baed2120..3c9b28c34b 100644 --- a/units/meson.build +++ b/units/meson.build @@ -167,6 +167,10 @@ units = [ 'file' : 'rc-local.service.in', 'conditions' : ['HAVE_SYSV_COMPAT'], }, + { + 'file' : 'halt-local.service.in', + 'conditions' : ['HAVE_SYSV_COMPAT'], + }, { 'file' : 'reboot.target', 'symlinks' : ['ctrl-alt-del.target'] + (with_runlevels ? ['runlevel6.target'] : []), -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor