diff --git a/man/systemd.generator.xml b/man/systemd.generator.xml index ae4c2c5c0b..1a9b5d1653 100644 --- a/man/systemd.generator.xml +++ b/man/systemd.generator.xml @@ -163,6 +163,15 @@ + + $SYSTEMD_SOFT_REBOOTS_COUNT + + If the system has soft-rebooted, this variable is set to the count of soft-reboots. + This environment variable is only set for system generators. + + + + $SYSTEMD_FIRST_BOOT diff --git a/src/core/manager.c b/src/core/manager.c index 373f4d66e7..b9ea79a7ad 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -4081,6 +4081,12 @@ static int build_generator_environment(Manager *m, char ***ret) { if (r < 0) return r; + if (m->soft_reboots_count > 0) { + r = strv_env_assignf(&nl, "SYSTEMD_SOFT_REBOOTS_COUNT", "%u", m->soft_reboots_count); + if (r < 0) + return r; + } + if (m->first_boot >= 0) { r = strv_env_assign(&nl, "SYSTEMD_FIRST_BOOT", one_zero(m->first_boot)); if (r < 0)