Some additional formatting
This commit is contained in:
parent
69d675f4aa
commit
b2d20647fc
|
|
@ -1,6 +1,4 @@
|
||||||
import archinstall
|
import archinstall
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
archinstall.run_as_a_module()
|
archinstall.run_as_a_module()
|
||||||
|
|
|
||||||
|
|
@ -55,21 +55,27 @@ AVAILABLE_GFX_DRIVERS = {
|
||||||
"VMware / VirtualBox (open-source)": ["mesa", "xf86-video-vmware"],
|
"VMware / VirtualBox (open-source)": ["mesa", "xf86-video-vmware"],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def hasWifi() -> bool:
|
def hasWifi() -> bool:
|
||||||
return 'WIRELESS' in enrich_iface_types(list_interfaces().values()).values()
|
return 'WIRELESS' in enrich_iface_types(list_interfaces().values()).values()
|
||||||
|
|
||||||
|
|
||||||
def hasAMDCPU() -> bool:
|
def hasAMDCPU() -> bool:
|
||||||
if subprocess.check_output("lscpu | grep AMD", shell=True).strip().decode():
|
if subprocess.check_output("lscpu | grep AMD", shell=True).strip().decode():
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def hasIntelCPU() -> bool:
|
def hasIntelCPU() -> bool:
|
||||||
if subprocess.check_output("lscpu | grep Intel", shell=True).strip().decode():
|
if subprocess.check_output("lscpu | grep Intel", shell=True).strip().decode():
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def hasUEFI() -> bool:
|
def hasUEFI() -> bool:
|
||||||
return os.path.isdir('/sys/firmware/efi')
|
return os.path.isdir('/sys/firmware/efi')
|
||||||
|
|
||||||
|
|
||||||
def graphicsDevices() -> dict:
|
def graphicsDevices() -> dict:
|
||||||
cards = {}
|
cards = {}
|
||||||
for line in sys_command(f"lspci"):
|
for line in sys_command(f"lspci"):
|
||||||
|
|
@ -78,12 +84,15 @@ def graphicsDevices()->dict:
|
||||||
cards[identifier.strip().lower().decode('UTF-8')] = line
|
cards[identifier.strip().lower().decode('UTF-8')] = line
|
||||||
return cards
|
return cards
|
||||||
|
|
||||||
|
|
||||||
def hasNvidiaGraphics() -> bool:
|
def hasNvidiaGraphics() -> bool:
|
||||||
return any('nvidia' in x for x in graphicsDevices())
|
return any('nvidia' in x for x in graphicsDevices())
|
||||||
|
|
||||||
|
|
||||||
def hasAmdGraphics() -> bool:
|
def hasAmdGraphics() -> bool:
|
||||||
return any('amd' in x for x in graphicsDevices())
|
return any('amd' in x for x in graphicsDevices())
|
||||||
|
|
||||||
|
|
||||||
def hasIntelGraphics() -> bool:
|
def hasIntelGraphics() -> bool:
|
||||||
return any('intel' in x for x in graphicsDevices())
|
return any('intel' in x for x in graphicsDevices())
|
||||||
|
|
||||||
|
|
@ -96,6 +105,7 @@ def cpuVendor()-> Optional[str]:
|
||||||
return info.get('data', None)
|
return info.get('data', None)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def isVM() -> bool:
|
def isVM() -> bool:
|
||||||
try:
|
try:
|
||||||
subprocess.check_call(["systemd-detect-virt"]) # systemd-detect-virt issues a non-zero exit code if it is not on a virtual machine
|
subprocess.check_call(["systemd-detect-virt"]) # systemd-detect-virt issues a non-zero exit code if it is not on a virtual machine
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
from .disk import *
|
from .disk import *
|
||||||
from .hardware import *
|
from .hardware import *
|
||||||
from .mirrors import *
|
from .mirrors import *
|
||||||
from .output import log
|
|
||||||
from .profiles import Profile
|
|
||||||
from .storage import storage
|
from .storage import storage
|
||||||
from .systemd import Networkd
|
from .systemd import Networkd
|
||||||
from .user_interaction import *
|
from .user_interaction import *
|
||||||
|
|
@ -10,6 +8,7 @@ from .user_interaction import *
|
||||||
# Any package that the Installer() is responsible for (optional and the default ones)
|
# Any package that the Installer() is responsible for (optional and the default ones)
|
||||||
__packages__ = ["base", "base-devel", "linux-firmware", "linux", "linux-lts", "linux-zen", "linux-hardened"]
|
__packages__ = ["base", "base-devel", "linux-firmware", "linux", "linux-lts", "linux-zen", "linux-hardened"]
|
||||||
|
|
||||||
|
|
||||||
class Installer():
|
class Installer():
|
||||||
"""
|
"""
|
||||||
`Installer()` is the wrapper for most basic installation steps.
|
`Installer()` is the wrapper for most basic installation steps.
|
||||||
|
|
@ -34,6 +33,7 @@ class Installer():
|
||||||
:type hostname: str, optional
|
:type hostname: str, optional
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, target, *, base_packages=__packages__[:3], kernels=['linux']):
|
def __init__(self, target, *, base_packages=__packages__[:3], kernels=['linux']):
|
||||||
self.target = target
|
self.target = target
|
||||||
self.init_time = time.strftime('%Y-%m-%d_%H-%M-%S')
|
self.init_time = time.strftime('%Y-%m-%d_%H-%M-%S')
|
||||||
|
|
@ -235,6 +235,7 @@ class Installer():
|
||||||
# If we haven't installed the base yet (function called pre-maturely)
|
# If we haven't installed the base yet (function called pre-maturely)
|
||||||
if self.helper_flags.get('base', False) is False:
|
if self.helper_flags.get('base', False) is False:
|
||||||
self.base_packages.append('iwd')
|
self.base_packages.append('iwd')
|
||||||
|
|
||||||
# This function will be called after minimal_installation()
|
# This function will be called after minimal_installation()
|
||||||
# as a hook for post-installs. This hook is only needed if
|
# as a hook for post-installs. This hook is only needed if
|
||||||
# base is not installed yet.
|
# base is not installed yet.
|
||||||
|
|
@ -264,18 +265,19 @@ class Installer():
|
||||||
if self.helper_flags.get('base', False) is False:
|
if self.helper_flags.get('base', False) is False:
|
||||||
def post_install_enable_networkd_resolved(*args, **kwargs):
|
def post_install_enable_networkd_resolved(*args, **kwargs):
|
||||||
self.enable_service('systemd-networkd', 'systemd-resolved')
|
self.enable_service('systemd-networkd', 'systemd-resolved')
|
||||||
|
|
||||||
self.post_base_install.append(post_install_enable_networkd_resolved)
|
self.post_base_install.append(post_install_enable_networkd_resolved)
|
||||||
# Otherwise, we can go ahead and enable the services
|
# Otherwise, we can go ahead and enable the services
|
||||||
else:
|
else:
|
||||||
self.enable_service('systemd-networkd', 'systemd-resolved')
|
self.enable_service('systemd-networkd', 'systemd-resolved')
|
||||||
|
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def detect_encryption(self, partition):
|
def detect_encryption(self, partition):
|
||||||
if partition.encrypted:
|
if partition.encrypted:
|
||||||
return partition
|
return partition
|
||||||
elif partition.parent not in partition.path and Partition(partition.parent, None, autodetect_filesystem=True).filesystem == 'crypto_LUKS':
|
elif partition.parent not in partition.path and Partition(partition.parent, None,
|
||||||
|
autodetect_filesystem=True).filesystem == 'crypto_LUKS':
|
||||||
return Partition(partition.parent, None, autodetect_filesystem=True)
|
return Partition(partition.parent, None, autodetect_filesystem=True)
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
@ -294,8 +296,6 @@ class Installer():
|
||||||
## TODO: Perhaps this should be living in the function which dictates
|
## TODO: Perhaps this should be living in the function which dictates
|
||||||
## the partitioning. Leaving here for now.
|
## the partitioning. Leaving here for now.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for partition in self.partitions:
|
for partition in self.partitions:
|
||||||
if partition.filesystem == 'btrfs':
|
if partition.filesystem == 'btrfs':
|
||||||
# if partition.encrypted:
|
# if partition.encrypted:
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
import subprocess
|
|
||||||
import os
|
import os
|
||||||
|
import subprocess
|
||||||
|
|
||||||
from .exceptions import *
|
from .exceptions import *
|
||||||
|
|
||||||
|
|
||||||
# from .general import sys_command
|
# from .general import sys_command
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue