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
|
# 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.
|
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/)
|
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)*.
|
||||||
*(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.
|
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_create('devel', 'devel')
|
||||||
installation.user_set_pw('root', 'airoot')
|
installation.user_set_pw('root', 'airoot')
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
This installer will perform the following:
|
This installer will perform the following:
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import os
|
import os
|
||||||
|
from functools import partial
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Iterator, Optional, Union
|
from typing import Iterator, Optional, Union
|
||||||
|
|
||||||
|
|
@ -75,12 +76,10 @@ def cpuinfo() -> Iterator[dict[str, str]]:
|
||||||
cpu[key.strip()] = value.strip()
|
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
|
"""Returns a dict with memory info if called with no args
|
||||||
or the value of the given key of said dict.
|
or the value of the given key of said dict.
|
||||||
"""
|
"""
|
||||||
mem_info = {}
|
|
||||||
|
|
||||||
with MEMINFO.open() as file:
|
with MEMINFO.open() as file:
|
||||||
mem_info = {
|
mem_info = {
|
||||||
(columns := line.strip().split())[0].rstrip(':'): int(columns[1])
|
(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()
|
return 'WIRELESS' in enrich_iface_types(list_interfaces().values()).values()
|
||||||
|
|
||||||
|
|
||||||
def has_amd_cpu() -> bool:
|
def has_cpu_vendor(vendor_id: str) -> bool:
|
||||||
return any(cpu.get("vendor_id") == "AuthenticAMD" for cpu in cpuinfo())
|
return any(cpu.get("vendor_id") == vendor_id for cpu in cpuinfo())
|
||||||
|
|
||||||
def has_intel_cpu() -> bool:
|
has_amd_cpu = partial(has_cpu_vendor, "AuthenticAMD")
|
||||||
return any(cpu.get("vendor_id") == "GenuineIntel" for cpu in cpuinfo())
|
has_intel_cpu = partial(has_cpu_vendor, "GenuineIntel")
|
||||||
|
|
||||||
def has_uefi() -> bool:
|
def has_uefi() -> bool:
|
||||||
return os.path.isdir('/sys/firmware/efi')
|
return os.path.isdir('/sys/firmware/efi')
|
||||||
|
|
@ -152,15 +151,15 @@ def product_name() -> Optional[str]:
|
||||||
return product.read().strip()
|
return product.read().strip()
|
||||||
|
|
||||||
|
|
||||||
def mem_available() -> Optional[str]:
|
def mem_available() -> Optional[int]:
|
||||||
return meminfo('MemAvailable')
|
return meminfo('MemAvailable')
|
||||||
|
|
||||||
|
|
||||||
def mem_free() -> Optional[str]:
|
def mem_free() -> Optional[int]:
|
||||||
return meminfo('MemFree')
|
return meminfo('MemFree')
|
||||||
|
|
||||||
|
|
||||||
def mem_total() -> Optional[str]:
|
def mem_total() -> Optional[int]:
|
||||||
return meminfo('MemTotal')
|
return meminfo('MemTotal')
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import urllib.error
|
import urllib.error
|
||||||
import urllib.request
|
import urllib.request
|
||||||
from typing import Union
|
from typing import Union, Mapping, Iterable
|
||||||
|
|
||||||
from .general import *
|
from .general import *
|
||||||
from .output import log
|
from .output import log
|
||||||
|
|
@ -113,22 +113,31 @@ def insert_mirrors(mirrors, *args, **kwargs):
|
||||||
return True
|
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)
|
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:
|
for mirror in mirrors:
|
||||||
mirrorlist.write(f'## {region}\n')
|
mirrorlist.write(f'## {region}\n')
|
||||||
mirrorlist.write(f'Server = {mirror}\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
|
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"]):
|
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"
|
url = "https://archlinux.org/mirrorlist/?protocol=https&protocol=http&ip_version=4&ip_version=6&use_mirror_status=on"
|
||||||
regions = {}
|
regions = {}
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,7 @@ class Boot:
|
||||||
self.session = SysCommandWorker([
|
self.session = SysCommandWorker([
|
||||||
'/usr/bin/systemd-nspawn',
|
'/usr/bin/systemd-nspawn',
|
||||||
'-D', self.instance.target,
|
'-D', self.instance.target,
|
||||||
|
'--timezone=off',
|
||||||
'-b',
|
'-b',
|
||||||
'--machine', self.container_name
|
'--machine', self.container_name
|
||||||
])
|
])
|
||||||
|
|
|
||||||
|
|
@ -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'):
|
if input(f"{block_device} contains queued partitions, this will remove those, are you sure? y/N: ").strip().lower() in ('', 'n'):
|
||||||
continue
|
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:
|
elif task is None:
|
||||||
return block_device_struct
|
return block_device_struct
|
||||||
else:
|
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)
|
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":
|
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):
|
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'] = {}
|
block_device_struct["partitions"][block_device_struct["partitions"].index(partition)]['filesystem'] = {}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ is_top_level_profile = False
|
||||||
__packages__ = [
|
__packages__ = [
|
||||||
"cutefish",
|
"cutefish",
|
||||||
"noto-fonts",
|
"noto-fonts",
|
||||||
"konsole",
|
|
||||||
"sddm"
|
"sddm"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ __packages__ = [
|
||||||
"lightdm",
|
"lightdm",
|
||||||
"lightdm-gtk-greeter",
|
"lightdm-gtk-greeter",
|
||||||
"gvfs",
|
"gvfs",
|
||||||
|
"network-manager-applet",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@ __packages__ = [
|
||||||
'xorg-server',
|
'xorg-server',
|
||||||
'xorg-xinit',
|
'xorg-xinit',
|
||||||
'nvidia-dkms',
|
'nvidia-dkms',
|
||||||
'xorg-server',
|
|
||||||
*archinstall.lib.hardware.__packages__,
|
*archinstall.lib.hardware.__packages__,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue