summaryrefslogtreecommitdiff
path: root/src/hibernate-resume
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-09-26 07:31:10 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-10-08 16:06:16 +0200
commite83419d043e4f1e11f52d9a3360b0e5bdea71031 (patch)
tree48d43c13f657825ece89bddce5776a67664273d1 /src/hibernate-resume
parenta79858bfd1937e089893fee4d0d729a0ae8cfc46 (diff)
downloadsystemd-e83419d043e4f1e11f52d9a3360b0e5bdea71031.tar.gz
hib-res-generator: add "noresume"
This is an override parameter, to totally skip dehiberanation.
Diffstat (limited to 'src/hibernate-resume')
-rw-r--r--src/hibernate-resume/hibernate-resume-generator.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/hibernate-resume/hibernate-resume-generator.c b/src/hibernate-resume/hibernate-resume-generator.c
index 8ff44c3bb9..036493a389 100644
--- a/src/hibernate-resume/hibernate-resume-generator.c
+++ b/src/hibernate-resume/hibernate-resume-generator.c
@@ -15,6 +15,7 @@
static const char *arg_dest = "/tmp";
static char *arg_resume_device = NULL;
+static bool arg_noresume = false;
static int parse_proc_cmdline_item(const char *key, const char *value, void *data) {
@@ -28,8 +29,15 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
if (!s)
return log_oom();
- free(arg_resume_device);
- arg_resume_device = s;
+ free_and_replace(arg_resume_device, s);
+
+ } else if (streq(key, "noresume")) {
+ if (value) {
+ log_warning("\"noresume\" kernel command line switch specified with an argument, ignoring.");
+ return 0;
+ }
+
+ arg_noresume = true;
}
return 0;
@@ -85,6 +93,11 @@ int main(int argc, char *argv[]) {
if (r < 0)
log_warning_errno(r, "Failed to parse kernel command line, ignoring: %m");
+ if (arg_noresume) {
+ log_notice("Found \"noresume\" on the kernel command line, quitting.");
+ return EXIT_SUCCESS;
+ }
+
r = process_resume();
free(arg_resume_device);