Skip to content

Commit

Permalink
- allow to not add encryption in /etc/crypttab
Browse files Browse the repository at this point in the history
  • Loading branch information
aschnell committed Sep 22, 2023
1 parent 5558958 commit bf9d489
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
8 changes: 7 additions & 1 deletion barrel/create-encryption.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) [2021-2022] SUSE LLC
* Copyright (c) [2021-2023] SUSE LLC
*
* All Rights Reserved.
*
Expand Down Expand Up @@ -49,6 +49,7 @@ namespace barrel
{ "label", required_argument, 0, _("set label of device"), "label" },
{ "pool-name", required_argument, 0, _("pool name"), "name" },
{ "size", required_argument, 's', _("set size"), "size" },
{ "no-crypttab", no_argument, 0, _("do not add in /etc/crypttab") },
{ "force", no_argument, 0, _("force if block devices are in use") }
}, TakeBlkDevices::MAYBE);

Expand All @@ -68,6 +69,7 @@ namespace barrel
optional<string> label;
optional<string> pool_name;
optional<SmartSize> size;
bool crypttab = true;
bool force = false;

vector<string> blk_devices;
Expand Down Expand Up @@ -111,6 +113,8 @@ namespace barrel
size = SmartSize(str);
}

crypttab = !parsed_opts.has_option("no-crypttab");

force = parsed_opts.has_option("force");

blk_devices = parsed_opts.get_blk_devices();
Expand Down Expand Up @@ -256,6 +260,8 @@ namespace barrel
Encryption* encryption = blk_device->create_encryption(dm_name, type);
encryption->set_password(password);

encryption->set_in_etc_crypttab(options.crypttab);

if (options.label && is_luks(encryption))
to_luks(encryption)->set_label(options.label.value());

Expand Down
12 changes: 9 additions & 3 deletions doc/barrel.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<refentry id='barrel8' xmlns:xlink="http://www.w3.org/1999/xlink">

<refentryinfo>
<date>2023-09-21</date>
<date>2023-09-22</date>
</refentryinfo>

<refmeta>
<refentrytitle>barrel</refentrytitle>
<manvolnum>8</manvolnum>
<refmiscinfo class='date'>2023-09-21</refmiscinfo>
<refmiscinfo class='date'>2023-09-22</refmiscinfo>
<refmiscinfo class='version'>@VERSION@</refmiscinfo>
<refmiscinfo class='manual'>Storage Management</refmiscinfo>
</refmeta>
Expand Down Expand Up @@ -264,6 +264,12 @@
<para>Approximate size of resulting encryption device.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--no-crypttab</option></term>
<listitem>
<para>Do not add the encryption in /etc/crypttab.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--force</option></term>
<listitem>
Expand Down Expand Up @@ -605,7 +611,7 @@
<varlistentry>
<term><option>-l, --level</option> <replaceable>level</replaceable></term>
<listitem>
<para>Set RAID level. Possible values are 0, stripe, 1,
<para>Set RAID level. Possible values are linear, 0, stripe, 1,
mirror, 4, 5, 6 and 10.</para>
</listitem>
</varlistentry>
Expand Down

0 comments on commit bf9d489

Please sign in to comment.