1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-05 09:17:44 +03:00

cryptsetup-generator: don't create tmp+swap units

This commit is contained in:
Tom Gundersen 2013-08-15 08:47:59 +08:00
parent 719e4e368b
commit 8c11d3c1b5

View File

@ -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);