Cleanup imports and disk.py a bit more
This commit is contained in:
parent
b2d20647fc
commit
658e5c0411
|
|
@ -1,19 +1,19 @@
|
||||||
"""Arch Linux installer - guided, templates etc."""
|
"""Arch Linux installer - guided, templates etc."""
|
||||||
from .lib.general import *
|
|
||||||
from .lib.disk import *
|
from .lib.disk import *
|
||||||
from .lib.user_interaction import *
|
|
||||||
from .lib.exceptions import *
|
from .lib.exceptions import *
|
||||||
|
from .lib.general import *
|
||||||
|
from .lib.hardware import *
|
||||||
from .lib.installer import __packages__, Installer
|
from .lib.installer import __packages__, Installer
|
||||||
from .lib.profiles import *
|
from .lib.locale_helpers import *
|
||||||
from .lib.luks import *
|
from .lib.luks import *
|
||||||
from .lib.mirrors import *
|
from .lib.mirrors import *
|
||||||
from .lib.networking import *
|
from .lib.networking import *
|
||||||
from .lib.locale_helpers import *
|
|
||||||
from .lib.services import *
|
|
||||||
from .lib.packages import *
|
|
||||||
from .lib.output import *
|
from .lib.output import *
|
||||||
|
from .lib.packages import *
|
||||||
|
from .lib.profiles import *
|
||||||
|
from .lib.services import *
|
||||||
from .lib.storage import *
|
from .lib.storage import *
|
||||||
from .lib.hardware import *
|
from .lib.user_interaction import *
|
||||||
|
|
||||||
__version__ = "2.2.0.dev1"
|
__version__ = "2.2.0.dev1"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ ROOT_DIR_PATTERN = re.compile('^.*?/devices')
|
||||||
GPT = 0b00000001
|
GPT = 0b00000001
|
||||||
MBR = 0b00000010
|
MBR = 0b00000010
|
||||||
|
|
||||||
|
|
||||||
# import ctypes
|
# import ctypes
|
||||||
# import ctypes.util
|
# import ctypes.util
|
||||||
# libc = ctypes.CDLL(ctypes.util.find_library('c'), use_errno=True)
|
# libc = ctypes.CDLL(ctypes.util.find_library('c'), use_errno=True)
|
||||||
|
|
@ -215,6 +216,7 @@ class Partition():
|
||||||
for partition in json.loads(lsblk.decode('UTF-8'))['blockdevices']:
|
for partition in json.loads(lsblk.decode('UTF-8'))['blockdevices']:
|
||||||
return partition.get('partuuid', None)
|
return partition.get('partuuid', None)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def encrypted(self):
|
def encrypted(self):
|
||||||
return self._encrypted
|
return self._encrypted
|
||||||
|
|
@ -421,6 +423,7 @@ class Partition():
|
||||||
raise err
|
raise err
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class Filesystem():
|
class Filesystem():
|
||||||
# TODO:
|
# TODO:
|
||||||
# When instance of a HDD is selected, check all usages and gracefully unmount them
|
# When instance of a HDD is selected, check all usages and gracefully unmount them
|
||||||
|
|
@ -537,6 +540,7 @@ class Filesystem():
|
||||||
def set(self, partition: int, string: str):
|
def set(self, partition: int, string: str):
|
||||||
return self.parted(f'{self.blockdevice.device} set {partition + 1} {string}') == 0
|
return self.parted(f'{self.blockdevice.device} set {partition + 1} {string}') == 0
|
||||||
|
|
||||||
|
|
||||||
def device_state(name, *args, **kwargs):
|
def device_state(name, *args, **kwargs):
|
||||||
# Based out of: https://askubuntu.com/questions/528690/how-to-get-list-of-all-non-removable-disk-device-names-ssd-hdd-and-sata-ide-onl/528709#528709
|
# Based out of: https://askubuntu.com/questions/528690/how-to-get-list-of-all-non-removable-disk-device-names-ssd-hdd-and-sata-ide-onl/528709#528709
|
||||||
if os.path.isfile('/sys/block/{}/device/block/{}/removable'.format(name, name)):
|
if os.path.isfile('/sys/block/{}/device/block/{}/removable'.format(name, name)):
|
||||||
|
|
@ -586,6 +590,7 @@ def harddrive(size=None, model=None, fuzzy=False):
|
||||||
|
|
||||||
return collection[drive]
|
return collection[drive]
|
||||||
|
|
||||||
|
|
||||||
def get_mount_info(path):
|
def get_mount_info(path):
|
||||||
try:
|
try:
|
||||||
output = b''.join(sys_command(f'/usr/bin/findmnt --json {path}'))
|
output = b''.join(sys_command(f'/usr/bin/findmnt --json {path}'))
|
||||||
|
|
@ -600,6 +605,7 @@ def get_mount_info(path):
|
||||||
|
|
||||||
return output['filesystems'][0]
|
return output['filesystems'][0]
|
||||||
|
|
||||||
|
|
||||||
def get_partitions_in_use(mountpoint):
|
def get_partitions_in_use(mountpoint):
|
||||||
try:
|
try:
|
||||||
output = b''.join(sys_command(f'/usr/bin/findmnt --json -R {mountpoint}'))
|
output = b''.join(sys_command(f'/usr/bin/findmnt --json -R {mountpoint}'))
|
||||||
|
|
@ -618,6 +624,7 @@ def get_partitions_in_use(mountpoint):
|
||||||
|
|
||||||
return mounts
|
return mounts
|
||||||
|
|
||||||
|
|
||||||
def get_filesystem_type(path):
|
def get_filesystem_type(path):
|
||||||
try:
|
try:
|
||||||
handle = sys_command(f"blkid -o value -s TYPE {path}")
|
handle = sys_command(f"blkid -o value -s TYPE {path}")
|
||||||
|
|
@ -625,6 +632,7 @@ def get_filesystem_type(path):
|
||||||
except SysCallError:
|
except SysCallError:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def disk_layouts():
|
def disk_layouts():
|
||||||
try:
|
try:
|
||||||
handle = sys_command(f"lsblk -f -o+TYPE,SIZE -J")
|
handle = sys_command(f"lsblk -f -o+TYPE,SIZE -J")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue