Skip to content

Commit d803252

Browse files
committed
rename autodetect_root_<type> parameters to just autodetect_<type>
setting the stage for these detection methods to be applied to all mount types Signed-off-by: Zen <[email protected]>
1 parent 72ed369 commit d803252

File tree

8 files changed

+39
-39
lines changed

8 files changed

+39
-39
lines changed

docs/configuration.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -234,14 +234,14 @@ Additional modules include:
234234
#### ugrd.fs.mounts
235235

236236
* `autodetect_root` (true) Set the root mount parameter based on the current root label or uuid.
237-
* `autodetect_root_dm` (true) Attempt to automatically configure virtual block devices such as LUKS/LVM/MDRAID.
238-
* `autodetect_root_luks` (true) Attempt to automatically configure LUKS mounts for the root device.
239-
* `autodetect_root_lvm` (true) Attempt to automatically configure LVM mounts for the root device.
240-
* `autodetect_root_mdraid` (true) Attempt to automatically configure MDRAID mounts for the root device.
237+
* `autodetect_dm` (true) Attempt to automatically configure virtual block devices such as LUKS/LVM/MDRAID.
238+
* `autodetect_luks` (true) Attempt to automatically configure LUKS mounts for the root device.
239+
* `autodetect_lvm` (true) Attempt to automatically configure LVM mounts for the root device.
240+
* `autodetect_mdraid` (true) Attempt to automatically configure MDRAID mounts for the root device.
241241
* `autodetect_init_mount'` (true) Automatically detect the mountpoint for the init binary, and add it to `late_mounts`.
242242
* `run_dirs` A list of directories to create under `/run/` at runtime
243243

244-
> `autodetect_root` is required for `autodetect_root_<type>` to work.
244+
> `autodetect_root` is required for `autodetect_<type>` to work.
245245
246246
`mounts`: A dictionary containing entries for mounts, with their associated config.
247247

examples/luks.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ modules = [
77
]
88

99
# Device mapper autodetection is enabled by default
10-
# autodetect_root_luks = true
10+
# autodetect_luks = true
1111

1212
# Information about the LUKS volume can be manually specified
1313
#[cryptsetup.root]

src/ugrd/crypto/cryptsetup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def _validate_cryptsetup_config(self, mapped_name: str) -> None:
100100
).exists(): # Make sure the header file exists, it may not be present at build time
101101
self.logger.warning("[%s] Header file not found: %s" % (mapped_name, c_(config["header_file"], "yellow")))
102102
elif not any([config.get("partuuid"), config.get("uuid"), config.get("path")]):
103-
if not self["autodetect_root_luks"]:
103+
if not self["autodetect_luks"]:
104104
raise ValidationError(
105105
"A device uuid, partuuid, or path must be specified for cryptsetup mount: %s" % mapped_name
106106
)

src/ugrd/fs/mounts.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
__author__ = "desultory"
2-
__version__ = "7.2.1"
2+
__version__ = "7.3.0"
33

44
from pathlib import Path
55
from re import search
@@ -436,7 +436,7 @@ def get_virtual_block_info(self):
436436
sys_block = Path("/sys/devices/virtual/block")
437437

438438
if not sys_block.exists():
439-
self["autodetect_root_dm"] = False
439+
self["autodetect_dm"] = False
440440
return self.logger.warning("Virtual block devices unavailable, disabling device mapper autodetection.")
441441

442442
devices = []
@@ -450,7 +450,7 @@ def get_virtual_block_info(self):
450450
devices.append(part)
451451

452452
if not devices:
453-
self["autodetect_root_dm"] = False
453+
self["autodetect_dm"] = False
454454
return self.logger.warning("No virtual block devices found, disabling device mapper autodetection.")
455455

456456
for virt_dev in devices:
@@ -624,7 +624,7 @@ def _autodetect_dm(self, mountpoint, device=None) -> None:
624624
self.logger.debug("Slave does not appear to be a DM device: %s" % slave)
625625

626626

