diff --git a/man/kernel-command-line.xml b/man/kernel-command-line.xml index 4aac14ea18..b0cc3fea01 100644 --- a/man/kernel-command-line.xml +++ b/man/kernel-command-line.xml @@ -436,6 +436,15 @@ will not query the user for basic system settings, even if the system boots up for the first time and the relevant settings are not initialized yet. + + + systemd.condition-needs-update= + + Takes a boolean argument. If specified, overrides the result of + ConditionNeedsUpdate= unit condition checks. See + systemd.unit5 for + details. + diff --git a/man/systemd-update-done.service.xml b/man/systemd-update-done.service.xml index ad412691a9..91196dff30 100644 --- a/man/systemd-update-done.service.xml +++ b/man/systemd-update-done.service.xml @@ -58,6 +58,10 @@ touch1 on it. + Note that if the systemd.condition-needs-update= kernel command line option is + used it overrides the ConditionNeedsUpdate= unit condition checks. In that case + systemd-update-done.service will not reset the condition state until a follow-up + reboot where the kernel switch is not specified anymore. diff --git a/man/systemd.unit.xml b/man/systemd.unit.xml index b91c1ad0ec..e8563bcc0a 100644 --- a/man/systemd.unit.xml +++ b/man/systemd.unit.xml @@ -1294,6 +1294,13 @@ systemd-update-done.service8, to make sure they run before the stamp file's modification time gets reset indicating a completed update. + + If the systemd.condition-needs-update= option is specified on the kernel + command line (taking a boolean), it will override the result of this condition check, taking + precedence over any file modification time checks. If it is used + systemd-update-done.service will not have immediate effect on any following + ConditionNeedsUpdate= checks, until the system is rebooted where the kernel + command line option is not specified anymore. diff --git a/src/shared/condition.c b/src/shared/condition.c index 2d9702d873..2e29d4cca7 100644 --- a/src/shared/condition.c +++ b/src/shared/condition.c @@ -548,12 +548,19 @@ static int condition_test_capability(Condition *c, char **env) { static int condition_test_needs_update(Condition *c, char **env) { struct stat usr, other; const char *p; + bool b; int r; assert(c); assert(c->parameter); assert(c->type == CONDITION_NEEDS_UPDATE); + r = proc_cmdline_get_bool("systemd.condition-needs-update", &b); + if (r < 0) + log_debug_errno(r, "Failed to parse systemd.condition-needs-update= kernel command line argument, ignoring: %m"); + if (r > 0) + return b; + if (!path_is_absolute(c->parameter)) { log_debug("Specified condition parameter '%s' is not absolute, assuming an update is needed.", c->parameter); return true;