diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-07-07 19:25:31 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-07-07 21:05:09 +0200 |
commit | e26807239bd65bc17535a53cd540f38600e7ef24 (patch) | |
tree | 3100aec0ebcf4743d138fcf4d6d03977b8a90817 /src/core/manager.c | |
parent | 45035609fcfc3fe09324988c4929a3c147171c23 (diff) |
firstboot: get rid of firstboot generator again, introduce ConditionFirstBoot= instead
As Zbigniew pointed out a new ConditionFirstBoot= appears like the nicer
way to hook in systemd-firstboot.service on first boots (those with /etc
unpopulated), so let's do this, and get rid of the generator again.
Diffstat (limited to 'src/core/manager.c')
-rw-r--r-- | src/core/manager.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/core/manager.c b/src/core/manager.c index 9d078c0af7..3dffbe259b 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -2477,7 +2477,7 @@ void manager_check_finished(Manager *m) { m->confirm_spawn = false; /* This is no longer the first boot */ - m->is_first_boot = false; + manager_set_first_boot(m, false); if (dual_timestamp_is_set(&m->finish_timestamp)) return; @@ -2631,7 +2631,6 @@ void manager_run_generators(Manager *m) { _cleanup_closedir_ DIR *d = NULL; const char *generator_path; const char *argv[5]; - const char *env[2]; int r; assert(m); @@ -2665,14 +2664,8 @@ void manager_run_generators(Manager *m) { argv[3] = m->generator_unit_path_late; argv[4] = NULL; - if (m->is_first_boot) { - env[0] = (char*) "SYSTEMD_FIRST_BOOT=1"; - env[1] = NULL; - } else - env[0] = NULL; - RUN_WITH_UMASK(0022) - execute_directory(generator_path, d, DEFAULT_TIMEOUT_USEC, (char**) argv, (char**) env); + execute_directory(generator_path, d, DEFAULT_TIMEOUT_USEC, (char**) argv); finish: trim_generator_dir(m, &m->generator_unit_path); @@ -2816,6 +2809,20 @@ static bool manager_get_show_status(Manager *m) { return plymouth_running(); } +void manager_set_first_boot(Manager *m, bool b) { + assert(m); + + if (m->running_as != SYSTEMD_SYSTEM) + return; + + m->first_boot = b; + + if (m->first_boot) + touch("/run/systemd/first-boot"); + else + unlink("/run/systemd/first-boot"); +} + void manager_status_printf(Manager *m, bool ephemeral, const char *status, const char *format, ...) { va_list ap; |