627-
@contains("autodetect_root_raid", "Skipping RAID autodetection, autodetect_root_raid is disabled.", log_level=30)
627+
@contains("autodetect_raid", "Skipping RAID autodetection, autodetect_raid is disabled.", log_level=30)
628628
@contains("hostonly", "Skipping RAID autodetection, hostonly mode is disabled.", log_level=30)
629629
def autodetect_raid(self, source_dev, dm_name, blkid_info) -> None:
630630
"""Autodetects MD RAID mounts and sets the raid config.
@@ -641,7 +641,7 @@ def autodetect_raid(self, source_dev, dm_name, blkid_info) -> None:
641641
raise AutodetectError("[%s] Failed to autodetect MDRAID level: %s" % (dm_name, blkid_info))
642642

643643

644-
@contains("autodetect_root_lvm", "Skipping LVM autodetection, autodetect_root_lvm is disabled.", log_level=20)
644+
@contains("autodetect_lvm", "Skipping LVM autodetection, autodetect_lvm is disabled.", log_level=20)
645645
@contains("hostonly", "Skipping LVM autodetection, hostonly mode is disabled.", log_level=30)
646646
def autodetect_lvm(self, source_dev, dm_num, blkid_info) -> None:
647647
"""Autodetects LVM mounts and sets the lvm config."""
@@ -664,7 +664,7 @@ def autodetect_lvm(self, source_dev, dm_num, blkid_info) -> None:
664664
self["lvm"] = {source_dev.name: lvm_config}
665665

666666

667-
@contains("autodetect_root_luks", "Skipping LUKS autodetection, autodetect_root_luks is disabled.", log_level=30)
667+
@contains("autodetect_luks", "Skipping LUKS autodetection, autodetect_luks is disabled.", log_level=30)
668668
@contains("hostonly", "Skipping LUKS autodetection, hostonly mode is disabled.", log_level=30)
669669
def autodetect_luks(self, source_dev, dm_num, blkid_info) -> None:
670670
"""Autodetects LUKS mounts and sets the cryptsetup config."""
@@ -748,7 +748,7 @@ def autodetect_root(self) -> None:
748748
"Root mount not found in host mounts.\nCurrent mounts: %s" % pretty_print(self["_mounts"])
749749
)
750750
root_dev = _autodetect_mount(self, "/")
751-
if self["autodetect_root_dm"]:
751+
if self["autodetect_dm"]:
752752
if self["mounts"]["root"]["type"] == "btrfs":
753753
from ugrd.fs.btrfs import _get_btrfs_mount_devices
754754

src/ugrd/fs/mounts.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ run_dirs = [ "ugrd" ]
99

1010
mount_timeout = 1
1111
autodetect_root = true
12-
autodetect_root_dm = true
13-
autodetect_root_luks = true
14-
autodetect_root_lvm = true
15-
autodetect_root_raid = true
12+
autodetect_dm = true
13+
autodetect_luks = true
14+
autodetect_lvm = true
15+
autodetect_raid = true
1616
autodetect_init_mount = true
1717

1818
[imports.config_processing]
@@ -62,10 +62,10 @@ mount_timeout = "float" # The time to wait between mount attempts
6262
mount_retries = "int" # The number of times to re-attempt mounting the fstab, infinite if not set
6363
mount_cmd = "str" # The mount command called by mount_root, can be overridden
6464
autodetect_root = "bool" # Add the autodetect_root property, if defined, the root mount will be autodetected
65-
autodetect_root_dm = "bool" # Whether or not to try to autodetect device-mapper partitions
66-
autodetect_root_luks = "bool" # Whether or not to try to autodetect LUKS partitions
67-
autodetect_root_lvm = "bool" # Whether or not to try to autodetect LVM partitions
68-
autodetect_root_raid = "bool" # Whether or not to try to autodetect MDRAID partitions
65+
autodetect_dm = "bool" # Whether or not to try to autodetect device-mapper partitions
66+
autodetect_luks = "bool" # Whether or not to try to autodetect LUKS partitions
67+
autodetect_lvm = "bool" # Whether or not to try to autodetect LVM partitions
68+
autodetect_raid = "bool" # Whether or not to try to autodetect MDRAID partitions
6969
autodetect_init_mount = "bool" # Adds a late_mount for the init target if it exists under a mount on the host
7070
no_fsck = "bool" # Whether or not to skip fsck on the root device when applicable
7171
_mounts = "dict" # The mounts information

src/ugrd/main.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -94,36 +94,36 @@ def main():
9494
"dest": "autodetect_root",
9595
},
9696
{
97-
"flags": ["--autodetect-root-luks"],
97+
"flags": ["--autodetect-luks"],
9898
"action": "store_true",
9999
"help": "autodetect LUKS volumes under the root partition",
100100
},
101101
{
102-
"flags": ["--no-autodetect-root-luks"],
102+
"flags": ["--no-autodetect-luks"],
103103
"action": "store_false",
104-
"help": "do not autodetect root LUKS volumes",
105-
"dest": "autodetect_root_luks",
104+
"help": "do not autodetect LUKS volumes",
105+
"dest": "autodetect_luks",
106106
},
107-
{"flags": ["--autodetect-root-lvm"], "action": "store_true", "help": "autodetect LVM volumes"},
107+
{"flags": ["--autodetect-lvm"], "action": "store_true", "help": "autodetect LVM volumes"},
108108
{
109-
"flags": ["--no-autodetect-root-lvm"],
109+
"flags": ["--no-autodetect-lvm"],
110110
"action": "store_false",
111111
"help": "do not autodetect LVM volumes",
112-
"dest": "autodetect_root_lvm",
112+
"dest": "autodetect_lvm",
113113
},
114-
{"flags": ["--autodetect-root-raid"], "action": "store_true", "help": "autodetect MRRAID volumes"},
114+
{"flags": ["--autodetect-raid"], "action": "store_true", "help": "autodetect MRRAID volumes"},
115115
{
116-
"flags": ["--no-autodetect-root-raid"],
116+
"flags": ["--no-autodetect-raid"],
117117
"action": "store_false",
118118
"help": "do not autodetect MRRAID volumes",
119-
"dest": "autodetect_root_raid",
119+
"dest": "autodetect_raid",
120120
},
121-
{"flags": ["--autodetect-root-dm"], "action": "store_true", "help": "autodetect DM (LUKS/LVM) root partitions"},
121+
{"flags": ["--autodetect-dm"], "action": "store_true", "help": "autodetect DM (LUKS/LVM) root partitions"},
122122
{
123-
"flags": ["--no-autodetect-root-dm"],
123+
"flags": ["--no-autodetect-dm"],
124124
"action": "store_false",
125-
"help": "do not autodetect root DM volumes",
126-
"dest": "autodetect_root_dm",
125+
"help": "do not autodetect device mapper volumes",
126+
"dest": "autodetect_dm",
127127
},
128128
{"flags": ["--print-config"], "action": "store_true", "help": "print the final config dict"},
129129
{"flags": ["--print-init"], "action": "store_true", "help": "print the final init structure"},
@@ -156,7 +156,7 @@ def main():
156156
if test:
157157
logger.warning("TEST MODE ENABLED")
158158
logger.info("Disabling DM autodetection")
159-
kwargs["autodetect_root_dm"] = False
159+
kwargs["autodetect_dm"] = False
160160
kwargs["modules"] = kwargs["modules"] + ",ugrd.base.test" if kwargs.get("modules") else "ugrd.base.test"
161161

162162
logger.debug(f"Using the following kwargs: {kwargs}")

tests/fs/overlayfs.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ modules = [ "ugrd.base.test", "ugrd.fs.overlayfs"]
33

44
out_dir = "initramfs_test"
55
cpio_compression = false
6-
autodetect_root_dm = false
6+
autodetect_dm = false

tests/fullauto.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ out_dir = "initramfs_test"
1212
#test_kernel = "/boot/vmlinuz-6.6.35-gentoo-dist"
1313
cpio_compression = false
1414

15-
autodetect_root_dm = false
15+
autodetect_dm = false
1616

1717
# Optionally supply a kernel version, uses the current kernel version if not specified
1818
#kernel_version = "6.1.53-gentoo-dist"

0 commit comments

Comments
 (0)