condition: introduce systemd.condition-first-boot= kernel command line switch

Much like systemd.condition-needs-update= this new switch allows
overriding of a unit file condition, but this time its
ConditionFirstBoot=.

Usecase is also primarily debugging, but could be useful for other
schemes too.
This commit is contained in:
Lennart Poettering
2020-05-18 20:20:50 +02:00
parent 5439d8212c
commit 814872e925
3 changed files with 27 additions and 2 deletions
+7
View File
@@ -627,11 +627,18 @@ static int condition_test_needs_update(Condition *c, char **env) {
static int condition_test_first_boot(Condition *c, char **env) {
int r, q;
bool b;
assert(c);
assert(c->parameter);
assert(c->type == CONDITION_FIRST_BOOT);
r = proc_cmdline_get_bool("systemd.condition-first-boot", &b);
if (r < 0)
log_debug_errno(r, "Failed to parse systemd.condition-first-boot= kernel command line argument, ignoring: %m");
if (r > 0)
return b == !!r;
r = parse_boolean(c->parameter);
if (r < 0)
return r;