diff --git a/man/rules/meson.build b/man/rules/meson.build
index 499fe6d19e2..54c5a9d9235 100644
--- a/man/rules/meson.build
+++ b/man/rules/meson.build
@@ -594,6 +594,7 @@ manpages = [
'8',
['systemd-random-seed'],
'ENABLE_RANDOMSEED'],
+ ['systemd-rc-local-generator', '8', [], ''],
['systemd-remount-fs.service', '8', ['systemd-remount-fs'], ''],
['systemd-resolve', '1', [], 'ENABLE_RESOLVE'],
['systemd-resolved.service', '8', ['systemd-resolved'], 'ENABLE_RESOLVE'],
diff --git a/man/systemd-rc-local-generator.xml b/man/systemd-rc-local-generator.xml
new file mode 100644
index 00000000000..89cd7ec6142
--- /dev/null
+++ b/man/systemd-rc-local-generator.xml
@@ -0,0 +1,86 @@
+
+
+
+
+
+
+
+ systemd-rc-local-generator
+ systemd
+
+
+
+ Developer
+ Lennart
+ Poettering
+ lennart@poettering.net
+
+
+
+
+
+ systemd-rc-local-generator
+ 8
+
+
+
+ systemd-rc-local-generator
+ Compatibility generator for starting /etc/rc.local and /usr/sbin/halt.local during boot and shutdown
+
+
+
+ /usr/lib/systemd/system-generators/systemd-rc-local-generator
+
+
+
+ Description
+
+ systemd-rc-local-generator is a generator that checks whether
+ /etc/rc.local exists and is executable, and if it is pulls the
+ rc-local.service unit into the boot process. This unit is responsible for running this script
+ during late boot. Note that the script will be run with slightly different semantics than the original System V
+ version, which was run "last" in the boot process, which is a concept that does not translate to systemd. The
+ script is run after network.target, but in parallel with most other regular system
+ services.
+
+ systemd-rc-local-generator also checks whether /usr/sbin/halt.local
+ exists and is executable, and if it is pulls the halt-local.service unit into the shutdown
+ process. This unit is responsible for running this script during later shutdown.
+
+ Support for both /etc/rc.local and /usr/sbin/halt.local is provided
+ for compatibility with specific System V systems only. However, it is strongly recommended to avoid making use of
+ these scripts today, and instead provide proper unit files with appropriate dependencies for any scripts to run
+ during the boot or shutdown processes.
+
+ systemd-rc-local-generator implements
+ systemd.generator7.
+
+
+
+ See Also
+
+ systemd1,
+ systemctl1
+
+
+
+
diff --git a/man/systemd.generator.xml b/man/systemd.generator.xml
index 55bb2b4a901..5e25bb776d2 100644
--- a/man/systemd.generator.xml
+++ b/man/systemd.generator.xml
@@ -336,6 +336,7 @@ find $dir
systemd-getty-generator8,
systemd-gpt-auto-generator8,
systemd-hibernate-resume-generator8,
+ systemd-rc-local-generator8,
systemd-system-update-generator8,
systemd-sysv-generator8,
systemd.unit5,
diff --git a/src/rc-local-generator/rc-local-generator.c b/src/rc-local-generator/rc-local-generator.c
index 196947ca515..b10b18eb8e8 100644
--- a/src/rc-local-generator/rc-local-generator.c
+++ b/src/rc-local-generator/rc-local-generator.c
@@ -23,7 +23,6 @@
#include
#include
-#include "alloc-util.h"
#include "log.h"
#include "mkdir.h"
#include "string-util.h"
@@ -32,21 +31,16 @@
static const char *arg_dest = "/tmp";
static int add_symlink(const char *service, const char *where) {
- _cleanup_free_ char *from = NULL, *to = NULL;
+ const char *from, *to;
int r;
assert(service);
assert(where);
- from = strjoin(SYSTEM_DATA_UNIT_PATH, "/", service);
- if (!from)
- return log_oom();
+ from = strjoina(SYSTEM_DATA_UNIT_PATH "/", service);
+ to = strjoina(arg_dest, "/", where, ".wants/", service);
- to = strjoin(arg_dest, "/", where, ".wants/", service);
- if (!to)
- return log_oom();
-
- mkdir_parents_label(to, 0755);
+ (void) mkdir_parents_label(to, 0755);
r = symlink(from, to);
if (r < 0) {
@@ -60,7 +54,7 @@ static int add_symlink(const char *service, const char *where) {
}
int main(int argc, char *argv[]) {
- int r = EXIT_SUCCESS;
+ int ret = EXIT_SUCCESS;
if (argc > 1 && argc != 4) {
log_error("This program takes three or no arguments.");
@@ -80,15 +74,15 @@ int main(int argc, char *argv[]) {
log_debug("Automatically adding rc-local.service.");
if (add_symlink("rc-local.service", "multi-user.target") < 0)
- r = EXIT_FAILURE;
+ ret = EXIT_FAILURE;
}
if (access(RC_LOCAL_SCRIPT_PATH_STOP, X_OK) >= 0) {
log_debug("Automatically adding halt-local.service.");
if (add_symlink("halt-local.service", "final.target") < 0)
- r = EXIT_FAILURE;
+ ret = EXIT_FAILURE;
}
- return r;
+ return ret;
}
diff --git a/units/debug-shell.service.in b/units/debug-shell.service.in
index 2d48faa1055..1127e68b635 100644
--- a/units/debug-shell.service.in
+++ b/units/debug-shell.service.in
@@ -10,6 +10,7 @@
[Unit]
Description=Early root shell on @DEBUGTTY@ FOR DEBUGGING ONLY
Documentation=man:sushell(8)
+Documentation=man:systemd-debug-generator(8)
DefaultDependencies=no
IgnoreOnIsolate=yes
ConditionPathExists=@DEBUGTTY@
diff --git a/units/rc-local.service.in b/units/rc-local.service.in
index 5dbd62aecbb..78ce69e0aec 100644
--- a/units/rc-local.service.in
+++ b/units/rc-local.service.in
@@ -11,6 +11,7 @@
# systemd-rc-local-generator if @RC_LOCAL_SCRIPT_PATH_START@ is executable.
[Unit]
Description=@RC_LOCAL_SCRIPT_PATH_START@ Compatibility
+Documentation=man:systemd-rc-local-generator(8)
ConditionFileIsExecutable=@RC_LOCAL_SCRIPT_PATH_START@
After=network.target