system-update-generator: use the new main function definer
This commit is contained in:
parent
7a44c7e31f
commit
bd020018f2
|
@ -15,7 +15,7 @@
|
||||||
* Implements the logic described in systemd.offline-updates(7).
|
* Implements the logic described in systemd.offline-updates(7).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static const char *arg_dest = "/tmp";
|
static const char *arg_dest = NULL;
|
||||||
|
|
||||||
static int generate_symlink(void) {
|
static int generate_symlink(void) {
|
||||||
const char *p = NULL;
|
const char *p = NULL;
|
||||||
|
@ -51,26 +51,20 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
static int run(const char *dest, const char *dest_early, const char *dest_late) {
|
||||||
int r, k;
|
int r;
|
||||||
|
|
||||||
log_setup_generator();
|
assert_se(arg_dest = dest_early);
|
||||||
|
|
||||||
if (argc > 1 && argc != 4) {
|
|
||||||
log_error("This program takes three or no arguments.");
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (argc > 1)
|
|
||||||
arg_dest = argv[2];
|
|
||||||
|
|
||||||
r = generate_symlink();
|
r = generate_symlink();
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
if (r > 0) {
|
r = proc_cmdline_parse(parse_proc_cmdline_item, NULL, 0);
|
||||||
k = proc_cmdline_parse(parse_proc_cmdline_item, NULL, 0);
|
if (r < 0)
|
||||||
if (k < 0)
|
log_warning_errno(r, "Failed to parse kernel command line, ignoring: %m");
|
||||||
log_warning_errno(k, "Failed to parse kernel command line, ignoring: %m");
|
|
||||||
}
|
|
||||||
|
|
||||||
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFINE_MAIN_GENERATOR_FUNCTION(run);
|
||||||
|
|
Loading…
Reference in New Issue