Skip to content

Commit 6c3f948

Browse files
committed
Move swapon() to disk.utils
1 parent 8148b1d commit 6c3f948

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

archinstall/lib/disk/device_handler.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -763,13 +763,6 @@ def partition(
763763
if filtered_part:
764764
self.udev_sync()
765765

766-
@staticmethod
767-
def swapon(path: Path) -> None:
768-
try:
769-
SysCommand(['swapon', str(path)])
770-
except SysCallError as err:
771-
raise DiskError(f'Could not enable swap {path}:\n{err.message}')
772-
773766
def detect_pre_mounted_mods(self, base_mountpoint: Path) -> list[DeviceModification]:
774767
part_mods: dict[Path, list[PartitionModification]] = {}
775768

archinstall/lib/disk/utils.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,3 +163,10 @@ def umount(mountpoint: Path, recursive: bool = False) -> None:
163163
for path in lsblk_info.mountpoints:
164164
debug(f'Unmounting mountpoint: {path}')
165165
SysCommand(cmd + [str(path)])
166+
167+
168+
def swapon(path: Path) -> None:
169+
try:
170+
SysCommand(['swapon', str(path)])
171+
except SysCallError as err:
172+
raise DiskError(f'Could not enable swap {path}:\n{err.message}')

archinstall/lib/installer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
from archinstall.lib.disk.device_handler import device_handler
1818
from archinstall.lib.disk.fido import Fido2
19-
from archinstall.lib.disk.utils import get_lsblk_by_mountpoint, get_lsblk_info, mount
19+
from archinstall.lib.disk.utils import get_lsblk_by_mountpoint, get_lsblk_info, mount, swapon
2020
from archinstall.lib.models.application import ZramAlgorithm
2121
from archinstall.lib.models.device import (
2222
DiskEncryption,
@@ -371,7 +371,7 @@ def _mount_partition(self, part_mod: PartitionModification) -> None:
371371
part_mod.mount_options,
372372
)
373373
elif part_mod.is_swap():
374-
device_handler.swapon(part_mod.dev_path)
374+
swapon(part_mod.dev_path)
375375

376376
def _mount_lvm_vol(self, volume: LvmVolume) -> None:
377377
if volume.fs_type != FilesystemType.Btrfs:

0 commit comments

Comments
 (0)