Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Hvornum <anton@hvornum.se>2021-10-30 20:36:21 +0200
committerAnton Hvornum <anton@hvornum.se>2021-10-30 20:36:21 +0200
commit2a2239dd03bb64d3410469fd190fed34b252cf53 (patch)
tree6b47a27bb6286880e497c5e7c7bd2f0d8848c0ec
parent62f5bf4c8387f9f7591f1e1100067545b10f9b24 (diff)
parentd25a20a7f28dcd873747c2a2842504c919b6e884 (diff)
Merge branch 'master' of https://github.com/archlinux/archinstall into torxed-fix-93
-rw-r--r--CONTRIBUTING.md3
-rw-r--r--README.md1
-rw-r--r--archinstall/lib/hardware.py19
-rw-r--r--archinstall/lib/mirrors.py27
-rw-r--r--archinstall/lib/plugins.py2
-rw-r--r--archinstall/lib/systemd.py1
-rw-r--r--archinstall/lib/user_interaction.py21
-rw-r--r--examples/guided.py4
-rw-r--r--profiles/cutefish.py1
-rw-r--r--profiles/xfce4.py1
-rw-r--r--profiles/xorg.py1
-rw-r--r--setup.cfg2
12 files changed, 46 insertions, 37 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index a92cff91..ca4aa9e3 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -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.
diff --git a/README.md b/README.md
index 5c6c9157..c8a23f5a 100644
--- a/README.md
+++ b/README.md
@@ -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:
diff --git a/archinstall/lib/hardware.py b/archinstall/lib/hardware.py
index a8f87b80..bbfb06a9 100644
--- a/archinstall/lib/hardware.py
+++ b/archinstall/lib/hardware.py
@@ -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')
diff --git a/archinstall/lib/mirrors.py b/archinstall/lib/mirrors.py
index 1b62a61b..ed34b5d5 100644
--- a/archinstall/lib/mirrors.py
+++ b/archinstall/lib/mirrors.py
@@ -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,20 +113,29 @@ 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')
- 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 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 list_mirrors(sort_order=["https", "http"]):
diff --git a/archinstall/lib/plugins.py b/archinstall/lib/plugins.py
index 24fbd8ee..dab5d2b0 100644
--- a/archinstall/lib/plugins.py
+++ b/archinstall/lib/plugins.py
@@ -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) \ No newline at end of file
+ log(f"Plugin '{path}' is missing a valid entry-point or is corrupt.", fg="yellow", level=logging.WARNING)
diff --git a/archinstall/lib/systemd.py b/archinstall/lib/systemd.py
index 383f1f17..d297c507 100644
--- a/archinstall/lib/systemd.py
+++ b/archinstall/lib/systemd.py
@@ -64,6 +64,7 @@ class Boot:
self.session = SysCommandWorker([
'/usr/bin/systemd-nspawn',
'-D', self.instance.target,
+ '--timezone=off',
'-b',
'--machine', self.container_name
])
diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py
index 6854ccfd..ba6259b1 100644
--- a/archinstall/lib/user_interaction.py
+++ b/archinstall/lib/user_interaction.py
@@ -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
diff --git a/examples/guided.py b/examples/guided.py
index f8791c9b..60539a0b 100644
--- a/examples/guided.py
+++ b/examples/guided.py
@@ -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')) \ No newline at end of file
+perform_installation(archinstall.storage.get('MOUNT_POINT', '/mnt'))
diff --git a/profiles/cutefish.py b/profiles/cutefish.py
index 1df2467a..486fa389 100644
--- a/profiles/cutefish.py
+++ b/profiles/cutefish.py
@@ -7,7 +7,6 @@ is_top_level_profile = False
__packages__ = [
"cutefish",
"noto-fonts",
- "konsole",
"sddm"
]
diff --git a/profiles/xfce4.py b/profiles/xfce4.py
index ef0ddf2f..89c04f7c 100644
--- a/profiles/xfce4.py
+++ b/profiles/xfce4.py
@@ -11,6 +11,7 @@ __packages__ = [
"lightdm",
"lightdm-gtk-greeter",
"gvfs",
+ "network-manager-applet",
]
diff --git a/profiles/xorg.py b/profiles/xorg.py
index b8f33068..b76227ed 100644
--- a/profiles/xorg.py
+++ b/profiles/xorg.py
@@ -11,7 +11,6 @@ __packages__ = [
'xorg-server',
'xorg-xinit',
'nvidia-dkms',
- 'xorg-server',
*archinstall.lib.hardware.__packages__,
]
diff --git a/setup.cfg b/setup.cfg
index e5d79ef3..661c2cf6 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -29,7 +29,7 @@ include =
archinstall.*
[options.package_data]
-archinstall =
+archinstall =
examples/*.py
profiles/*.py
profiles/applications/*.py