cryptsetup: automatically start cryptsetup when looking for mount source
This commit is contained in:
parent
f41c094c9f
commit
74715b82cb
2
TODO
2
TODO
|
@ -84,6 +84,8 @@
|
||||||
|
|
||||||
* fsck-root.service/start gets queued twice
|
* fsck-root.service/start gets queued twice
|
||||||
|
|
||||||
|
* tmpfiles: allow specification of .conf files on cmdline
|
||||||
|
|
||||||
External:
|
External:
|
||||||
|
|
||||||
* patch kernel for xattr support in /dev, /proc/, /sys and /sys/fs/cgroup.
|
* patch kernel for xattr support in /dev, /proc/, /sys and /sys/fs/cgroup.
|
||||||
|
|
|
@ -59,7 +59,7 @@ static int create_disk(
|
||||||
const char *password,
|
const char *password,
|
||||||
const char *options) {
|
const char *options) {
|
||||||
|
|
||||||
char *p = NULL, *n = NULL, *d = NULL, *u = NULL, *from = NULL, *to = NULL;
|
char *p = NULL, *n = NULL, *d = NULL, *u = NULL, *from = NULL, *to = NULL, *e = NULL;
|
||||||
int r;
|
int r;
|
||||||
FILE *f = NULL;
|
FILE *f = NULL;
|
||||||
|
|
||||||
|
@ -139,14 +139,14 @@ static int create_disk(
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!options || !has_option(options, "noauto")) {
|
if (asprintf(&from, "../%s", n) < 0) {
|
||||||
|
|
||||||
if (asprintf(&to, "%s/%s.wants/%s", arg_dest, d, n) < 0) {
|
|
||||||
r = -ENOMEM;
|
r = -ENOMEM;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asprintf(&from, "../%s", n) < 0) {
|
if (!options || !has_option(options, "noauto")) {
|
||||||
|
|
||||||
|
if (asprintf(&to, "%s/%s.wants/%s", arg_dest, d, n) < 0) {
|
||||||
r = -ENOMEM;
|
r = -ENOMEM;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
@ -160,12 +160,30 @@ static int create_disk(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(to);
|
||||||
|
to = NULL;
|
||||||
|
|
||||||
|
e = unit_name_escape(name);
|
||||||
|
if (asprintf(&to, "%s/dev-mapper-%s.device.wants/%s", arg_dest, e, n) < 0) {
|
||||||
|
r = -ENOMEM;
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
mkdir_parents(to, 0755);
|
||||||
|
|
||||||
|
if (symlink(from, to) < 0) {
|
||||||
|
log_error("Failed to create symlink '%s' to '%s': %m", from, to);
|
||||||
|
r = -errno;
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
r = 0;
|
r = 0;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
free(p);
|
free(p);
|
||||||
free(n);
|
free(n);
|
||||||
free(d);
|
free(d);
|
||||||
|
free(e);
|
||||||
|
|
||||||
free(from);
|
free(from);
|
||||||
free(to);
|
free(to);
|
||||||
|
|
Loading…
Reference in a new issue