]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
pstore: allow specifying src and dst dirs are arguments
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 4 Oct 2019 14:14:47 +0000 (16:14 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 4 Oct 2019 14:15:11 +0000 (16:15 +0200)
This makes it much easier to debug the program as a normal user, since we
don't need to set up fake input under /sys/fs/pstore/.

Also, let's make the debug output a bit nicer.

src/pstore/pstore.c

index 8ffe523830f302c523f2481a32d0f3f39e95918b..986175870036c1a3842a77433275ff45d17e2f32 100644 (file)
@@ -359,15 +359,18 @@ static int run(int argc, char *argv[]) {
 
         log_setup_service();
 
-        if (argc > 1)
+        if (argc == 3) {
+                arg_sourcedir = argv[1];
+                arg_archivedir = argv[2];
+        } else if (argc > 1)
                 return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
-                                       "This program takes no arguments.");
+                                       "This program takes zero or two arguments.");
 
         /* Ignore all parse errors */
         (void) parse_config();
 
-        log_debug("Selected storage '%s'.", pstore_storage_to_string(arg_storage));
-        log_debug("Selected Unlink '%d'.", arg_unlink);
+        log_debug("Selected storage: %s.", pstore_storage_to_string(arg_storage));
+        log_debug("Selected unlink: %s.", yes_no(arg_unlink));
 
         if (arg_storage == PSTORE_STORAGE_NONE)
                 /* Do nothing, intentionally, leaving pstore untouched */