mirror of
https://github.com/systemd/systemd.git
synced 2024-12-25 01:34:28 +03:00
cryptsetup-generator: use "/proc/cmdline" as source when appropriate
Right now, we always say `/etc/crypttab` even if the source was fully derived from the kargs. Let's match what `systemd-fstab-generator` does and use `/proc/cmdline` when that's the case.
This commit is contained in:
parent
a5d815bb7f
commit
62ca7d3b38
@ -274,7 +274,8 @@ static int create_disk(
|
|||||||
const char *device,
|
const char *device,
|
||||||
const char *password,
|
const char *password,
|
||||||
const char *keydev,
|
const char *keydev,
|
||||||
const char *options) {
|
const char *options,
|
||||||
|
const char *source) {
|
||||||
|
|
||||||
_cleanup_free_ char *n = NULL, *d = NULL, *u = NULL, *e = NULL,
|
_cleanup_free_ char *n = NULL, *d = NULL, *u = NULL, *e = NULL,
|
||||||
*keydev_mount = NULL, *keyfile_timeout_value = NULL,
|
*keydev_mount = NULL, *keyfile_timeout_value = NULL,
|
||||||
@ -343,7 +344,7 @@ static int create_disk(
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
r = generator_write_cryptsetup_unit_section(f, arg_crypttab);
|
r = generator_write_cryptsetup_unit_section(f, source);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
@ -680,7 +681,7 @@ static int add_crypttab_devices(void) {
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
r = create_disk(name, device, keyfile, keydev, (d && d->options) ? d->options : options);
|
r = create_disk(name, device, keyfile, keydev, (d && d->options) ? d->options : options, arg_crypttab);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
@ -715,7 +716,8 @@ static int add_proc_cmdline_devices(void) {
|
|||||||
device,
|
device,
|
||||||
d->keyfile ?: arg_default_keyfile,
|
d->keyfile ?: arg_default_keyfile,
|
||||||
d->keydev,
|
d->keydev,
|
||||||
d->options ?: arg_default_options);
|
d->options ?: arg_default_options,
|
||||||
|
"/proc/cmdline");
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user