Synced latest changes from torxed-v2.2.0.
This commit is contained in:
commit
1230fdfe31
|
|
@ -39,7 +39,7 @@ class Installer():
|
||||||
:type hostname: str, optional
|
:type hostname: str, optional
|
||||||
|
|
||||||
"""
|
"""
|
||||||
def __init__(self, target, *, base_packages='base base-devel linux-firmware efibootmgr ', kernels='linux'):
|
def __init__(self, target, *, base_packages='base base-devel linux linux-firmware', kernels='linux'):
|
||||||
base_packages = base_packages + kernels.replace(',', ' ')
|
base_packages = base_packages + kernels.replace(',', ' ')
|
||||||
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')
|
||||||
|
|
@ -51,6 +51,10 @@ class Installer():
|
||||||
}
|
}
|
||||||
|
|
||||||
self.base_packages = base_packages.split(' ') if type(base_packages) is str else base_packages
|
self.base_packages = base_packages.split(' ') if type(base_packages) is str else base_packages
|
||||||
|
if hasUEFI():
|
||||||
|
self.base_packages.append("efibootmgr")
|
||||||
|
else:
|
||||||
|
self.base_packages.append("grub")
|
||||||
self.post_base_install = []
|
self.post_base_install = []
|
||||||
|
|
||||||
storage['session'] = self
|
storage['session'] = self
|
||||||
|
|
@ -426,15 +430,17 @@ class Installer():
|
||||||
elif bootloader == "grub-install":
|
elif bootloader == "grub-install":
|
||||||
if hasUEFI():
|
if hasUEFI():
|
||||||
o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.target} grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB'))
|
o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.target} grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB'))
|
||||||
sys_command('/usr/bin/arch-chroot grub-mkconfig -o /boot/grub/grub.cfg')
|
sys_command('/usr/bin/arch-chroot /mnt grub-mkconfig -o /boot/grub/grub.cfg')
|
||||||
|
return True
|
||||||
else:
|
else:
|
||||||
root_device = subprocess.check_output(f'basename "$(readlink -f "/sys/class/block/{root_partition.path.strip("/dev/")}/..")', shell=True).decode().strip()
|
root_device = subprocess.check_output(f'basename "$(readlink -f /sys/class/block/{root_partition.path.replace("/dev/","")}/..)"', shell=True).decode().strip()
|
||||||
if root_device == "block":
|
if root_device == "block":
|
||||||
root_device = f"{root_partition.path}"
|
root_device = f"{root_partition.path}"
|
||||||
o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.target} grub-install --target=--target=i386-pc /dev/{root_device}'))
|
o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.target} grub-install --target=i386-pc /dev/{root_device}'))
|
||||||
sys_command('/usr/bin/arch-chroot grub-mkconfig -o /boot/grub/grub.cfg')
|
sys_command('/usr/bin/arch-chroot /mnt grub-mkconfig -o /boot/grub/grub.cfg')
|
||||||
|
return True
|
||||||
else:
|
else:
|
||||||
raise RequirementError(f"Unknown (or not yet implemented) bootloader added to add_bootloader(): {bootloader}")
|
raise RequirementError(f"Unknown (or not yet implemented) bootloader requested: {bootloader}")
|
||||||
|
|
||||||
def add_additional_packages(self, *packages):
|
def add_additional_packages(self, *packages):
|
||||||
return self.pacstrap(*packages)
|
return self.pacstrap(*packages)
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ from .output import log, LOG_LEVELS
|
||||||
from .storage import storage
|
from .storage import storage
|
||||||
from .networking import list_interfaces
|
from .networking import list_interfaces
|
||||||
from .general import sys_command
|
from .general import sys_command
|
||||||
from .hardware import AVAILABLE_GFX_DRIVERS
|
from .hardware import AVAILABLE_GFX_DRIVERS, hasUEFI
|
||||||
|
|
||||||
## TODO: Some inconsistencies between the selection processes.
|
## TODO: Some inconsistencies between the selection processes.
|
||||||
## Some return the keys from the options, some the values?
|
## Some return the keys from the options, some the values?
|
||||||
|
|
@ -144,6 +144,16 @@ def ask_for_a_timezone():
|
||||||
fg='red'
|
fg='red'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def ask_for_bootloader() -> str:
|
||||||
|
bootloader = "systemd-bootctl"
|
||||||
|
if hasUEFI()==False:
|
||||||
|
bootloader="grub-install"
|
||||||
|
else:
|
||||||
|
bootloader_choice = input("Would you like to use GRUB as a bootloader instead of systemd-boot? [y/N] ").lower()
|
||||||
|
if bootloader_choice == "y":
|
||||||
|
bootloader="grub-install"
|
||||||
|
return bootloader
|
||||||
|
|
||||||
def ask_for_audio_selection():
|
def ask_for_audio_selection():
|
||||||
audio = "pulseaudio" # Default for most desktop environments
|
audio = "pulseaudio" # Default for most desktop environments
|
||||||
pipewire_choice = input("Would you like to install pipewire instead of pulseaudio as the default audio server? [Y/n] ").lower()
|
pipewire_choice = input("Would you like to install pipewire instead of pulseaudio as the default audio server? [Y/n] ").lower()
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,7 @@ def ask_user_questions():
|
||||||
except archinstall.UnknownFilesystemFormat as err:
|
except archinstall.UnknownFilesystemFormat as err:
|
||||||
archinstall.log(f" {partition} (Filesystem not supported)", fg='red')
|
archinstall.log(f" {partition} (Filesystem not supported)", fg='red')
|
||||||
|
|
||||||
|
|
||||||
# We then ask what to do with the partitions.
|
# We then ask what to do with the partitions.
|
||||||
if (option := archinstall.ask_for_disk_layout()) == 'abort':
|
if (option := archinstall.ask_for_disk_layout()) == 'abort':
|
||||||
archinstall.log(f"Safely aborting the installation. No changes to the disk or system has been made.")
|
archinstall.log(f"Safely aborting the installation. No changes to the disk or system has been made.")
|
||||||
|
|
@ -142,7 +143,7 @@ def ask_user_questions():
|
||||||
if (passwd := archinstall.get_password(prompt='Enter disk encryption password (leave blank for no encryption): ')):
|
if (passwd := archinstall.get_password(prompt='Enter disk encryption password (leave blank for no encryption): ')):
|
||||||
archinstall.arguments['!encryption-password'] = passwd
|
archinstall.arguments['!encryption-password'] = passwd
|
||||||
archinstall.arguments['harddrive'].encryption_password = archinstall.arguments['!encryption-password']
|
archinstall.arguments['harddrive'].encryption_password = archinstall.arguments['!encryption-password']
|
||||||
|
archinstall.arguments["bootloader"] = archinstall.ask_for_bootloader()
|
||||||
# Get the hostname for the machine
|
# Get the hostname for the machine
|
||||||
if not archinstall.arguments.get('hostname', None):
|
if not archinstall.arguments.get('hostname', None):
|
||||||
archinstall.arguments['hostname'] = input('Desired hostname for the installation: ').strip(' ')
|
archinstall.arguments['hostname'] = input('Desired hostname for the installation: ').strip(' ')
|
||||||
|
|
@ -202,7 +203,7 @@ def ask_user_questions():
|
||||||
# Additional packages (with some light weight error handling for invalid package names)
|
# Additional packages (with some light weight error handling for invalid package names)
|
||||||
while True:
|
while True:
|
||||||
if not archinstall.arguments.get('packages', None):
|
if not archinstall.arguments.get('packages', None):
|
||||||
print("Only packages such as base, base-devel, linux, linux-firmware, efibootmgr and optional profile packages are installed.")
|
print("Only packages such as base, base-devel, linux, linux-firmware, efibootmgr (on UEFI systems)/GRUB (on BIOS systems) and optional profile packages are installed.")
|
||||||
print("If you desire a web browser, such as firefox or chromium, you may specify it in the following prompt.")
|
print("If you desire a web browser, such as firefox or chromium, you may specify it in the following prompt.")
|
||||||
archinstall.arguments['packages'] = [package for package in input('Write additional packages to install (space separated, leave blank to skip): ').split(' ') if len(package)]
|
archinstall.arguments['packages'] = [package for package in input('Write additional packages to install (space separated, leave blank to skip): ').split(' ') if len(package)]
|
||||||
|
|
||||||
|
|
@ -278,8 +279,8 @@ def perform_installation_steps():
|
||||||
partition.format()
|
partition.format()
|
||||||
else:
|
else:
|
||||||
archinstall.log(f"Did not format {partition} because .safe_to_format() returned False or .allow_formatting was False.", level=archinstall.LOG_LEVELS.Debug)
|
archinstall.log(f"Did not format {partition} because .safe_to_format() returned False or .allow_formatting was False.", level=archinstall.LOG_LEVELS.Debug)
|
||||||
|
if hasUEFI():
|
||||||
fs.find_partition('/boot').format('vfat')
|
fs.find_partition('/boot').format('vfat')# we don't have a boot partition in bios mode
|
||||||
|
|
||||||
if archinstall.arguments.get('!encryption-password', None):
|
if archinstall.arguments.get('!encryption-password', None):
|
||||||
# First encrypt and unlock, then format the desired partition inside the encrypted part.
|
# First encrypt and unlock, then format the desired partition inside the encrypted part.
|
||||||
|
|
@ -291,8 +292,8 @@ def perform_installation_steps():
|
||||||
else:
|
else:
|
||||||
fs.find_partition('/').format(fs.find_partition('/').filesystem)
|
fs.find_partition('/').format(fs.find_partition('/').filesystem)
|
||||||
fs.find_partition('/').mount('/mnt')
|
fs.find_partition('/').mount('/mnt')
|
||||||
|
if hasUEFI():
|
||||||
fs.find_partition('/boot').mount('/mnt/boot')
|
fs.find_partition('/boot').mount('/mnt/boot')
|
||||||
|
|
||||||
perform_installation('/mnt')
|
perform_installation('/mnt')
|
||||||
|
|
||||||
|
|
@ -311,17 +312,17 @@ def perform_installation(mountpoint):
|
||||||
installation.log(f'Waiting for automatic mirror selection (reflector) to complete.', level=archinstall.LOG_LEVELS.Info)
|
installation.log(f'Waiting for automatic mirror selection (reflector) to complete.', level=archinstall.LOG_LEVELS.Info)
|
||||||
while archinstall.service_state('reflector') not in ('dead', 'failed'):
|
while archinstall.service_state('reflector') not in ('dead', 'failed'):
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
# Set mirrors used by pacstrap (outside of installation)
|
# Set mirrors used by pacstrap (outside of installation)
|
||||||
if archinstall.arguments.get('mirror-region', None):
|
if archinstall.arguments.get('mirror-region', None):
|
||||||
archinstall.use_mirrors(archinstall.arguments['mirror-region']) # Set the mirrors for the live medium
|
archinstall.use_mirrors(archinstall.arguments['mirror-region']) # Set the mirrors for the live medium
|
||||||
|
|
||||||
if installation.minimal_installation():
|
if installation.minimal_installation():
|
||||||
installation.set_hostname(archinstall.arguments['hostname'])
|
installation.set_hostname(archinstall.arguments['hostname'])
|
||||||
if archinstall.arguments['mirror-region'].get("mirrors",{})!= None:
|
if archinstall.arguments['mirror-region'].get("mirrors",{})!= None:
|
||||||
installation.set_mirrors(archinstall.arguments['mirror-region']) # Set the mirrors in the installation medium
|
installation.set_mirrors(archinstall.arguments['mirror-region']) # Set the mirrors in the installation medium
|
||||||
|
if archinstall.arguments["bootloader"]=="grub-install" and hasUEFI()==True:
|
||||||
|
installation.add_additional_packages("grub")
|
||||||
installation.set_keyboard_language(archinstall.arguments['keyboard-language'])
|
installation.set_keyboard_language(archinstall.arguments['keyboard-language'])
|
||||||
installation.add_bootloader()
|
installation.add_bootloader(archinstall.arguments["bootloader"])
|
||||||
|
|
||||||
# If user selected to copy the current ISO network configuration
|
# If user selected to copy the current ISO network configuration
|
||||||
# Perform a copy of the config
|
# Perform a copy of the config
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue