Merged in master.
This commit is contained in:
commit
51565314b4
|
|
@ -139,7 +139,7 @@ you can replace the version of archinstall with a new version and run that with
|
||||||
3. Uninstall the previous version of archinstall with `pip uninstall archinstall`
|
3. Uninstall the previous version of archinstall with `pip uninstall archinstall`
|
||||||
4. Now clone the latest repository with `git clone https://github.com/archlinux/archinstall`
|
4. Now clone the latest repository with `git clone https://github.com/archlinux/archinstall`
|
||||||
5. Enter the repository with `cd archinstall`
|
5. Enter the repository with `cd archinstall`
|
||||||
*At this stage, you can choose to check out a feature branch for instance with `git checkout torxed-v2.2.0`*
|
*At this stage, you can choose to check out a feature branch for instance with `git checkout v2.2.0`*
|
||||||
6. Build the project and install it using `python setup.py install`
|
6. Build the project and install it using `python setup.py install`
|
||||||
|
|
||||||
After this, running archinstall with `python -m archinstall` will run against whatever branch you chose in step 5.
|
After this, running archinstall with `python -m archinstall` will run against whatever branch you chose in step 5.
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ def initialize_arguments():
|
||||||
config[key] = val
|
config[key] = val
|
||||||
config["script"] = args.script
|
config["script"] = args.script
|
||||||
if args.dry_run is not None:
|
if args.dry_run is not None:
|
||||||
config["dry_run"] = args.dry_run
|
config["dry-run"] = args.dry_run
|
||||||
return config
|
return config
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -667,6 +667,11 @@ class Partition:
|
||||||
raise DiskError(f"Could not format {path} with {filesystem} because: {handle.decode('UTF-8')}")
|
raise DiskError(f"Could not format {path} with {filesystem} because: {handle.decode('UTF-8')}")
|
||||||
self.filesystem = filesystem
|
self.filesystem = filesystem
|
||||||
|
|
||||||
|
elif filesystem == 'ext2':
|
||||||
|
if (handle := SysCommand(f'/usr/bin/mkfs.ext2 -F {path}')).exit_code != 0:
|
||||||
|
raise DiskError(f'Could not format {path} with {filesystem} because: {b"".join(handle)}')
|
||||||
|
self.filesystem = 'ext2'
|
||||||
|
|
||||||
elif filesystem == 'xfs':
|
elif filesystem == 'xfs':
|
||||||
if (handle := SysCommand(f'/usr/bin/mkfs.xfs -f {path}')).exit_code != 0:
|
if (handle := SysCommand(f'/usr/bin/mkfs.xfs -f {path}')).exit_code != 0:
|
||||||
raise DiskError(f"Could not format {path} with {filesystem} because: {handle.decode('UTF-8')}")
|
raise DiskError(f"Could not format {path} with {filesystem} because: {handle.decode('UTF-8')}")
|
||||||
|
|
@ -909,6 +914,7 @@ class Filesystem:
|
||||||
|
|
||||||
if self.parted(parted_string):
|
if self.parted(parted_string):
|
||||||
start_wait = time.time()
|
start_wait = time.time()
|
||||||
|
|
||||||
while previous_partition_uuids == {partition.uuid for partition in self.blockdevice.partitions.values()}:
|
while previous_partition_uuids == {partition.uuid for partition in self.blockdevice.partitions.values()}:
|
||||||
if time.time() - start_wait > 10:
|
if time.time() - start_wait > 10:
|
||||||
raise DiskError(f"New partition never showed up after adding new partition on {self} (timeout 10 seconds).")
|
raise DiskError(f"New partition never showed up after adding new partition on {self} (timeout 10 seconds).")
|
||||||
|
|
@ -918,7 +924,6 @@ class Filesystem:
|
||||||
time.sleep(0.5) # Let the kernel catch up with quick block devices (nvme for instance)
|
time.sleep(0.5) # Let the kernel catch up with quick block devices (nvme for instance)
|
||||||
return self.blockdevice.get_partition(uuid=(previous_partition_uuids ^ {partition.uuid for partition in self.blockdevice.partitions.values()}).pop())
|
return self.blockdevice.get_partition(uuid=(previous_partition_uuids ^ {partition.uuid for partition in self.blockdevice.partitions.values()}).pop())
|
||||||
|
|
||||||
|
|
||||||
def set_name(self, partition: int, name: str):
|
def set_name(self, partition: int, name: str):
|
||||||
return self.parted(f'{self.blockdevice.device} name {partition + 1} "{name}"') == 0
|
return self.parted(f'{self.blockdevice.device} name {partition + 1} "{name}"') == 0
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -100,10 +100,7 @@ class JsonEncoder:
|
||||||
elif isinstance(obj, (datetime, date)):
|
elif isinstance(obj, (datetime, date)):
|
||||||
return obj.isoformat()
|
return obj.isoformat()
|
||||||
elif isinstance(obj, (list, set, tuple)):
|
elif isinstance(obj, (list, set, tuple)):
|
||||||
r = []
|
return [json.loads(json.dumps(item, cls=JSON)) for item in obj]
|
||||||
for item in obj:
|
|
||||||
r.append(json.loads(json.dumps(item, cls=JSON)))
|
|
||||||
return r
|
|
||||||
else:
|
else:
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import subprocess
|
from pathlib import Path
|
||||||
from typing import Optional
|
from typing import Iterator, Optional
|
||||||
|
|
||||||
from .general import SysCommand
|
from .general import SysCommand
|
||||||
from .networking import list_interfaces, enrich_iface_types
|
from .networking import list_interfaces, enrich_iface_types
|
||||||
|
|
@ -57,22 +57,33 @@ AVAILABLE_GFX_DRIVERS = {
|
||||||
"VMware / VirtualBox (open-source)": ["mesa", "xf86-video-vmware"],
|
"VMware / VirtualBox (open-source)": ["mesa", "xf86-video-vmware"],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CPUINFO = Path("/proc/cpuinfo")
|
||||||
|
|
||||||
|
|
||||||
|
def cpuinfo() -> Iterator[dict[str, str]]:
|
||||||
|
"""Yields information about the CPUs of the system."""
|
||||||
|
cpu = {}
|
||||||
|
|
||||||
|
with CPUINFO.open() as file:
|
||||||
|
for line in file:
|
||||||
|
if not (line := line.strip()):
|
||||||
|
yield cpu
|
||||||
|
cpu = {}
|
||||||
|
continue
|
||||||
|
|
||||||
|
key, value = line.split(":", maxsplit=1)
|
||||||
|
cpu[key.strip()] = value.strip()
|
||||||
|
|
||||||
|
|
||||||
def has_wifi() -> bool:
|
def has_wifi() -> bool:
|
||||||
return 'WIRELESS' in enrich_iface_types(list_interfaces().values()).values()
|
return 'WIRELESS' in enrich_iface_types(list_interfaces().values()).values()
|
||||||
|
|
||||||
|
|
||||||
def has_amd_cpu() -> bool:
|
def has_amd_cpu() -> bool:
|
||||||
if subprocess.check_output("lscpu | grep AMD", shell=True).strip().decode():
|
return any(cpu.get("vendor_id") == "AuthenticAMD" for cpu in cpuinfo())
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
def has_intel_cpu() -> bool:
|
def has_intel_cpu() -> bool:
|
||||||
if subprocess.check_output("lscpu | grep Intel", shell=True).strip().decode():
|
return any(cpu.get("vendor_id") == "GenuineIntel" for cpu in cpuinfo())
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
def has_uefi() -> bool:
|
def has_uefi() -> bool:
|
||||||
return os.path.isdir('/sys/firmware/efi')
|
return os.path.isdir('/sys/firmware/efi')
|
||||||
|
|
@ -106,7 +117,7 @@ def cpu_vendor() -> Optional[str]:
|
||||||
for info in cpu_info:
|
for info in cpu_info:
|
||||||
if info.get('field', None) == "Vendor ID:":
|
if info.get('field', None) == "Vendor ID:":
|
||||||
return info.get('data', None)
|
return info.get('data', None)
|
||||||
return None
|
return
|
||||||
|
|
||||||
|
|
||||||
def cpu_model() -> Optional[str]:
|
def cpu_model() -> Optional[str]:
|
||||||
|
|
@ -116,7 +127,7 @@ def cpu_model() -> Optional[str]:
|
||||||
for info in cpu_info:
|
for info in cpu_info:
|
||||||
if info.get('field', None) == "Model name:":
|
if info.get('field', None) == "Model name:":
|
||||||
return info.get('data', None)
|
return info.get('data', None)
|
||||||
return None
|
return
|
||||||
|
|
||||||
|
|
||||||
def sys_vendor() -> Optional[str]:
|
def sys_vendor() -> Optional[str]:
|
||||||
|
|
@ -131,7 +142,10 @@ def product_name() -> Optional[str]:
|
||||||
|
|
||||||
def mem_info():
|
def mem_info():
|
||||||
# This implementation is from https://stackoverflow.com/a/28161352
|
# This implementation is from https://stackoverflow.com/a/28161352
|
||||||
return dict((i.split()[0].rstrip(':'), int(i.split()[1])) for i in open('/proc/meminfo').readlines())
|
return {
|
||||||
|
i.split()[0].rstrip(':'): int(i.split()[1])
|
||||||
|
for i in open('/proc/meminfo').readlines()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def mem_available() -> Optional[str]:
|
def mem_available() -> Optional[str]:
|
||||||
|
|
@ -151,13 +165,6 @@ def virtualization() -> Optional[str]:
|
||||||
|
|
||||||
|
|
||||||
def is_vm() -> bool:
|
def is_vm() -> bool:
|
||||||
try:
|
return b"none" not in b"".join(SysCommand("systemd-detect-virt")).lower()
|
||||||
# systemd-detect-virt issues a non-zero exit code if it is not on a virtual machine
|
|
||||||
if b"none" not in b"".join(SysCommand("systemd-detect-virt")).lower():
|
|
||||||
return True
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
return False
|
|
||||||
|
|
||||||
# TODO: Add more identifiers
|
# TODO: Add more identifiers
|
||||||
|
|
|
||||||
|
|
@ -429,7 +429,7 @@ class Installer:
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def add_bootloader(self, bootloader='systemd-bootctl'):
|
def add_bootloader(self, _device, bootloader='systemd-bootctl'):
|
||||||
for plugin in plugins.values():
|
for plugin in plugins.values():
|
||||||
if hasattr(plugin, 'on_add_bootloader'):
|
if hasattr(plugin, 'on_add_bootloader'):
|
||||||
# Allow plugins to override the boot-loader handling.
|
# Allow plugins to override the boot-loader handling.
|
||||||
|
|
@ -523,7 +523,16 @@ class Installer:
|
||||||
self.helper_flags['bootloader'] = bootloader
|
self.helper_flags['bootloader'] = bootloader
|
||||||
|
|
||||||
elif bootloader == "grub-install":
|
elif bootloader == "grub-install":
|
||||||
self.pacstrap('grub')
|
self.pacstrap('grub') # no need?
|
||||||
|
|
||||||
|
if real_device := self.detect_encryption(root_partition):
|
||||||
|
_file = "/etc/default/grub"
|
||||||
|
root_uuid = SysCommand(f"blkid -s UUID -o value {real_device.path}").decode().rstrip()
|
||||||
|
add_to_CMDLINE_LINUX = f"sed -i 's/GRUB_CMDLINE_LINUX=\"\"/GRUB_CMDLINE_LINUX=\"cryptdevice=UUID={root_uuid}:cryptlvm\"/'"
|
||||||
|
enable_CRYPTODISK = "sed -i 's/#GRUB_ENABLE_CRYPTODISK=y/GRUB_ENABLE_CRYPTODISK=y/'"
|
||||||
|
|
||||||
|
SysCommand(f"/usr/bin/arch-chroot {self.target} {add_to_CMDLINE_LINUX} {_file}")
|
||||||
|
SysCommand(f"/usr/bin/arch-chroot {self.target} {enable_CRYPTODISK} {_file}")
|
||||||
|
|
||||||
if has_uefi():
|
if has_uefi():
|
||||||
self.pacstrap('efibootmgr')
|
self.pacstrap('efibootmgr')
|
||||||
|
|
@ -532,10 +541,7 @@ class Installer:
|
||||||
self.helper_flags['bootloader'] = True
|
self.helper_flags['bootloader'] = True
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
root_device = subprocess.check_output(f'basename "$(readlink -f /sys/class/block/{root_partition.path.replace("/dev/", "")}/..)"', shell=True).decode().strip()
|
o = b''.join(SysCommand(f'/usr/bin/arch-chroot {self.target} grub-install --target=i386-pc --recheck {_device.path}'))
|
||||||
if root_device == "block":
|
|
||||||
root_device = f"{root_partition.path}"
|
|
||||||
o = b''.join(SysCommand(f'/usr/bin/arch-chroot {self.target} grub-install --target=i386-pc /dev/{root_device}'))
|
|
||||||
SysCommand('/usr/bin/arch-chroot /mnt grub-mkconfig -o /boot/grub/grub.cfg')
|
SysCommand('/usr/bin/arch-chroot /mnt grub-mkconfig -o /boot/grub/grub.cfg')
|
||||||
self.helper_flags['bootloader'] = True
|
self.helper_flags['bootloader'] = True
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -59,9 +59,7 @@ def filter_mirrors_by_region(regions, destination='/etc/pacman.d/mirrorlist', so
|
||||||
:param regions: A series of country codes separated by `,`. For instance `SE,US` for sweden and United States.
|
:param regions: A series of country codes separated by `,`. For instance `SE,US` for sweden and United States.
|
||||||
:type regions: str
|
:type regions: str
|
||||||
"""
|
"""
|
||||||
region_list = []
|
region_list = [f'country={region}' for region in regions.split(',')]
|
||||||
for region in regions.split(','):
|
|
||||||
region_list.append(f'country={region}')
|
|
||||||
response = urllib.request.urlopen(urllib.request.Request(f"https://archlinux.org/mirrorlist/?{'&'.join(region_list)}&protocol=https&protocol=http&ip_version=4&ip_version=6&use_mirror_status=on'", headers={'User-Agent': 'ArchInstall'}))
|
response = urllib.request.urlopen(urllib.request.Request(f"https://archlinux.org/mirrorlist/?{'&'.join(region_list)}&protocol=https&protocol=http&ip_version=4&ip_version=6&use_mirror_status=on'", headers={'User-Agent': 'ArchInstall'}))
|
||||||
new_list = response.read().replace(b"#Server", b"Server")
|
new_list = response.read().replace(b"#Server", b"Server")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,10 +46,7 @@ def find_packages(*names):
|
||||||
The function itself is rather slow, so consider not sending to
|
The function itself is rather slow, so consider not sending to
|
||||||
many packages to the search query.
|
many packages to the search query.
|
||||||
"""
|
"""
|
||||||
result = {}
|
return {package: find_package(package) for package in names}
|
||||||
for package in names:
|
|
||||||
result[package] = find_package(package)
|
|
||||||
return result
|
|
||||||
|
|
||||||
|
|
||||||
def validate_package_list(packages: list):
|
def validate_package_list(packages: list):
|
||||||
|
|
@ -57,11 +54,11 @@ def validate_package_list(packages: list):
|
||||||
Validates a list of given packages.
|
Validates a list of given packages.
|
||||||
Raises `RequirementError` if one or more packages are not found.
|
Raises `RequirementError` if one or more packages are not found.
|
||||||
"""
|
"""
|
||||||
invalid_packages = []
|
invalid_packages = [
|
||||||
for package in packages:
|
package
|
||||||
if not find_package(package)['results'] and not find_group(package):
|
for package in packages
|
||||||
invalid_packages.append(package)
|
if not find_package(package)['results'] and not find_group(package)
|
||||||
|
]
|
||||||
if invalid_packages:
|
if invalid_packages:
|
||||||
raise RequirementError(f"Invalid package names: {invalid_packages}")
|
raise RequirementError(f"Invalid package names: {invalid_packages}")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -406,13 +406,13 @@ def ask_to_configure_network():
|
||||||
# {MAC: Ifname}
|
# {MAC: Ifname}
|
||||||
interfaces = {
|
interfaces = {
|
||||||
'ISO-CONFIG': 'Copy ISO network configuration to installation',
|
'ISO-CONFIG': 'Copy ISO network configuration to installation',
|
||||||
'NetworkManager': 'Use NetworkManager to control and manage your internet connection',
|
'NetworkManager': 'Use NetworkManager (necessary to configure internet graphically in GNOME and KDE)',
|
||||||
**list_interfaces()
|
**list_interfaces()
|
||||||
}
|
}
|
||||||
|
|
||||||
nic = generic_select(interfaces, "Select one network interface to configure (leave blank to skip): ")
|
nic = generic_select(interfaces, "Select one network interface to configure (leave blank to skip): ")
|
||||||
if nic and nic != 'Copy ISO network configuration to installation':
|
if nic and nic != 'Copy ISO network configuration to installation':
|
||||||
if nic == 'Use NetworkManager to control and manage your internet connection':
|
if nic == 'Use NetworkManager (necessary to configure internet graphically in GNOME and KDE)':
|
||||||
return {'nic': nic, 'NetworkManager': True}
|
return {'nic': nic, 'NetworkManager': True}
|
||||||
|
|
||||||
# Current workaround:
|
# Current workaround:
|
||||||
|
|
@ -943,7 +943,8 @@ def select_driver(options=AVAILABLE_GFX_DRIVERS):
|
||||||
if has_nvidia_graphics():
|
if has_nvidia_graphics():
|
||||||
print('For the best compatibility with your Nvidia hardware, you may want to use the Nvidia proprietary driver.')
|
print('For the best compatibility with your Nvidia hardware, you may want to use the Nvidia proprietary driver.')
|
||||||
|
|
||||||
arguments['gfx_driver'] = generic_select(drivers, input_text="Select a graphics driver or leave blank to install all open-source drivers: ")
|
if not arguments.get('gfx_driver', None):
|
||||||
|
arguments['gfx_driver'] = generic_select(drivers, input_text="Select a graphics driver or leave blank to install all open-source drivers: ")
|
||||||
|
|
||||||
if arguments.get('gfx_driver', None) is None:
|
if arguments.get('gfx_driver', None) is None:
|
||||||
arguments['gfx_driver'] = "All open-source (default)"
|
arguments['gfx_driver'] = "All open-source (default)"
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,7 @@ sys.path.insert(0, os.path.abspath('..'))
|
||||||
|
|
||||||
def process_docstring(app, what, name, obj, options, lines):
|
def process_docstring(app, what, name, obj, options, lines):
|
||||||
spaces_pat = re.compile(r"( {8})")
|
spaces_pat = re.compile(r"( {8})")
|
||||||
ll = []
|
ll = [spaces_pat.sub(" ", line) for line in lines]
|
||||||
for line in lines:
|
|
||||||
ll.append(spaces_pat.sub(" ", line))
|
|
||||||
lines[:] = ll
|
lines[:] = ll
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,31 @@ archinstall.log(f"Graphics devices detected: {archinstall.graphics_devices().key
|
||||||
# For support reasons, we'll log the disk layout pre installation to match against post-installation layout
|
# For support reasons, we'll log the disk layout pre installation to match against post-installation layout
|
||||||
archinstall.log(f"Disk states before installing: {archinstall.disk_layouts()}", level=logging.DEBUG)
|
archinstall.log(f"Disk states before installing: {archinstall.disk_layouts()}", level=logging.DEBUG)
|
||||||
|
|
||||||
|
def load_config():
|
||||||
|
if archinstall.arguments.get('harddrives', None) is not None:
|
||||||
|
archinstall.arguments['harddrives'] = [archinstall.BlockDevice(BlockDev) for BlockDev in archinstall.arguments['harddrives'].split(',')]
|
||||||
|
# Temporarily disabling keep_partitions if config file is loaded
|
||||||
|
# Temporary workaround to make Desktop Environments work
|
||||||
|
if archinstall.arguments.get('profile', None) is not None:
|
||||||
|
if type(archinstall.arguments.get('profile', None)) is dict:
|
||||||
|
archinstall.arguments['profile'] = archinstall.Profile(None, archinstall.arguments.get('profile', None)['path'])
|
||||||
|
else:
|
||||||
|
archinstall.arguments['profile'] = archinstall.Profile(None, archinstall.arguments.get('profile', None))
|
||||||
|
archinstall.storage['_desktop_profile'] = archinstall.arguments.get('desktop-environment', None)
|
||||||
|
if archinstall.arguments.get('mirror-region', None) is not None:
|
||||||
|
if type(archinstall.arguments.get('mirror-region', None)) is dict:
|
||||||
|
archinstall.arguments['mirror-region'] = archinstall.arguments.get('mirror-region', None)
|
||||||
|
else:
|
||||||
|
selected_region = archinstall.arguments.get('mirror-region', None)
|
||||||
|
archinstall.arguments['mirror-region'] = {selected_region: archinstall.list_mirrors()[selected_region]}
|
||||||
|
if archinstall.arguments.get('sys-language', None) is not None:
|
||||||
|
archinstall.arguments['sys-language'] = archinstall.arguments.get('sys-language', 'en_US')
|
||||||
|
if archinstall.arguments.get('sys-encoding', None) is not None:
|
||||||
|
archinstall.arguments['sys-encoding'] = archinstall.arguments.get('sys-encoding', 'utf-8')
|
||||||
|
if archinstall.arguments.get('gfx_driver', None) is not None:
|
||||||
|
archinstall.storage['gfx_driver_packages'] = AVAILABLE_GFX_DRIVERS.get(archinstall.arguments.get('gfx_driver', None), None)
|
||||||
|
if archinstall.arguments.get('servers', None) is not None:
|
||||||
|
archinstall.storage['_selected_servers'] = archinstall.arguments.get('servers', None)
|
||||||
|
|
||||||
def ask_user_questions():
|
def ask_user_questions():
|
||||||
"""
|
"""
|
||||||
|
|
@ -56,9 +81,6 @@ def ask_user_questions():
|
||||||
break
|
break
|
||||||
except archinstall.RequirementError as e:
|
except archinstall.RequirementError as e:
|
||||||
archinstall.log(e, fg="red")
|
archinstall.log(e, fg="red")
|
||||||
else:
|
|
||||||
selected_region = archinstall.arguments['mirror-region']
|
|
||||||
archinstall.arguments['mirror-region'] = {selected_region: archinstall.list_mirrors()[selected_region]}
|
|
||||||
|
|
||||||
if not archinstall.arguments.get('sys-language', None) and archinstall.arguments.get('advanced', False):
|
if not archinstall.arguments.get('sys-language', None) and archinstall.arguments.get('advanced', False):
|
||||||
archinstall.arguments['sys-language'] = input("Enter a valid locale (language) for your OS, (Default: en_US): ").strip()
|
archinstall.arguments['sys-language'] = input("Enter a valid locale (language) for your OS, (Default: en_US): ").strip()
|
||||||
|
|
@ -109,21 +131,16 @@ def ask_user_questions():
|
||||||
|
|
||||||
|
|
||||||
# Ask for additional users (super-user if root pw was not set)
|
# Ask for additional users (super-user if root pw was not set)
|
||||||
archinstall.arguments['users'] = {}
|
if not archinstall.arguments.get('!root-password', None) and not archinstall.arguments.get('superusers', None):
|
||||||
archinstall.arguments['superusers'] = {}
|
|
||||||
if not archinstall.arguments.get('!root-password', None):
|
|
||||||
archinstall.arguments['superusers'] = archinstall.ask_for_superuser_account('Create a required super-user with sudo privileges: ', forced=True)
|
archinstall.arguments['superusers'] = archinstall.ask_for_superuser_account('Create a required super-user with sudo privileges: ', forced=True)
|
||||||
|
users, superusers = archinstall.ask_for_additional_users('Enter a username to create a additional user (leave blank to skip & continue): ')
|
||||||
users, superusers = archinstall.ask_for_additional_users('Enter a username to create a additional user (leave blank to skip & continue): ')
|
archinstall.arguments['users'] = users
|
||||||
archinstall.arguments['users'] = users
|
archinstall.arguments['superusers'] = {**archinstall.arguments['superusers'], **superusers}
|
||||||
archinstall.arguments['superusers'] = {**archinstall.arguments['superusers'], **superusers}
|
|
||||||
|
|
||||||
|
|
||||||
# Ask for archinstall-specific profiles (such as desktop environments etc)
|
# Ask for archinstall-specific profiles (such as desktop environments etc)
|
||||||
if not archinstall.arguments.get('profile', None):
|
if not archinstall.arguments.get('profile', None):
|
||||||
archinstall.arguments['profile'] = archinstall.select_profile()
|
archinstall.arguments['profile'] = archinstall.select_profile()
|
||||||
else:
|
|
||||||
archinstall.arguments['profile'] = Profile(installer=None, path=archinstall.arguments['profile'])
|
|
||||||
|
|
||||||
|
|
||||||
# Check the potentially selected profiles preparations to get early checks if some additional questions are needed.
|
# Check the potentially selected profiles preparations to get early checks if some additional questions are needed.
|
||||||
|
|
@ -196,7 +213,7 @@ def perform_filesystem_operations():
|
||||||
disk_layout_file.write(user_disk_layout)
|
disk_layout_file.write(user_disk_layout)
|
||||||
print()
|
print()
|
||||||
|
|
||||||
if archinstall.arguments.get('dry_run'):
|
if archinstall.arguments.get('dry-run'):
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
if not archinstall.arguments.get('silent'):
|
if not archinstall.arguments.get('silent'):
|
||||||
|
|
@ -230,8 +247,6 @@ def perform_installation(mountpoint):
|
||||||
Only requirement is that the block devices are
|
Only requirement is that the block devices are
|
||||||
formatted and setup prior to entering this function.
|
formatted and setup prior to entering this function.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
with archinstall.Installer(mountpoint, kernels=archinstall.arguments.get('kernels', 'linux')) as installation:
|
with archinstall.Installer(mountpoint, kernels=archinstall.arguments.get('kernels', 'linux')) as installation:
|
||||||
# Mount all the drives to the desired mountpoint
|
# Mount all the drives to the desired mountpoint
|
||||||
# This *can* be done outside of the installation, but the installer can deal with it.
|
# This *can* be done outside of the installation, but the installer can deal with it.
|
||||||
|
|
@ -254,7 +269,7 @@ def perform_installation(mountpoint):
|
||||||
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 has_uefi():
|
if archinstall.arguments["bootloader"] == "grub-install" and has_uefi():
|
||||||
installation.add_additional_packages("grub")
|
installation.add_additional_packages("grub")
|
||||||
installation.add_bootloader(archinstall.arguments["bootloader"])
|
installation.add_bootloader(archinstall.arguments["harddrive"], 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
|
||||||
|
|
@ -339,36 +354,9 @@ if not check_mirror_reachable():
|
||||||
archinstall.log(f"Arch Linux mirrors are not reachable. Please check your internet connection and the log file '{log_file}'.", level=logging.INFO, fg="red")
|
archinstall.log(f"Arch Linux mirrors are not reachable. Please check your internet connection and the log file '{log_file}'.", level=logging.INFO, fg="red")
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
|
load_config()
|
||||||
if not archinstall.arguments.get('silent'):
|
if not archinstall.arguments.get('silent'):
|
||||||
ask_user_questions()
|
ask_user_questions()
|
||||||
else:
|
|
||||||
# Workarounds if config is loaded from a file
|
|
||||||
# The harddrive section should be moved to perform_installation_steps, where it's actually being performed
|
|
||||||
# Blockdevice object should be created in perform_installation_steps
|
|
||||||
# This needs to be done until then
|
|
||||||
archinstall.arguments['harddrive'] = archinstall.BlockDevice(path=archinstall.arguments['harddrive']['path'])
|
|
||||||
# Temporarily disabling keep_partitions if config file is loaded
|
|
||||||
archinstall.arguments['harddrive'].keep_partitions = False
|
|
||||||
# Temporary workaround to make Desktop Environments work
|
|
||||||
if archinstall.arguments.get('profile', None) is not None:
|
|
||||||
if type(archinstall.arguments.get('profile', None)) is dict:
|
|
||||||
archinstall.arguments['profile'] = archinstall.Profile(None, archinstall.arguments.get('profile', None)['path'])
|
|
||||||
else:
|
|
||||||
archinstall.arguments['profile'] = archinstall.Profile(None, archinstall.arguments.get('profile', None))
|
|
||||||
else:
|
|
||||||
archinstall.arguments['profile'] = None
|
|
||||||
|
|
||||||
if archinstall.arguments.get('mirror-region', None) is not None:
|
|
||||||
if type(archinstall.arguments.get('mirror-region', None)) is dict:
|
|
||||||
archinstall.arguments['mirror-region'] = archinstall.arguments.get('mirror-region', None)
|
|
||||||
else:
|
|
||||||
selected_region = archinstall.arguments.get('mirror-region', None)
|
|
||||||
archinstall.arguments['mirror-region'] = {selected_region: archinstall.list_mirrors()[selected_region]}
|
|
||||||
archinstall.arguments['sys-language'] = archinstall.arguments.get('sys-language', 'en_US')
|
|
||||||
archinstall.arguments['sys-encoding'] = archinstall.arguments.get('sys-encoding', 'utf-8')
|
|
||||||
|
|
||||||
if archinstall.arguments.get('gfx_driver', None) is not None:
|
|
||||||
archinstall.storage['gfx_driver_packages'] = AVAILABLE_GFX_DRIVERS.get(archinstall.arguments.get('gfx_driver', None), None)
|
|
||||||
|
|
||||||
perform_filesystem_operations()
|
perform_filesystem_operations()
|
||||||
perform_installation(archinstall.storage.get('MOUNT_POINT', '/mnt'))
|
perform_installation(archinstall.storage.get('MOUNT_POINT', '/mnt'))
|
||||||
|
|
@ -9,7 +9,7 @@ __packages__ = [
|
||||||
"deepin-terminal",
|
"deepin-terminal",
|
||||||
"deepin-editor",
|
"deepin-editor",
|
||||||
"lightdm",
|
"lightdm",
|
||||||
"lightdm-gtk-greeter",
|
"lightdm-deepin-greeter",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,12 +50,11 @@ def _prep_function(*args, **kwargs):
|
||||||
# Temporarily store the selected desktop profile
|
# Temporarily store the selected desktop profile
|
||||||
# in a session-safe location, since this module will get reloaded
|
# in a session-safe location, since this module will get reloaded
|
||||||
# the next time it gets executed.
|
# the next time it gets executed.
|
||||||
if '_desktop_profile' not in archinstall.storage.keys():
|
if not archinstall.storage.get('_desktop_profile', None):
|
||||||
archinstall.storage['_desktop_profile'] = desktop
|
archinstall.storage['_desktop_profile'] = desktop
|
||||||
|
if not archinstall.arguments.get('desktop-environment', None):
|
||||||
|
archinstall.arguments['desktop-environment'] = desktop
|
||||||
profile = archinstall.Profile(None, desktop)
|
profile = archinstall.Profile(None, desktop)
|
||||||
# Set the resolved profile path to the actual desktop environment
|
|
||||||
archinstall.arguments['profile'] = profile
|
|
||||||
# Loading the instructions with a custom namespace, ensures that a __name__ comparison is never triggered.
|
# Loading the instructions with a custom namespace, ensures that a __name__ comparison is never triggered.
|
||||||
with profile.load_instructions(namespace=f"{desktop}.py") as imported:
|
with profile.load_instructions(namespace=f"{desktop}.py") as imported:
|
||||||
if hasattr(imported, '_prep_function'):
|
if hasattr(imported, '_prep_function'):
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,9 @@ def _prep_function(*args, **kwargs):
|
||||||
Magic function called by the importing installer
|
Magic function called by the importing installer
|
||||||
before continuing any further.
|
before continuing any further.
|
||||||
"""
|
"""
|
||||||
selected_servers = archinstall.generic_multi_select(available_servers, "Choose which servers to install and enable (leave blank for a minimal installation): ")
|
if not archinstall.storage.get('_selected_servers', None):
|
||||||
archinstall.storage['_selected_servers'] = selected_servers
|
selected_servers = archinstall.generic_multi_select(available_servers, "Choose which servers to install and enable (leave blank for a minimal installation): ")
|
||||||
|
archinstall.storage['_selected_servers'] = selected_servers
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue