Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--archinstall/__init__.py2
-rw-r--r--archinstall/__main__.py11
-rw-r--r--archinstall/lib/disk.py25
-rw-r--r--archinstall/lib/general.py44
-rw-r--r--archinstall/lib/installer.py16
-rw-r--r--archinstall/lib/luks.py8
-rw-r--r--archinstall/lib/mirrors.py8
-rw-r--r--archinstall/lib/networking.py4
-rw-r--r--archinstall/lib/packages.py2
-rw-r--r--archinstall/lib/profiles.py2
-rw-r--r--archinstall/lib/services.py5
-rw-r--r--archinstall/lib/tts.py0
-rw-r--r--archinstall/lib/user_interaction.py4
-rw-r--r--docs/archinstall/Application.rst2
-rw-r--r--docs/archinstall/Profile.rst2
-rw-r--r--docs/conf.py29
-rw-r--r--docs/examples/python.rst2
-rw-r--r--docs/installing/guided.rst6
-rw-r--r--docs/installing/python.rst2
-rw-r--r--examples/guided.py26
-rw-r--r--examples/minimal.py4
-rw-r--r--profiles/52-54-00-12-34-56.py17
-rw-r--r--profiles/applications/awesome.py15
-rw-r--r--profiles/awesome.py34
-rw-r--r--profiles/gnome.py4
-rw-r--r--profiles/kde.py2
-rw-r--r--profiles/xorg.py2
28 files changed, 164 insertions, 116 deletions
diff --git a/README.md b/README.md
index c2f053b2..8d574369 100644
--- a/README.md
+++ b/README.md
@@ -17,7 +17,7 @@ Or simply `git clone` the repo as it has no external dependencies *(but there ar
Or run the pre-compiled binary attached in every release as `archinstall-v[ver].tar.gz`.
There's also `PKGBUILD`'s for all the above scenarios.
-And they're also availale as Arch Linux packages over at the unofficial mirror [https://archlinux.life](https://archlinux.life/).
+And they're also available as Arch Linux packages over at the unofficial mirror [https://archlinux.life](https://archlinux.life/).
## Running the [guided](examples/guided.py) installer
diff --git a/archinstall/__init__.py b/archinstall/__init__.py
index a05b8e95..174c6885 100644
--- a/archinstall/__init__.py
+++ b/archinstall/__init__.py
@@ -11,4 +11,4 @@ from .lib.locale_helpers import *
from .lib.services import *
from .lib.packages import *
from .lib.output import *
-from .lib.storage import * \ No newline at end of file
+from .lib.storage import *
diff --git a/archinstall/__main__.py b/archinstall/__main__.py
index fd536258..fe4a3732 100644
--- a/archinstall/__main__.py
+++ b/archinstall/__main__.py
@@ -21,7 +21,7 @@ def find_examples():
def run_as_a_module():
"""
- Ssince we're running this as a 'python -m archinstall' module OR
+ Since we're running this as a 'python -m archinstall' module OR
a nuitka3 compiled version of the project.
This function and the file __main__ acts as a entry point.
"""
@@ -30,14 +30,17 @@ def run_as_a_module():
profile = sys.argv[1]
library = find_examples()
- if not f'{profile}.py' in library:
+ if f'{profile}.py' not in library:
raise ProfileNotFound(f'Could not locate {profile}.py among the example files.')
# Import and execute the chosen `<profile>.py`:
- spec = importlib.util.spec_from_file_location(library[f'{profile}.py'], library[f'{profile}.py'])
+ spec = importlib.util.spec_from_file_location(
+ library[f"{profile}.py"],
+ library[f"{profile}.py"]
+ )
imported_path = importlib.util.module_from_spec(spec)
spec.loader.exec_module(imported_path)
sys.modules[library[f'{profile}.py']] = imported_path
if __name__ == '__main__':
- run_as_a_module() \ No newline at end of file
+ run_as_a_module()
diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py
index b11f2318..0d0285d2 100644
--- a/archinstall/lib/disk.py
+++ b/archinstall/lib/disk.py
@@ -1,6 +1,6 @@
import glob, re, os, json
from collections import OrderedDict
-from .exceptions import *
+from .exceptions import DiskError
from .general import *
ROOT_DIR_PATTERN = re.compile('^.*?/devices')
@@ -21,7 +21,7 @@ class BlockDevice():
return f"BlockDevice({self.device})"
def __getitem__(self, key, *args, **kwargs):
- if not key in self.info:
+ if key not in self.info:
raise KeyError(f'{self} does not contain information: "{key}"')
return self.info[key]
@@ -37,9 +37,9 @@ class BlockDevice():
def __dump__(self):
return {
- 'path' : self.path,
- 'info' : self.info,
- 'partition_cache' : self.part_cache
+ 'path': self.path,
+ 'info': self.info,
+ 'partition_cache': self.part_cache
}
@property
@@ -50,7 +50,8 @@ class BlockDevice():
If it's a ATA-drive it returns the /dev/X device
And if it's a crypto-device it returns the parent device
"""
- if not 'type' in self.info: raise DiskError(f'Could not locate backplane info for "{self.path}"')
+ if "type" not in self.info:
+ raise DiskError(f'Could not locate backplane info for "{self.path}"')
if self.info['type'] == 'loop':
for drive in json.loads(b''.join(sys_command(f'losetup --json', hide_from_log=True)).decode('UTF_8'))['loopdevices']:
@@ -60,7 +61,8 @@ class BlockDevice():
elif self.info['type'] == 'disk':
return self.path
elif self.info['type'] == 'crypt':
- if not 'pkname' in self.info: raise DiskError(f'A crypt device ({self.path}) without a parent kernel device name.')
+ if 'pkname' not in self.info:
+ raise DiskError(f'A crypt device ({self.path}) without a parent kernel device name.')
return f"/dev/{self.info['pkname']}"
# if not stat.S_ISBLK(os.stat(full_path).st_mode):
@@ -97,7 +99,8 @@ class BlockDevice():
class Partition():
def __init__(self, path, part_id=None, size=-1, filesystem=None, mountpoint=None, encrypted=False):
- if not part_id: part_id = os.path.basename(path)
+ if not part_id:
+ part_id = os.path.basename(path)
self.path = path
self.part_id = part_id
self.mountpoint = mountpoint
@@ -115,7 +118,7 @@ class Partition():
log(f'Formatting {self} -> {filesystem}')
if filesystem == 'btrfs':
o = b''.join(sys_command(f'/usr/bin/mkfs.btrfs -f {self.path}'))
- if not b'UUID' in o:
+ if b'UUID' not in o:
raise DiskError(f'Could not format {self.path} with {filesystem} because: {o}')
self.filesystem = 'btrfs'
elif filesystem == 'fat32':
@@ -244,11 +247,11 @@ def device_state(name, *args, **kwargs):
# lsblk --json -l -n -o path
def all_disks(*args, **kwargs):
- if not 'partitions' in kwargs: kwargs['partitions'] = False
+ kwargs.setdefault("partitions", False)
drives = OrderedDict()
#for drive in json.loads(sys_command(f'losetup --json', *args, **lkwargs, hide_from_log=True)).decode('UTF_8')['loopdevices']:
for drive in json.loads(b''.join(sys_command(f'lsblk --json -l -n -o path,size,type,mountpoint,label,pkname', *args, **kwargs, hide_from_log=True)).decode('UTF_8'))['blockdevices']:
if not kwargs['partitions'] and drive['type'] == 'part': continue
drives[drive['path']] = BlockDevice(drive['path'], drive)
- return drives \ No newline at end of file
+ return drives
diff --git a/archinstall/lib/general.py b/archinstall/lib/general.py
index ff834241..abcf25f0 100644
--- a/archinstall/lib/general.py
+++ b/archinstall/lib/general.py
@@ -73,9 +73,10 @@ class sys_command():#Thread):
Stolen from archinstall_gui
"""
def __init__(self, cmd, callback=None, start_callback=None, *args, **kwargs):
- if not 'worker_id' in kwargs: kwargs['worker_id'] = gen_uid()
- if not 'emulate' in kwargs: kwargs['emulate'] = False
- if not 'surpress_errors' in kwargs: kwargs['surpress_errors'] = False
+ kwargs.setdefault("worker_id", gen_uid())
+ kwargs.setdefault("emulate", False)
+ kwargs.setdefault("suppress_errors", False)
+
if kwargs['emulate']:
log(f"Starting command '{cmd}' in emulation mode.")
self.raw_cmd = cmd
@@ -85,7 +86,8 @@ class sys_command():#Thread):
raise ValueError(f'Incorrect string to split: {cmd}\n{e}')
self.args = args
self.kwargs = kwargs
- if not 'worker' in self.kwargs: self.kwargs['worker'] = None
+
+ self.kwargs.setdefault("worker", None)
self.callback = callback
self.pid = None
self.exit_code = None
@@ -100,9 +102,9 @@ class sys_command():#Thread):
self.exec_dir = f'{self.cwd}/{os.path.basename(self.cmd[0])}_workingdir'
if not self.cmd[0][0] == '/':
- # "which" doesn't work as it's a builin to bash.
+ # "which" doesn't work as it's a builtin to bash.
# It used to work, but for whatever reason it doesn't anymore. So back to square one..
-
+
#log('Worker command is not executed with absolute path, trying to find: {}'.format(self.cmd[0]), origin='spawn', level=5)
#log('This is the binary {} for {}'.format(o.decode('UTF-8'), self.cmd[0]), origin='spawn', level=5)
self.cmd[0] = locate_binary(self.cmd[0])
@@ -110,7 +112,8 @@ class sys_command():#Thread):
if not os.path.isdir(self.exec_dir):
os.makedirs(self.exec_dir)
- if start_callback: start_callback(self, *args, **kwargs)
+ if start_callback:
+ start_callback(self, *args, **kwargs)
self.run()
def __iter__(self, *args, **kwargs):
@@ -125,14 +128,14 @@ class sys_command():#Thread):
def dump(self):
return {
- 'status' : self.status,
- 'worker_id' : self.worker_id,
- 'worker_result' : self.trace_log.decode('UTF-8'),
- 'started' : self.started,
- 'ended' : self.ended,
- 'started_pprint' : '{}-{}-{} {}:{}:{}'.format(*time.localtime(self.started)),
- 'ended_pprint' : '{}-{}-{} {}:{}:{}'.format(*time.localtime(self.ended)) if self.ended else None,
- 'exit_code' : self.exit_code
+ 'status': self.status,
+ 'worker_id': self.worker_id,
+ 'worker_result': self.trace_log.decode('UTF-8'),
+ 'started': self.started,
+ 'ended': self.ended,
+ 'started_pprint': '{}-{}-{} {}:{}:{}'.format(*time.localtime(self.started)),
+ 'ended_pprint': '{}-{}-{} {}:{}:{}'.format(*time.localtime(self.ended)) if self.ended else None,
+ 'exit_code': self.exit_code
}
def run(self):
@@ -238,7 +241,7 @@ class sys_command():#Thread):
if 'ignore_errors' in self.kwargs:
self.exit_code = 0
- if self.exit_code != 0 and not self.kwargs['surpress_errors']:
+ if self.exit_code != 0 and not self.kwargs['suppress_errors']:
log(f"'{self.raw_cmd}' did not exit gracefully, exit code {self.exit_code}.")
log(self.trace_log.decode('UTF-8'))
raise SysCallError(f"'{self.raw_cmd}' did not exit gracefully, exit code {self.exit_code}.\n{self.trace_log.decode('UTF-8')}")
@@ -247,11 +250,12 @@ class sys_command():#Thread):
with open(f'{self.cwd}/trace.log', 'wb') as fh:
fh.write(self.trace_log)
-def prerequisit_check():
- if not os.path.isdir('/sys/firmware/efi'):
- raise RequirementError('Archinstall only supports machines in UEFI mode.')
+
+def prerequisite_check():
+ if not os.path.isdir("/sys/firmware/efi"):
+ raise RequirementError("Archinstall only supports machines in UEFI mode.")
return True
def reboot():
- o = b''.join(sys_command(("/usr/bin/reboot"))) \ No newline at end of file
+ o = b''.join(sys_command("/usr/bin/reboot"))
diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py
index e6c2e300..99d8f2b9 100644
--- a/archinstall/lib/installer.py
+++ b/archinstall/lib/installer.py
@@ -137,12 +137,14 @@ class Installer():
if self.partition.filesystem == 'btrfs':
#if self.partition.encrypted:
self.base_packages.append('btrfs-progs')
-
+
self.pacstrap(self.base_packages)
self.genfstab()
- with open(f'{self.mountpoint}/etc/fstab', 'a') as fstab:
- fstab.write('\ntmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0\n') # Redundant \n at the start? who knoes?
+ with open(f"{self.mountpoint}/etc/fstab", "a") as fstab:
+ fstab.write(
+ "\ntmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0\n"
+ ) # Redundant \n at the start? who knows?
## TODO: Support locale and timezone
#os.remove(f'{self.mountpoint}/etc/localtime')
@@ -182,7 +184,7 @@ class Installer():
entry.write('initrd /initramfs-linux.img\n')
## blkid doesn't trigger on loopback devices really well,
## so we'll use the old manual method until we get that sorted out.
-
+
if self.partition.encrypted:
for root, folders, uids in os.walk('/dev/disk/by-uuid'):
@@ -191,7 +193,7 @@ class Installer():
if not os.path.basename(real_path) == os.path.basename(self.partition.real_device): continue
entry.write(f'options cryptdevice=UUID={uid}:luksdev root=/dev/mapper/luksdev rw intel_pstate=no_hwp\n')
-
+
self.helper_flags['bootloader'] = True
return True
break
@@ -202,7 +204,7 @@ class Installer():
if not os.path.basename(real_path) == os.path.basename(self.partition.path): continue
entry.write(f'options root=PARTUUID={uid} rw intel_pstate=no_hwp\n')
-
+
self.helper_flags['bootloader'] = True
return True
break
@@ -228,7 +230,7 @@ class Installer():
o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.mountpoint} useradd -m -G wheel {user}'))
if password:
self.user_set_pw(user, password)
-
+
if groups:
for group in groups:
o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.mountpoint} gpasswd -a {user} {group}'))
diff --git a/archinstall/lib/luks.py b/archinstall/lib/luks.py
index e56f3bd2..d4ee6632 100644
--- a/archinstall/lib/luks.py
+++ b/archinstall/lib/luks.py
@@ -23,14 +23,15 @@ class luks2():
def encrypt(self, partition, password, key_size=512, hash_type='sha512', iter_time=10000, key_file=None):
log(f'Encrypting {partition}')
- if not key_file: key_file = f'/tmp/{os.path.basename(self.partition.path)}.disk_pw' #TODO: Make disk-pw-file randomly unique?
+ if not key_file:
+ key_file = f"/tmp/{os.path.basename(self.partition.path)}.disk_pw" # TODO: Make disk-pw-file randomly unique?
if type(password) != bytes: password = bytes(password, 'UTF-8')
with open(key_file, 'wb') as fh:
fh.write(password)
o = b''.join(sys_command(f'/usr/bin/cryptsetup -q -v --type luks2 --pbkdf argon2i --hash {hash_type} --key-size {key_size} --iter-time {iter_time} --key-file {os.path.abspath(key_file)} --use-urandom luksFormat {partition.path}'))
- if not b'Command successful.' in o:
+ if b'Command successful.' not in o:
raise DiskError(f'Could not encrypt volume "{partition.path}": {o}')
return key_file
@@ -43,7 +44,8 @@ class luks2():
:param mountpoint: The name without absolute path, for instance "luksdev" will point to /dev/mapper/luksdev
:type mountpoint: str
"""
- if '/' in mountpoint: os.path.basename(mountpoint) # TODO: Raise exception instead?
+ if '/' in mountpoint:
+ os.path.basename(mountpoint) # TODO: Raise exception instead?
sys_command(f'/usr/bin/cryptsetup open {partition.path} {mountpoint} --key-file {os.path.abspath(key_file)} --type luks2')
if os.path.islink(f'/dev/mapper/{mountpoint}'):
return Partition(f'/dev/mapper/{mountpoint}', encrypted=True)
diff --git a/archinstall/lib/mirrors.py b/archinstall/lib/mirrors.py
index a4aade9c..1cd53ed0 100644
--- a/archinstall/lib/mirrors.py
+++ b/archinstall/lib/mirrors.py
@@ -78,16 +78,16 @@ def list_mirrors():
region = 'Unknown region'
for line in response.readlines():
- if len(line.strip()) == 0: continue
+ if len(line.strip()) == 0:
+ continue
line = line.decode('UTF-8').strip('\n').strip('\r')
if line[:3] == '## ':
region = line[3:]
elif line[:10] == '#Server = ':
- if not region in regions:
- regions[region] = {}
+ regions.setdefault(region, {})
- url = line[1:].lstrip('Server = ')
+ url = line.lstrip('#Server = ')
regions[region][url] = True
return regions \ No newline at end of file
diff --git a/archinstall/lib/networking.py b/archinstall/lib/networking.py
index ae4126a9..d24bb911 100644
--- a/archinstall/lib/networking.py
+++ b/archinstall/lib/networking.py
@@ -3,7 +3,6 @@ import socket
import struct
from collections import OrderedDict
-from .exceptions import *
def getHwAddr(ifname):
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
@@ -13,7 +12,8 @@ def getHwAddr(ifname):
def list_interfaces(skip_loopback=True):
interfaces = OrderedDict()
for index, iface in socket.if_nameindex():
- if skip_loopback and iface == 'lo': continue
+ if skip_loopback and iface == "lo":
+ continue
mac = getHwAddr(iface).replace(':', '-')
interfaces[mac] = iface
diff --git a/archinstall/lib/packages.py b/archinstall/lib/packages.py
index 2f5ebe94..ddf11f7f 100644
--- a/archinstall/lib/packages.py
+++ b/archinstall/lib/packages.py
@@ -11,7 +11,7 @@ def find_package(name):
"""
ssl_context = ssl.create_default_context()
ssl_context.check_hostname = False
- ssl_context.verify_mode=ssl.CERT_NONE
+ ssl_context.verify_mode = ssl.CERT_NONE
response = urllib.request.urlopen(BASE_URL.format(package=name), context=ssl_context)
data = response.read().decode('UTF-8')
return json.loads(data)
diff --git a/archinstall/lib/profiles.py b/archinstall/lib/profiles.py
index e018f753..322436c0 100644
--- a/archinstall/lib/profiles.py
+++ b/archinstall/lib/profiles.py
@@ -106,7 +106,7 @@ class Profile():
# To avoid profiles importing the wrong 'archinstall',
# we need to ensure that this current archinstall is in sys.path
archinstall_path = os.path.abspath(f'{os.path.dirname(__file__)}/../../')
- if not archinstall_path in sys.path:
+ if archinstall_path not in sys.path:
sys.path.insert(0, archinstall_path)
instructions = self.load_instructions()
diff --git a/archinstall/lib/services.py b/archinstall/lib/services.py
index 43051f0f..8fcdd296 100644
--- a/archinstall/lib/services.py
+++ b/archinstall/lib/services.py
@@ -3,11 +3,10 @@ import os
from .exceptions import *
from .general import *
-def service_state(service_name :str):
+def service_state(service_name: str):
if os.path.splitext(service_name)[1] != '.service':
- service_name += '.service' # Just to be safe
+ service_name += '.service' # Just to be safe
state = b''.join(sys_command(f'systemctl show -p SubState --value {service_name}'))
return state.strip().decode('UTF-8')
- \ No newline at end of file
diff --git a/archinstall/lib/tts.py b/archinstall/lib/tts.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/archinstall/lib/tts.py
diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py
index 0d3a12f5..29dfaed2 100644
--- a/archinstall/lib/user_interaction.py
+++ b/archinstall/lib/user_interaction.py
@@ -170,7 +170,7 @@ def select_mirror_regions(mirrors, show_top_mirrors=True):
:rtype: dict
"""
- # TODO: Support multiple options and country ycodes, SE,UK for instance.
+ # TODO: Support multiple options and country codes, SE,UK for instance.
regions = sorted(list(mirrors.keys()))
selected_mirrors = {}
@@ -205,7 +205,7 @@ def select_mirror_regions(mirrors, show_top_mirrors=True):
selected_mirrors[selected_mirror] = mirrors[selected_mirror]
else:
RequirementError("Selected region does not exist.")
-
+
return selected_mirrors
raise RequirementError("Selecting mirror region require a least one region to be given as an option.") \ No newline at end of file
diff --git a/docs/archinstall/Application.rst b/docs/archinstall/Application.rst
index 72722362..c6eb0d4d 100644
--- a/docs/archinstall/Application.rst
+++ b/docs/archinstall/Application.rst
@@ -4,7 +4,7 @@ archinstall.Application
=======================
This class enables access to pre-programmed application configurations.
-This is not to be confused with :ref:`archinstall.Profile` which is for pre-prgrammed profiles for a wider set of installation sets.
+This is not to be confused with :ref:`archinstall.Profile` which is for pre-programmed profiles for a wider set of installation sets.
.. autofunction:: archinstall.Application
diff --git a/docs/archinstall/Profile.rst b/docs/archinstall/Profile.rst
index 0f57c68c..a4c1f3bb 100644
--- a/docs/archinstall/Profile.rst
+++ b/docs/archinstall/Profile.rst
@@ -4,7 +4,7 @@ archinstall.Profile
===================
This class enables access to pre-programmed profiles.
-This is not to be confused with :ref:`archinstall.Application` which is for pre-prgrammed application profiles.
+This is not to be confused with :ref:`archinstall.Application` which is for pre-programmed application profiles.
Profiles in general is a set or group of installation steps.
Where as applications are a specific set of instructions for a very specific application.
diff --git a/docs/conf.py b/docs/conf.py
index 63e08e8a..02e6cb92 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -1,17 +1,18 @@
-import sys, os
+import os
+import re
+import sys
sys.path.insert(0, os.path.abspath('..'))
-import re
def process_docstring(app, what, name, obj, options, lines):
- spaces_pat = re.compile(r"( {8})")
- ll = []
- for l in lines:
- ll.append(spaces_pat.sub(" ",l))
- lines[:] = ll
+ spaces_pat = re.compile(r"( {8})")
+ ll = []
+ for l in lines:
+ ll.append(spaces_pat.sub(" ", l))
+ lines[:] = ll
def setup(app):
- app.connect('autodoc-process-docstring', process_docstring)
+ app.connect('autodoc-process-docstring', process_docstring)
# Configuration file for the Sphinx documentation builder.
#
@@ -110,8 +111,10 @@ htmlhelp_basename = 'slimhttpdoc'
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
- ('index', 'archinstall', u'archinstall Documentation',
- [u'Anton Hvornum'], 1)
+ (
+ "index", "archinstall", u"archinstall Documentation",
+ [u"Anton Hvornum"], 1
+ )
]
# If true, show URL addresses after external links.
@@ -124,6 +127,8 @@ man_pages = [
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
- ('index', 'archinstall', u'archinstall Documentation',
- u'Anton Hvornum', 'archinstall', 'Simple and minimal HTTP server.'),
+ (
+ "index", "archinstall", u"archinstall Documentation",
+ u"Anton Hvornum", "archinstall", "Simple and minimal HTTP server."
+ ),
]
diff --git a/docs/examples/python.rst b/docs/examples/python.rst
index 2f7c9301..04f2f43a 100644
--- a/docs/examples/python.rst
+++ b/docs/examples/python.rst
@@ -8,7 +8,7 @@ The way the library is invoked in module mode is limited to executing scripts un
It's there for important to place any script or profile you wish to invoke in the examples folder prior to building and installing.
-Pre-requisits
+Pre-requisites
-------------
We'll assume you've followed the `installing.python.manual`_ method.
diff --git a/docs/installing/guided.rst b/docs/installing/guided.rst
index a9b5ab3b..19aee62c 100644
--- a/docs/installing/guided.rst
+++ b/docs/installing/guided.rst
@@ -3,14 +3,14 @@
Guided installation
===================
-This is the installer you'll encounter on the *(currently)* inofficial Arch Linux Archinstall ISO found on `archlinux.life <https://archlinux.life>`_.
+This is the installer you'll encounter on the *(currently)* unofficial Arch Linux Archinstall ISO found on `archlinux.life <https://archlinux.life>`_.
You'll obviously need a physical machine or a virtual machine and have a basic understanding of how ISO-files work, where and how to mount them in order to boot the installer.
It runs you through a set of questions in order to determine what the system should look like. Then the guided installer performs the required installation steps for you. Some additional steps might show up depending on your chosen input at some of the steps - those steps should be self explanatory and won't be covered here.
.. note::
- There are some limitations with the installer, such as that it will not configure WiFi during the installation proceedure. And it will not perform a post-installation network configuration either. So you need to read up on `Arch Linux networking <https://wiki.archlinux.org/index.php/Network_configuration>`_ to get that to work.
+ There are some limitations with the installer, such as that it will not configure WiFi during the installation procedure. And it will not perform a post-installation network configuration either. So you need to read up on `Arch Linux networking <https://wiki.archlinux.org/index.php/Network_configuration>`_ to get that to work.
Features
--------
@@ -18,7 +18,7 @@ Features
The guided installer currently supports:
* *(optional)* Setting up disk encryption
- * *(optional)* Installing some simpel desktop environments
+ * *(optional)* Installing some simple desktop environments
* Choosing between a super-user or root based user setup
Installation steps
diff --git a/docs/installing/python.rst b/docs/installing/python.rst
index ae80e76e..ca34b1af 100644
--- a/docs/installing/python.rst
+++ b/docs/installing/python.rst
@@ -3,7 +3,7 @@
Python library
==============
-Archinstall shipps on `PyPi <https://pypi.org/>`_ as `archinstall <pypi.org/project/archinstall/>`_.
+Archinstall ships on `PyPi <https://pypi.org/>`_ as `archinstall <pypi.org/project/archinstall/>`_.
But the library can be installed manually as well.
.. warning::
diff --git a/examples/guided.py b/examples/guided.py
index cc660b90..70c2050d 100644
--- a/examples/guided.py
+++ b/examples/guided.py
@@ -9,10 +9,12 @@ SIG_TRIGGER = False
def kill_handler(sig, frame):
print()
exit(0)
+
def sig_handler(sig, frame):
global SIG_TRIGGER
SIG_TRIGGER = True
signal.signal(signal.SIGINT, kill_handler)
+
original_sigint_handler = signal.getsignal(signal.SIGINT)
signal.signal(signal.SIGINT, sig_handler)
@@ -54,8 +56,8 @@ def perform_installation(device, boot_partition, language, mirrors):
installation.user_set_pw('root', root_pw)
# Unmount and close previous runs (in case the installer is restarted)
-archinstall.sys_command(f'umount -R /mnt', surpress_errors=True)
-archinstall.sys_command(f'cryptsetup close /dev/mapper/luksloop', surpress_errors=True)
+archinstall.sys_command(f'umount -R /mnt', suppress_errors=True)
+archinstall.sys_command(f'cryptsetup close /dev/mapper/luksloop', suppress_errors=True)
"""
First, we'll ask the user for a bunch of user input.
@@ -86,7 +88,8 @@ archinstall.storage['_guided']['harddrive'] = harddrive
# Ask for a hostname
hostname = input('Desired hostname for the installation: ')
-if len(hostname) == 0: hostname = 'ArchInstall'
+if len(hostname) == 0:
+ hostname = 'ArchInstall'
archinstall.storage['_guided']['hostname'] = hostname
# Ask for a root password (optional, but triggers requirement for super-user if skipped)
@@ -111,7 +114,8 @@ while 1:
continue
break
- if 'users' not in archinstall.storage['_guided']: archinstall.storage['_guided']['users'] = []
+ if 'users' not in archinstall.storage['_guided']:
+ archinstall.storage['_guided']['users'] = []
archinstall.storage['_guided']['users'].append(new_user)
new_user_passwd = getpass.getpass(prompt=f'Password for user {new_user}: ')
@@ -129,13 +133,17 @@ while 1:
if profile:
archinstall.storage['_guided']['profile'] = profile
- if type(profile) != str: # Got a imported profile
- archinstall.storage['_guided']['profile'] = profile[0] # The second return is a module, and not a handle/object.
+ if type(profile) != str: # Got a imported profile
+ archinstall.storage['_guided']['profile'] = profile[0] # The second return is a module, and not a handle/object.
if not profile[1]._prep_function():
- archinstall.log(' * Profile\'s preperation requirements was not fulfilled.', bg='black', fg='red')
+ archinstall.log(
+ ' * Profile\'s preparation requirements was not fulfilled.',
+ bg='black',
+ fg='red'
+ )
continue
- profile = profile[0]._path # Once the prep is done, replace the selected profile with the profile name ("path") given from select_profile()
+ profile = profile[0]._path # Once the prep is done, replace the selected profile with the profile name ("path") given from select_profile()
break
else:
break
@@ -207,7 +215,7 @@ with archinstall.Filesystem(harddrive, archinstall.GPT) as fs:
# unlocks the drive so that it can be used as a normal block-device within archinstall.
with archinstall.luks2(harddrive.partition[1], 'luksloop', disk_password) as unlocked_device:
unlocked_device.format('btrfs')
-
+
perform_installation(unlocked_device, harddrive.partition[0], keyboard_language, mirror_regions)
else:
harddrive.partition[1].format('ext4')
diff --git a/examples/minimal.py b/examples/minimal.py
index 8bb8ed44..664bad0d 100644
--- a/examples/minimal.py
+++ b/examples/minimal.py
@@ -1,8 +1,8 @@
import archinstall, getpass
# Unmount and close previous runs
-archinstall.sys_command(f'umount -R /mnt', surpress_errors=True)
-archinstall.sys_command(f'cryptsetup close /dev/mapper/luksloop', surpress_errors=True)
+archinstall.sys_command(f'umount -R /mnt', suppress_errors=True)
+archinstall.sys_command(f'cryptsetup close /dev/mapper/luksloop', suppress_errors=True)
# Select a harddrive and a disk password
harddrive = archinstall.select_disk(archinstall.all_disks())
diff --git a/profiles/52-54-00-12-34-56.py b/profiles/52-54-00-12-34-56.py
index 49b0b966..679c6721 100644
--- a/profiles/52-54-00-12-34-56.py
+++ b/profiles/52-54-00-12-34-56.py
@@ -4,8 +4,8 @@ import urllib.request
import git
# Unmount and close previous runs (Mainly only used for re-runs, but won't hurt.)
-archinstall.sys_command(f'umount -R /mnt', surpress_errors=True)
-archinstall.sys_command(f'cryptsetup close /dev/mapper/luksloop', surpress_errors=True)
+archinstall.sys_command(f'umount -R /mnt', suppress_errors=True)
+archinstall.sys_command(f'cryptsetup close /dev/mapper/luksloop', suppress_errors=True)
# Select a harddrive and a disk password
harddrive = archinstall.all_disks()['/dev/sda']
@@ -22,7 +22,11 @@ with archinstall.Filesystem(harddrive, archinstall.GPT) as fs:
with archinstall.luks2(harddrive.partition[1], 'luksloop', disk_password) as unlocked_device:
unlocked_device.format('btrfs')
- with archinstall.Installer(unlocked_device, boot_partition=harddrive.partition[0], hostname='testmachine') as installation:
+ with archinstall.Installer(
+ unlocked_device,
+ boot_partition=harddrive.partition[0],
+ hostname="testmachine"
+ ) as installation:
if installation.minimal_installation():
installation.add_bootloader()
@@ -37,7 +41,12 @@ with archinstall.Filesystem(harddrive, archinstall.GPT) as fs:
print(f'Submitting {commit}: success')
- conditions = {"project" : "archinstall", "profile" : "52-54-00-12-34-56", "status" : "success", "commit" : commit}
+ conditions = {
+ "project": "archinstall",
+ "profile": "52-54-00-12-34-56",
+ "status": "success",
+ "commit": commit
+ }
req = urllib.request.Request("https://api.archlinux.life/build/success",
data=json.dumps(conditions).encode('utf8'),
headers={'content-type': 'application/json'})
diff --git a/profiles/applications/awesome.py b/profiles/applications/awesome.py
index 72945275..c0f0951d 100644
--- a/profiles/applications/awesome.py
+++ b/profiles/applications/awesome.py
@@ -1,14 +1,19 @@
import archinstall
-installation.add_additional_packages("awesome xorg-xrandr xterm feh slock terminus-font-otb gnu-free-fonts ttf-liberation xsel")
+installation.add_additional_packages(
+ "awesome xorg-xrandr xterm feh slock terminus-font-otb gnu-free-fonts ttf-liberation xsel"
+)
with open(f'{installation.mountpoint}/etc/X11/xinit/xinitrc', 'r') as xinitrc:
xinitrc_data = xinitrc.read()
for line in xinitrc_data.split('\n'):
- if 'twm &' in line: xinitrc_data = xinitrc_data.replace(line, f"# {line}")
- if 'xclock' in line: xinitrc_data = xinitrc_data.replace(line, f"# {line}")
- if 'xterm' in line: xinitrc_data = xinitrc_data.replace(line, f"# {line}")
+ if "twm &" in line:
+ xinitrc_data = xinitrc_data.replace(line, f"# {line}")
+ if "xclock" in line:
+ xinitrc_data = xinitrc_data.replace(line, f"# {line}")
+ if "xterm" in line:
+ xinitrc_data = xinitrc_data.replace(line, f"# {line}")
xinitrc_data += '\n'
xinitrc_data += 'exec awesome\n'
@@ -22,4 +27,4 @@ with open(f'{installation.mountpoint}/etc/xdg/awesome/rc.lua', 'r') as awesome_r
awesome = awesome.replace('xterm', 'xterm -ls -xrm \\"XTerm*selectToClipboard: true\\"')
with open(f'{installation.mountpoint}/etc/xdg/awesome/rc.lua', 'w') as awesome_rc_lua:
- awesome_rc_lua.write(awesome) \ No newline at end of file
+ awesome_rc_lua.write(awesome)
diff --git a/profiles/awesome.py b/profiles/awesome.py
index 0ec6ec4d..db8f42d7 100644
--- a/profiles/awesome.py
+++ b/profiles/awesome.py
@@ -1,7 +1,8 @@
-# A desktop environemtn using "Awesome" window manager.
+# A desktop environment using "Awesome" window manager.
import archinstall
+
def _prep_function(*args, **kwargs):
"""
Magic function called by the importing installer
@@ -18,6 +19,7 @@ def _prep_function(*args, **kwargs):
else:
print('Deprecated (??): xorg profile has no _prep_function() anymore')
+
# Ensures that this code only gets executed if executed
# through importlib.util.spec_from_file_location("awesome", "/somewhere/awesome.py")
# or through conventional import awesome
@@ -32,17 +34,19 @@ if __name__ == 'awesome':
# Then setup and configure the desktop environment: awesome
arguments = {
#'keyboard_layout' : 'sv-latin1',
- "editor" : "nano",
- "mediaplayer" : "lollypop gstreamer gst-plugins-good gnome-keyring",
- "filebrowser" : "nemo gpicview-gtk3",
- "webbrowser" : "chromium",
- "window_manager" : "awesome",
- "virtulization" : "qemu ovmf",
- "utils" : "openssh sshfs git htop pkgfile scrot dhclient wget smbclient cifs-utils libu2f-host",
- "audio" : "pulseaudio pulseaudio-alsa pavucontrol"
+ "editor": "nano",
+ "mediaplayer": "lollypop gstreamer gst-plugins-good gnome-keyring",
+ "filebrowser": "nemo gpicview-gtk3",
+ "webbrowser": "chromium",
+ "window_manager": "awesome",
+ "virtulization": "qemu ovmf",
+ "utils": "openssh sshfs git htop pkgfile scrot dhclient wget smbclient cifs-utils libu2f-host",
+ "audio": "pulseaudio pulseaudio-alsa pavucontrol"
}
- installation.add_additional_packages("{webbrowser} {utils} {mediaplayer} {window_manager} {virtulization} {filebrowser} {editor}".format(**arguments))
+ installation.add_additional_packages(
+ "{webbrowser} {utils} {mediaplayer} {window_manager} {virtulization} {filebrowser} {editor}".format(
+ **arguments))
#with open(f'{installation.mountpoint}/etc/X11/xinit/xinitrc', 'a') as X11:
# X11.write('setxkbmap se\n')
@@ -56,7 +60,10 @@ if __name__ == 'awesome':
awesome_lua = awesome_rc_lua.read()
# Insert slock as a shortcut on Modkey+l (window+l)
- awesome_lua = awesome_lua.replace('\nglobalkeys = gears.table.join(', 'globalkeys = gears.table.join(\n awful.key({ modkey, }, \"l\", function() awful.spawn(\"slock &\") end,\n')
+ awesome_lua = awesome_lua.replace(
+ "\nglobalkeys = gears.table.join(",
+ "globalkeys = gears.table.join(\n awful.key({ modkey, }, \"l\", function() awful.spawn(\"slock &\") end,\n"
+ )
# Insert some useful applications:
#awesome = awesome.replace('{ "open terminal", terminal, ','{ "Chromium", "chromium" },\n "open terminal", terminal, ')
@@ -75,5 +82,6 @@ if __name__ == 'awesome':
awesome_rc_lua.write(awesome_lua)
# Remove some interfering nemo settings
- installation.arch_chroot('gsettings set org.nemo.desktop show-desktop-icons false')
- installation.arch_chroot('xdg-mime default nemo.desktop inode/directory application/x-gnome-saved-search') \ No newline at end of file
+ installation.arch_chroot("gsettings set org.nemo.desktop show-desktop-icons false")
+ installation.arch_chroot(
+ "xdg-mime default nemo.desktop inode/directory application/x-gnome-saved-search")
diff --git a/profiles/gnome.py b/profiles/gnome.py
index 44fd642f..b37679de 100644
--- a/profiles/gnome.py
+++ b/profiles/gnome.py
@@ -1,4 +1,4 @@
-# A desktop environemtn using "Awesome" window manager.
+# A desktop environment using "Gnome"
import archinstall
@@ -32,4 +32,4 @@ if __name__ == 'gnome':
installation.enable_service('gdm') # Gnome Display Manager
# We could also start it via xinitrc since we do have Xorg,
- # but for gnome that's deprecated and wayland is preferred. \ No newline at end of file
+ # but for gnome that's deprecated and wayland is preferred.
diff --git a/profiles/kde.py b/profiles/kde.py
index d0afee58..052998bd 100644
--- a/profiles/kde.py
+++ b/profiles/kde.py
@@ -1,4 +1,4 @@
-# A desktop environemtn using "Awesome" window manager.
+# A desktop environement using "KDE".
import archinstall, os
diff --git a/profiles/xorg.py b/profiles/xorg.py
index 1cba7a81..a5820268 100644
--- a/profiles/xorg.py
+++ b/profiles/xorg.py
@@ -1,4 +1,4 @@
-# A desktop environemtn using "Awesome" window manager.
+# A system with "xorg" installed
import archinstall, os