Skip to content

Commit 70624fe

Browse files
committed
fix subvol_selector not working with refactored variable mechanism
Signed-off-by: Zen <[email protected]>
1 parent ee3dea8 commit 70624fe

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

src/ugrd/fs/btrfs.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = '0.8.2'
1+
__version__ = '0.9.0'
22
__author__ = 'desultory'
33

44

@@ -37,13 +37,13 @@ def select_subvol(self) -> str:
3737
self.logger.log(5, "subvol_selector not set, skipping")
3838
return
3939

40-
root_volume = self['mounts']['root']['destination']
41-
out = [f'if [ -z "$(btrfs subvolume list -o {root_volume})" ]; then',
42-
f" echo 'Failed to list btrfs subvolumes for root volume: {root_volume}'",
40+
out = [f'mount -t btrfs -o subvolid=5,ro $(cat /run/MOUNTS_ROOT_SOURCE) {self["base_mount_path"]}',
41+
f'''if [ -z "$(btrfs subvolume list -o {self['base_mount_path']})" ]; then''',
42+
f''' echo "Failed to list btrfs subvolumes for root volume: {self['base_mount_path']}"''',
4343
"else",
4444
" echo 'Select a subvolume to use as root'",
4545
" PS3='Subvolume: '",
46-
f" select subvol in $(btrfs subvolume list -o {root_volume} " + "| awk '{print $9}'); do",
46+
f" select subvol in $(btrfs subvolume list -o {self['base_mount_path']} " + "| awk '{print $9}'); do",
4747
" case $subvol in",
4848
" *)",
4949
" if [[ -z $subvol ]]; then",
@@ -61,13 +61,7 @@ def select_subvol(self) -> str:
6161

6262

6363
def set_root_subvol(self) -> str:
64-
"""
65-
sets $root_subvol.
66-
Prefer root_subvol over subvol_selector.
67-
68-
If the subvol selector is set, change the root_mount path to the base_mount_path.
69-
Set the switch_root_target to the original root_mount path.
70-
"""
64+
""" Adds the root_subvol to the root_mount options. """
7165
if root_subvol := self.get('root_subvol'):
7266
return f'echo -n ",subvol={root_subvol}" >> /run/MOUNTS_ROOT_OPTIONS'
7367

0 commit comments

Comments
 (0)