diff options
author | Tom Gundersen <teg@jklm.no> | 2013-08-15 08:47:59 +0800 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2013-09-13 11:52:14 +0200 |
commit | 8c11d3c1b5851f05d63198a92833be80616750e9 (patch) | |
tree | 6ab93b868a04089209c002d678de57294719cd55 /src | |
parent | 719e4e368b8bbe4e2f2ce49ec6f864a90bd6c619 (diff) |
cryptsetup-generator: don't create tmp+swap units
Diffstat (limited to 'src')
-rw-r--r-- | src/cryptsetup/cryptsetup-generator.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c index 81b770890a..967c5e6e0b 100644 --- a/src/cryptsetup/cryptsetup-generator.c +++ b/src/cryptsetup/cryptsetup-generator.c @@ -72,13 +72,20 @@ static int create_disk( _cleanup_free_ char *p = NULL, *n = NULL, *d = NULL, *u = NULL, *from = NULL, *to = NULL, *e = NULL; _cleanup_fclose_ FILE *f = NULL; - bool noauto, nofail; + bool noauto, nofail, tmp, swap; assert(name); assert(device); noauto = has_option(options, "noauto"); nofail = has_option(options, "nofail"); + tmp = has_option(options, "tmp"); + swap = has_option(options, "swap"); + + if (tmp && swap) { + log_error("Device '%s' cannot be both 'tmp' and 'swap'. Ignoring.", name); + return -EINVAL; + } n = unit_name_from_path_instance("systemd-cryptsetup", name, ".service"); if (!n) @@ -151,12 +158,12 @@ static int create_disk( name, u, strempty(password), strempty(options), name); - if (has_option(options, "tmp")) + if (tmp) fprintf(f, "ExecStartPost=/sbin/mke2fs '/dev/mapper/%s'\n", name); - if (has_option(options, "swap")) + if (swap) fprintf(f, "ExecStartPost=/sbin/mkswap '/dev/mapper/%s'\n", name); |