Skip to content

Commit 0b3aec6

Browse files
committed
fix regression in kver autodetection, fix autodetection in mounts
Signed-off-by: Zen <[email protected]>
1 parent 13b918b commit 0b3aec6

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "ugrd"
7-
version = "0.15.2"
7+
version = "0.15.3"
88
authors = [
99
{ name="Desultory", email="[email protected]" },
1010
]

src/ugrd/fs/mounts.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ def _process_mounts_multi(self, mount_name: str, mount_config) -> None:
6363
if 'ugrd.fs.btrfs' not in self['modules']:
6464
self.logger.info("Auto-enabling btrfs module")
6565
self['modules'] = 'ugrd.fs.btrfs'
66+
else:
67+
self.logger.debug("Unknown mount type: %s" % mount_type)
6668

6769
self['mounts'][mount_name] = mount_config
6870
self.logger.debug("[%s] Added mount: %s" % (mount_name, mount_config))
@@ -165,21 +167,25 @@ def autodetect_root(self) -> None:
165167
self.logger.debug("Detected root mount info: %s" % root_mount_info)
166168

167169
mount_data = root_mount_info.partition(':')[2].strip().split(' ')
168-
root_dict = {key: value for key, value in (entry.split('=') for entry in mount_data)}
170+
root_dict = {key: value.strip('"') for key, value in (entry.split('=') for entry in mount_data)}
171+
172+
mount_info = {'root': {'type': 'auto', 'base_mount': False}}
169173

170174
if mount_type := root_dict.get('TYPE'):
171175
self.logger.info("Autodetected root type: %s" % mount_type)
172-
self['mounts']['root']['type'] = mount_type.lower()
176+
mount_info['root']['type'] = mount_type.lower()
173177

174178
if label := root_dict.get('LABEL'):
175179
self.logger.info("Autodetected root label: %s" % label)
176-
self['mounts']['root']['source'] = {'label': label}
180+
mount_info['root']['source'] = {'label': label}
177181
elif uuid := root_dict.get('UUID'):
178182
self.logger.info("Autodetected root uuid: %s" % uuid)
179-
self['mounts']['root']['source'] = {'uuid': uuid}
183+
mount_info['root']['source'] = {'uuid': uuid}
180184
else:
181185
raise ValueError("Failed to autodetect root mount source.")
182186

187+
self['mounts'] = mount_info
188+
183189

184190
def mount_base(self) -> list[str]:
185191
""" Generates mount commands for the base mounts. """

src/ugrd/kmod/kmod.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
__author__ = 'desultory'
2-
__version__ = '1.1.1'
2+
__version__ = '1.1.2'
33

44
from pathlib import Path
55
from subprocess import run
@@ -170,7 +170,7 @@ def get_lsmod_modules(self) -> list[str]:
170170
if not self['hostonly']:
171171
raise RuntimeError("lsmod module resolution is only available in hostonly mode")
172172

173-
if self['kernel_version'] and self['kernel_version'] != uname().release:
173+
if self.get('kernel_version') and self['kernel_version'] != uname().release:
174174
self.logger.warning("Kernel version is set to %s, but the current kernel version is %s" % (self['kernel_version'], uname().release))
175175

176176
try:

0 commit comments

Comments
 (0)