|
45 | 45 | find_lsblk_info, |
46 | 46 | get_all_lsblk_info, |
47 | 47 | get_lsblk_info, |
| 48 | + umount, |
48 | 49 | ) |
49 | 50 |
|
50 | 51 |
|
@@ -257,7 +258,7 @@ def get_btrfs_info( |
257 | 258 | subvol_infos.append(_BtrfsSubvolumeInfo(name, sub_vol_mountpoint)) |
258 | 259 |
|
259 | 260 | if not lsblk_info.mountpoint: |
260 | | - self.umount(dev_path) |
| 261 | + umount(dev_path) |
261 | 262 |
|
262 | 263 | return subvol_infos |
263 | 264 |
|
@@ -635,7 +636,7 @@ def create_lvm_btrfs_subvolumes( |
635 | 636 | except SysCallError as err: |
636 | 637 | raise DiskError(f'Could not set compress attribute at {subvol_path}: {err}') |
637 | 638 |
|
638 | | - self.umount(path) |
| 639 | + umount(path) |
639 | 640 |
|
640 | 641 | def create_btrfs_volumes( |
641 | 642 | self, |
@@ -677,7 +678,7 @@ def create_btrfs_volumes( |
677 | 678 |
|
678 | 679 | SysCommand(f"btrfs subvolume create -p {subvol_path}") |
679 | 680 |
|
680 | | - self.umount(dev_path) |
| 681 | + umount(dev_path) |
681 | 682 |
|
682 | 683 | if luks_handler is not None and luks_handler.mapper_dev is not None: |
683 | 684 | luks_handler.lock() |
@@ -710,7 +711,7 @@ def umount_all_existing(self, device_path: Path) -> None: |
710 | 711 | if partition.fs_type == FilesystemType.Crypto_luks: |
711 | 712 | Luks2(partition.path).lock() |
712 | 713 | else: |
713 | | - self.umount(partition.path, recursive=True) |
| 714 | + umount(partition.path, recursive=True) |
714 | 715 |
|
715 | 716 | def partition( |
716 | 717 | self, |
@@ -790,23 +791,6 @@ def mount( |
790 | 791 | except SysCallError as err: |
791 | 792 | raise DiskError(f'Could not mount {dev_path}: {command}\n{err.message}') |
792 | 793 |
|
793 | | - def umount(self, mountpoint: Path, recursive: bool = False) -> None: |
794 | | - lsblk_info = get_lsblk_info(mountpoint) |
795 | | - |
796 | | - if not lsblk_info.mountpoints: |
797 | | - return |
798 | | - |
799 | | - debug(f'Partition {mountpoint} is currently mounted at: {[str(m) for m in lsblk_info.mountpoints]}') |
800 | | - |
801 | | - cmd = ['umount'] |
802 | | - |
803 | | - if recursive: |
804 | | - cmd.append('-R') |
805 | | - |
806 | | - for path in lsblk_info.mountpoints: |
807 | | - debug(f'Unmounting mountpoint: {path}') |
808 | | - SysCommand(cmd + [str(path)]) |
809 | | - |
810 | 794 | def detect_pre_mounted_mods(self, base_mountpoint: Path) -> list[DeviceModification]: |
811 | 795 | part_mods: dict[Path, list[PartitionModification]] = {} |
812 | 796 |
|
|
0 commit comments