Esempio n. 1
0
int main(int argc, char *argv[]) {
        bool enabled;
        int r;

        r = parse_argv(argc, argv);
        if (r <= 0)
                goto finish;

        log_set_target(LOG_TARGET_AUTO);
        log_parse_environment();
        log_open();

        umask(0022);

        r = proc_cmdline_get_bool("systemd.firstboot", &enabled);
        if (r < 0) {
                log_error_errno(r, "Failed to parse systemd.firstboot= kernel command line argument, ignoring: %m");
                goto finish;
        }
        if (r > 0 && !enabled) {
                r = 0; /* disabled */
                goto finish;
        }

        r = process_locale();
        if (r < 0)
                goto finish;

        r = process_keymap();
        if (r < 0)
                goto finish;

        r = process_timezone();
        if (r < 0)
                goto finish;

        r = process_hostname();
        if (r < 0)
                goto finish;

        r = process_machine_id();
        if (r < 0)
                goto finish;

        r = process_root_password();
        if (r < 0)
                goto finish;

finish:
        free(arg_root);
        free(arg_locale);
        free(arg_locale_messages);
        free(arg_keymap);
        free(arg_timezone);
        free(arg_hostname);
        string_erase(arg_root_password);
        free(arg_root_password);

        return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
}
Esempio n. 2
0
int shall_restore_state(void) {
        bool ret;
        int r;

        r = proc_cmdline_get_bool("systemd.restore_state", &ret);
        if (r < 0)
                return r;

        return r > 0 ? ret : true;
}
Esempio n. 3
0
static int run(int argc, char *argv[]) {
        bool enabled;
        int r;

        r = parse_argv(argc, argv);
        if (r <= 0)
                return r;

        log_setup_service();

        umask(0022);

        r = proc_cmdline_get_bool("systemd.firstboot", &enabled);
        if (r < 0)
                return log_error_errno(r, "Failed to parse systemd.firstboot= kernel command line argument, ignoring: %m");
        if (r > 0 && !enabled)
                return 0; /* disabled */

        r = process_locale();
        if (r < 0)
                return r;

        r = process_keymap();
        if (r < 0)
                return r;

        r = process_timezone();
        if (r < 0)
                return r;

        r = process_hostname();
        if (r < 0)
                return r;

        r = process_machine_id();
        if (r < 0)
                return r;

        r = process_root_password();
        if (r < 0)
                return r;

        return 0;
}
Esempio n. 4
0
static bool enable_name_policy(void) {
        bool b;

        return proc_cmdline_get_bool("net.ifnames", &b) <= 0 || b;
}