Merge branch 'master' of https://github.com/archlinux/archinstall into torxed-fix-93
This commit is contained in:
commit
2a2239dd03
|
|
@ -1,8 +1,7 @@
|
|||
# Contributing to archinstall
|
||||
|
||||
Any contributions through pull requests are welcome as this project aims to be a community based project to ease some Arch Linux installation steps.
|
||||
Bear in mind that in the future this repo might be transferred to the official [GitLab repo under Arch Linux](http://gitlab.archlinux.org/archlinux/)
|
||||
*(if GitLab becomes open to the general public)*.
|
||||
Bear in mind that in the future this repo might be transferred to the official [GitLab repo under Arch Linux](http://gitlab.archlinux.org/archlinux/) *(if GitLab becomes open to the general public)*.
|
||||
|
||||
Therefore, guidelines and style changes to the code might come into effect as well as guidelines surrounding bug reporting and discussions.
|
||||
|
||||
|
|
|
|||
|
|
@ -106,7 +106,6 @@ with archinstall.Installer('/mnt') as installation:
|
|||
|
||||
installation.user_create('devel', 'devel')
|
||||
installation.user_set_pw('root', 'airoot')
|
||||
|
||||
```
|
||||
|
||||
This installer will perform the following:
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import os
|
||||
from functools import partial
|
||||
from pathlib import Path
|
||||
from typing import Iterator, Optional, Union
|
||||
|
||||
|
|
@ -75,12 +76,10 @@ def cpuinfo() -> Iterator[dict[str, str]]:
|
|||
cpu[key.strip()] = value.strip()
|
||||
|
||||
|
||||
def meminfo(key: Optional[str] = None) -> Union[dict[str, int], int]:
|
||||
def meminfo(key: Optional[str] = None) -> Union[dict[str, int], Optional[int]]:
|
||||
"""Returns a dict with memory info if called with no args
|
||||
or the value of the given key of said dict.
|
||||
"""
|
||||
mem_info = {}
|
||||
|
||||
with MEMINFO.open() as file:
|
||||
mem_info = {
|
||||
(columns := line.strip().split())[0].rstrip(':'): int(columns[1])
|
||||
|
|
@ -97,11 +96,11 @@ def has_wifi() -> bool:
|
|||
return 'WIRELESS' in enrich_iface_types(list_interfaces().values()).values()
|
||||
|
||||
|
||||
def has_amd_cpu() -> bool:
|
||||
return any(cpu.get("vendor_id") == "AuthenticAMD" for cpu in cpuinfo())
|
||||
def has_cpu_vendor(vendor_id: str) -> bool:
|
||||
return any(cpu.get("vendor_id") == vendor_id for cpu in cpuinfo())
|
||||
|
||||
def has_intel_cpu() -> bool:
|
||||
return any(cpu.get("vendor_id") == "GenuineIntel" for cpu in cpuinfo())
|
||||
has_amd_cpu = partial(has_cpu_vendor, "AuthenticAMD")
|
||||
has_intel_cpu = partial(has_cpu_vendor, "GenuineIntel")
|
||||
|
||||
def has_uefi() -> bool:
|
||||
return os.path.isdir('/sys/firmware/efi')
|
||||
|
|
@ -152,15 +151,15 @@ def product_name() -> Optional[str]:
|
|||
return product.read().strip()
|
||||
|
||||
|
||||
def mem_available() -> Optional[str]:
|
||||
def mem_available() -> Optional[int]:
|
||||
return meminfo('MemAvailable')
|
||||
|
||||
|
||||
def mem_free() -> Optional[str]:
|
||||
def mem_free() -> Optional[int]:
|
||||
return meminfo('MemFree')
|
||||
|
||||
|
||||
def mem_total() -> Optional[str]:
|
||||
def mem_total() -> Optional[int]:
|
||||
return meminfo('MemTotal')
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import urllib.error
|
||||
import urllib.request
|
||||
from typing import Union
|
||||
from typing import Union, Mapping, Iterable
|
||||
|
||||
from .general import *
|
||||
from .output import log
|
||||
|
|
@ -113,22 +113,31 @@ def insert_mirrors(mirrors, *args, **kwargs):
|
|||
return True
|
||||
|
||||
|
||||
def use_mirrors(regions: dict, destination='/etc/pacman.d/mirrorlist'):
|
||||
def use_mirrors(
|
||||
regions: Mapping[str, Iterable[str]],
|
||||
destination: str ='/etc/pacman.d/mirrorlist'
|
||||
) -> None:
|
||||
log(f'A new package mirror-list has been created: {destination}', level=logging.INFO)
|
||||
for region, mirrors in regions.items():
|
||||
with open(destination, 'w') as mirrorlist:
|
||||
with open(destination, 'w') as mirrorlist:
|
||||
for region, mirrors in regions.items():
|
||||
for mirror in mirrors:
|
||||
mirrorlist.write(f'## {region}\n')
|
||||
mirrorlist.write(f'Server = {mirror}\n')
|
||||
|
||||
|
||||
def re_rank_mirrors(
|
||||
top: int = 10,
|
||||
src: str = '/etc/pacman.d/mirrorlist',
|
||||
dst: str = '/etc/pacman.d/mirrorlist',
|
||||
) -> bool:
|
||||
cmd = SysCommand(f"/usr/bin/rankmirrors -n {top} {src}")
|
||||
if cmd.exit_code != 0:
|
||||
return False
|
||||
with open(dst, 'w') as f:
|
||||
f.write(str(cmd))
|
||||
return True
|
||||
|
||||
|
||||
def re_rank_mirrors(top=10, *positionals, **kwargs):
|
||||
if SysCommand(f'/usr/bin/rankmirrors -n {top} /etc/pacman.d/mirrorlist > /etc/pacman.d/mirrorlist').exit_code == 0:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def list_mirrors(sort_order=["https", "http"]):
|
||||
url = "https://archlinux.org/mirrorlist/?protocol=https&protocol=http&ip_version=4&ip_version=6&use_mirror_status=on"
|
||||
regions = {}
|
||||
|
|
|
|||
|
|
@ -98,4 +98,4 @@ def load_plugin(path :str): # -> module (not sure how to write that in type defi
|
|||
log(err, level=logging.ERROR)
|
||||
log(f"The above error was detected when initiating the plugin: {path}", fg="red", level=logging.ERROR)
|
||||
else:
|
||||
log(f"Plugin '{path}' is missing a valid entry-point or is corrupt.", fg="yellow", level=logging.WARNING)
|
||||
log(f"Plugin '{path}' is missing a valid entry-point or is corrupt.", fg="yellow", level=logging.WARNING)
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ class Boot:
|
|||
self.session = SysCommandWorker([
|
||||
'/usr/bin/systemd-nspawn',
|
||||
'-D', self.instance.target,
|
||||
'--timezone=off',
|
||||
'-b',
|
||||
'--machine', self.container_name
|
||||
])
|
||||
|
|
|
|||
|
|
@ -575,14 +575,14 @@ def manage_new_and_existing_partitions(block_device :BlockDevice) -> dict:
|
|||
# log(f"Selecting which partitions to re-use on {block_device}...", fg="yellow", level=logging.INFO)
|
||||
# partitions = generic_multi_select(block_device.partitions.values(), "Select which partitions to re-use (the rest will be left alone): ", sort=True)
|
||||
# partitions_to_wipe = generic_multi_select(partitions, "Which partitions do you wish to wipe (multiple can be selected): ", sort=True)
|
||||
|
||||
|
||||
# mountpoints = {}
|
||||
# struct = {
|
||||
# "partitions" : []
|
||||
# }
|
||||
# for partition in partitions:
|
||||
# mountpoint = input(f"Select a mountpoint (or skip) for {partition}: ").strip()
|
||||
|
||||
|
||||
# part_struct = {}
|
||||
# if mountpoint:
|
||||
# part_struct['mountpoint'] = mountpoint
|
||||
|
|
@ -590,7 +590,7 @@ def manage_new_and_existing_partitions(block_device :BlockDevice) -> dict:
|
|||
# part_struct['boot'] = True
|
||||
# if has_uefi():
|
||||
# part_struct['ESP'] = True
|
||||
# elif mountpoint == '/' and
|
||||
# elif mountpoint == '/' and
|
||||
# if partition.uuid:
|
||||
# part_struct['PARTUUID'] = partition.uuid
|
||||
# if partition in partitions_to_wipe:
|
||||
|
|
@ -632,15 +632,15 @@ def manage_new_and_existing_partitions(block_device :BlockDevice) -> dict:
|
|||
|
||||
if not task:
|
||||
break
|
||||
|
||||
|
||||
if task == 'Create a new partition':
|
||||
if partition_type == 'gpt':
|
||||
# https://www.gnu.org/software/parted/manual/html_node/mkpart.html
|
||||
# https://www.gnu.org/software/parted/manual/html_node/mklabel.html
|
||||
name = input("Enter a desired name for the partition: ").strip()
|
||||
|
||||
|
||||
fstype = input("Enter a desired filesystem type for the partition: ").strip()
|
||||
|
||||
|
||||
start = input(f"Enter the start sector (percentage or block number, default: {block_device.largest_free_space[0]}): ").strip()
|
||||
if not start.strip():
|
||||
start = block_device.largest_free_space[0]
|
||||
|
|
@ -674,7 +674,7 @@ def manage_new_and_existing_partitions(block_device :BlockDevice) -> dict:
|
|||
if input(f"{block_device} contains queued partitions, this will remove those, are you sure? y/N: ").strip().lower() in ('', 'n'):
|
||||
continue
|
||||
|
||||
block_device_struct["partitions"] = suggest_single_disk_layout(block_device)[block_device]
|
||||
block_device_struct.update( suggest_single_disk_layout(block_device)[block_device.path] )
|
||||
elif task is None:
|
||||
return block_device_struct
|
||||
else:
|
||||
|
|
@ -730,7 +730,10 @@ def manage_new_and_existing_partitions(block_device :BlockDevice) -> dict:
|
|||
block_device_struct["partitions"][block_device_struct["partitions"].index(partition)]['boot'] = not block_device_struct["partitions"][block_device_struct["partitions"].index(partition)].get('boot', False)
|
||||
|
||||
elif task == "Set desired filesystem for a partition":
|
||||
if (partition := generic_select(block_device_struct["partitions"], 'Select which partition to set a filesystem on: ', options_output=False)):
|
||||
if not block_device_struct["partitions"]:
|
||||
log("No partitions found. Create some partitions first", level=logging.WARNING, fg='yellow')
|
||||
continue
|
||||
elif (partition := generic_select(block_device_struct["partitions"], 'Select which partition to set a filesystem on: ', options_output=False)):
|
||||
if not block_device_struct["partitions"][block_device_struct["partitions"].index(partition)].get('filesystem', None):
|
||||
block_device_struct["partitions"][block_device_struct["partitions"].index(partition)]['filesystem'] = {}
|
||||
|
||||
|
|
@ -750,7 +753,7 @@ def select_individual_blockdevice_usage(block_devices :list):
|
|||
|
||||
for device in block_devices:
|
||||
layout = manage_new_and_existing_partitions(device)
|
||||
|
||||
|
||||
result[device.path] = layout
|
||||
|
||||
return result
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ def load_config():
|
|||
archinstall.storage['disk_layouts'] = json.loads(archinstall.arguments['disk_layouts'])
|
||||
except:
|
||||
raise ValueError("--disk_layouts=<json> needs either a JSON file or a JSON string given with a valid disk layout.")
|
||||
|
||||
|
||||
def ask_user_questions():
|
||||
"""
|
||||
First, we'll ask the user for a bunch of user input.
|
||||
|
|
@ -371,4 +371,4 @@ if not archinstall.arguments.get('silent'):
|
|||
ask_user_questions()
|
||||
|
||||
perform_filesystem_operations()
|
||||
perform_installation(archinstall.storage.get('MOUNT_POINT', '/mnt'))
|
||||
perform_installation(archinstall.storage.get('MOUNT_POINT', '/mnt'))
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ is_top_level_profile = False
|
|||
__packages__ = [
|
||||
"cutefish",
|
||||
"noto-fonts",
|
||||
"konsole",
|
||||
"sddm"
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ __packages__ = [
|
|||
"lightdm",
|
||||
"lightdm-gtk-greeter",
|
||||
"gvfs",
|
||||
"network-manager-applet",
|
||||
]
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ __packages__ = [
|
|||
'xorg-server',
|
||||
'xorg-xinit',
|
||||
'nvidia-dkms',
|
||||
'xorg-server',
|
||||
*archinstall.lib.hardware.__packages__,
|
||||
]
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue