condition: allow overriding of ConditionNeedsUpdate= on the kernel command line

This should be useful for addressing #15724.
This commit is contained in:
Lennart Poettering
2020-05-18 20:17:57 +02:00
parent 3931056767
commit f8b4ae29c7
4 changed files with 27 additions and 0 deletions
+7
View File
@@ -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;