Skip to content

Commit

Permalink
Optionally include the encryption status in the device description
Browse files Browse the repository at this point in the history
  • Loading branch information
lslezak committed Apr 16, 2024
1 parent 600ef23 commit a2bd4a9
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/lib/y2storage/device_description.rb
Expand Up @@ -31,10 +31,12 @@ class DeviceDescription
#
# @param device [Y2Storage::Device, Y2Storage::LvmPv, Y2Storage::SimpleEtcFstabEntry]
# @param system_graph [Y2Storage::Devicegraph] Representation of the system in its initial state
def initialize(device, system_graph: nil)
# @param include_encryption [Boolean] Whether to include the encryption status in the label or not
def initialize(device, system_graph: nil, include_encryption: false)
textdomain "storage"
@device = device
@system_graph = system_graph || StorageManager.instance.probed
@include_encryption = include_encryption
end

# Text representation of the description
Expand All @@ -52,6 +54,9 @@ def to_s
# @return [Y2Storage::Devicegraph]
attr_reader :system_graph

# @return [Boolean]
attr_reader :include_encryption

# Default labels based on the device type
#
# @see #default_label
Expand Down Expand Up @@ -116,6 +121,15 @@ def formatted_device_type_label(device)
journal_type_label(fs)
elsif show_multidevice_type_label?(fs)
multidevice_type_label(fs)
elsif device.encrypted? && include_encryption
# TRANSLATORS: Encrypted device
# %{fs_type} is the filesystem type. I.e., FAT, Ext4, etc
# %{device_label} is the device label. I.e., Partition, Disk, etc
format(
_("Encrypted %{fs_type} %{device_label}"),
fs_type: fs_type(device, fs),
device_label: default_label(device)
)
else
# TRANSLATORS: %{fs_type} is the filesystem type. I.e., FAT, Ext4, etc
# %{device_label} is the device label. I.e., Partition, Disk, etc
Expand Down

0 comments on commit a2bd4a9

Please sign in to comment.