This commit is contained in:
Kian-Meng Ang 2022-05-29 15:31:18 +08:00 committed by GitHub
parent b2f85889a7
commit 2de153003e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 44 additions and 44 deletions

View File

@ -30,7 +30,7 @@ Some additional options that are not needed by most users are hidden behind the
## Running from a declarative configuration file or URL
Prequisites:
Prerequisites:
1. Edit the [configuration file](https://github.com/archlinux/archinstall/blob/master/examples/config-sample.json) according to your requirements.
Assuming you are on a Arch Linux live-ISO and booted into EFI mode.
@ -55,7 +55,7 @@ The guided installer itself is also optional to use if so desired and not forced
Archinstall has one fundamental function which is to be a flexible library to manage services, packages and other aspects inside the installed system.
This library is in turn used by the provided guided installer but is also for anyone who wants to script their own installations.
Therefore, Archinstall will try its best to not introduce any breaking changes except for major releases which may break backwards compability after notifying about such changes.
Therefore, Archinstall will try its best to not introduce any breaking changes except for major releases which may break backwards compatibility after notifying about such changes.
# Scripting your own installation

View File

@ -91,7 +91,7 @@ def parse_unspecified_argument_list(unknowns :list, multiple :bool = False, erro
--argument=value
--argument = value
--argument (boolean as default)
the optional paramters to the function alter a bit its behaviour:
the optional parameters to the function alter a bit its behaviour:
* multiple allows multivalued arguments, each value separated by whitespace. They're returned as a list
* error. If set any non correctly specified argument-value pair to raise an exception. Else, simply notifies the existence of a problem and continues processing.
@ -104,7 +104,7 @@ def parse_unspecified_argument_list(unknowns :list, multiple :bool = False, erro
key = None
last_key = None
while tmp_list:
element = tmp_list.pop(0) # retreive an element of the list
element = tmp_list.pop(0) # retrieve an element of the list
if element.startswith('--'): # is an argument ?
if '=' in element: # uses the arg=value syntax ?
key, value = [x.strip() for x in element[2:].split('=', 1)]

View File

@ -73,7 +73,7 @@ def create_subvolume(installation :Installer, subvolume_location :Union[pathlib.
def _has_option(option :str,options :list) -> bool:
""" auxiliary routine to check if an option is present in a list.
we check if the string appears in one of the options, 'cause it can appear in severl forms (option, option=val,...)
we check if the string appears in one of the options, 'cause it can appear in several forms (option, option=val,...)
"""
if not options:
return False
@ -110,7 +110,7 @@ def manage_btrfs_subvolumes(installation :Installer,
subvolumes = partition['btrfs']['subvolumes']
for name, right_hand in subvolumes.items():
try:
# we normalize the subvolume name (getting rid of slash at the start if exists. In our implemenation has no semantic load - every subvolume is created from the top of the hierarchy- and simplifies its further use
# we normalize the subvolume name (getting rid of slash at the start if exists. In our implementation has no semantic load - every subvolume is created from the top of the hierarchy- and simplifies its further use
if name.startswith('/'):
name = name[1:]
# renormalize the right hand.

View File

@ -10,7 +10,7 @@ from .btrfssubvolume import BtrfsSubvolume
def mount_subvolume(installation, device, name, subvolume_information):
# we normalize the subvolume name (getting rid of slash at the start if exists. In our implemenation has no semantic load.
# we normalize the subvolume name (getting rid of slash at the start if exists. In our implementation has no semantic load.
# Every subvolume is created from the top of the hierarchy- and simplifies its further use
name = name.lstrip('/')
@ -53,7 +53,7 @@ def setup_subvolumes(installation, partition_dict):
"""
log(f"Setting up subvolumes: {partition_dict['btrfs']['subvolumes']}", level=logging.INFO, fg="gray")
for name, right_hand in partition_dict['btrfs']['subvolumes'].items():
# we normalize the subvolume name (getting rid of slash at the start if exists. In our implemenation has no semantic load.
# we normalize the subvolume name (getting rid of slash at the start if exists. In our implementation has no semantic load.
# Every subvolume is created from the top of the hierarchy- and simplifies its further use
name = name.lstrip('/')

View File

@ -62,13 +62,13 @@ class BTRFSPartition(Partition):
if not installation:
installation = storage.get('installation_session')
# Determain if the path given, is an absolute path or a releative path.
# Determain if the path given, is an absolute path or a relative path.
# We do this by checking if the path contains a known mountpoint.
if str(subvolume)[0] == '/':
if filesystems := findmnt(subvolume, traverse=True).get('filesystems'):
if (target := filesystems[0].get('target')) and target != '/' and str(subvolume).startswith(target):
# Path starts with a known mountpoint which isn't /
# Which means it's an absolut path to a mounted location.
# Which means it's an absolute path to a mounted location.
pass
else:
# Since it's not an absolute position with a known start.

View File

@ -68,9 +68,9 @@ class BtrfsSubvolume:
from .btrfs_helpers import subvolume_info_from_path
# TODO: Make this function traverse storage['MOUNT_POINT'] and find the first
# occurance of a mountpoint that is a btrfs volume instead of lazy assume / is a subvolume.
# occurrence of a mountpoint that is a btrfs volume instead of lazy assume / is a subvolume.
# It would also be nice if it could use findmnt(self.full_path) and traverse backwards
# finding the last occurance of a subvolume which 'self' belongs to.
# finding the last occurrence of a subvolume which 'self' belongs to.
if volume := subvolume_info_from_path(storage['MOUNT_POINT']):
return self.full_path == volume.full_path

View File

@ -74,7 +74,7 @@ class Filesystem:
raise KeyError(f"Could not create a GPT label on {self}")
elif self.mode == MBR:
if not self.parted_mklabel(self.blockdevice.device, "msdos"):
raise KeyError(f"Could not create a MSDOS label on {self}")
raise KeyError(f"Could not create a MS-DOS label on {self}")
self.blockdevice.flush_cache()
time.sleep(3)
@ -221,7 +221,7 @@ class Filesystem:
raise KeyError(f"Could not create a GPT label on {self}")
elif self.mode == MBR:
if not self.parted_mklabel(self.blockdevice.device, "msdos"):
raise KeyError(f"Could not create a MSDOS label on {self}")
raise KeyError(f"Could not create a MS-DOS label on {self}")
self.blockdevice.flush_cache()

View File

@ -112,7 +112,7 @@ def cleanup_bash_escapes(data :str) -> str:
def blkid(cmd :str) -> Dict[str, Any]:
if '-o' in cmd and '-o export' not in cmd:
raise ValueError(f"blkid() requires '-o export' to be used and can therefor not continue reliably.")
raise ValueError(f"blkid() requires '-o export' to be used and can therefore not continue reliably.")
elif '-o' not in cmd:
cmd += ' -o export'
@ -133,7 +133,7 @@ def blkid(cmd :str) -> Dict[str, Any]:
key, val = line.split('=', 1)
if key.lower() == 'devname':
devname = val
# Lowercase for backwards compatability with all_disks() previous use cases
# Lowercase for backwards compatibility with all_disks() previous use cases
result[devname] = {
"path": devname,
"PATH": devname
@ -475,7 +475,7 @@ def has_mountpoint(partition: Union[dict,Partition,MapperDev], target: str, stri
Input parms:
:parm partition the partition we check
:type Either a Partition object or a dict with the contents of a partition definiton in the disk_layouts schema
:type Either a Partition object or a dict with the contents of a partition definition in the disk_layouts schema
:parm target (a string representing a mount path we want to check for.
:type str

View File

@ -207,7 +207,7 @@ class SysCommandWorker:
self.cmd = cmd
self.callbacks = callbacks
self.peak_output = peak_output
# define the standard locale for command outputs. For now the C ascii one. Can be overriden
# define the standard locale for command outputs. For now the C ascii one. Can be overridden
self.environment_vars = {**storage.get('CMD_LOCALE',{}),**environment_vars}
self.logfile = logfile
self.working_directory = working_directory
@ -354,7 +354,7 @@ class SysCommandWorker:
# Note: If for any reason, we get a Python exception between here
# and until os.close(), the traceback will get locked inside
# stdout of the child_fd object. `os.read(self.child_fd, 8192)` is the
# only way to get the traceback without loosing it.
# only way to get the traceback without losing it.
self.pid, self.child_fd = pty.fork()
@ -547,7 +547,7 @@ def json_stream_to_structure(configuration_identifier : str, stream :str, target
parsed_url = urllib.parse.urlparse(stream)
if parsed_url.scheme: # The stream is in fact a URL that should be grabed
if parsed_url.scheme: # The stream is in fact a URL that should be grabbed
with urllib.request.urlopen(urllib.request.Request(stream, headers={'User-Agent': 'ArchInstall'})) as response:
target.update(json.loads(response.read()))
else:

View File

@ -195,7 +195,7 @@ class Installer:
return True
def _create_keyfile(self,luks_handle , partition :dict, password :str):
""" roiutine to create keyfiles, so it can be moved elsewere
""" roiutine to create keyfiles, so it can be moved elsewhere
"""
if partition.get('generate-encryption-key-file'):
if not (cryptkey_dir := pathlib.Path(f"{self.target}/etc/cryptsetup-keys.d")).exists():
@ -413,7 +413,7 @@ class Installer:
try:
run_pacman('-Syy', default_cmd='/usr/bin/pacman')
except SysCallError as error:
self.log(f'Could not sync a new package databse: {error}', level=logging.ERROR, fg="red")
self.log(f'Could not sync a new package database: {error}', level=logging.ERROR, fg="red")
if storage['arguments'].get('silent', False) is False:
if input('Would you like to re-try this download? (Y/n): ').lower().strip() in ('', 'y'):

View File

@ -54,7 +54,7 @@ The default implementation can handle simple lists and a key:value dictionary. T
A sample of basic usage is included at the end of the source.
More sophisticaded uses can be achieved by
* changing the action list and the null_action during intialization
* changing the action list and the null_action during initialization
```
opciones = ListManager('Vamos alla',opciones,[str(_('Add')),str(_('Delete'))],_('Add')).run()
```
@ -198,7 +198,7 @@ class ListManager:
else:
self.target = self._data[data_formatted[target.value]]
# Possible enhacement. If run_actions returns false a message line indicating the failure
# Possible enhancement. If run_actions returns false a message line indicating the failure
self.run_actions(target.value)
if target.value == self.cancel_action: # TODO dubious

View File

@ -115,7 +115,7 @@ class Menu(TerminalMenu):
# We check that the options are iterable. If not we abort. Else we copy them to lists
# it options is a dictionary we use the values as entries of the list
# if options is a string object, each character becomes an entry
# if options is a list, we implictily build a copy to mantain immutability
# if options is a list, we implictily build a copy to maintain immutability
if not isinstance(p_options,Iterable):
log(f"Objects of type {type(p_options)} is not iterable, and are not supported at Menu",fg="red")
log(f"invalid parameter at Menu() call was at <{sys._getframe(1).f_code.co_name}>",level=logging.WARNING)

View File

@ -219,7 +219,7 @@ class GeneralMenu:
def _setup_selection_menu_options(self):
""" Define the menu options.
Menu options can be defined here in a subclass or done per progam calling self.set_option()
Menu options can be defined here in a subclass or done per program calling self.set_option()
"""
return
@ -347,7 +347,7 @@ class GeneralMenu:
return self.exec_option(config_name, selector)
def exec_option(self, config_name :str, p_selector :Selector = None) -> bool:
""" processes the exection of a given menu entry
""" processes the execution of a given menu entry
- pre process callback
- selection function
- post process callback

View File

@ -619,7 +619,7 @@ class TerminalMenu:
else:
unit_separated_entry = escaped_separator_pattern.sub("|", separator_pattern.sub("\\1\x1F", entry))
match_obj = menu_entry_pattern.match(unit_separated_entry)
# this is none in case the entry was an emtpy string which
# this is none in case the entry was an empty string which
# will be interpreted as a separator
assert match_obj is not None
shortcut_key = match_obj.group(1)

View File

@ -64,13 +64,13 @@ class User:
) -> List['User']:
users = []
# backwards compability
# backwards compatibility
if isinstance(config_users, dict):
users += cls._parse_backwards_compatible(config_users, False)
else:
users += cls._parse(config_users)
# backwards compability
# backwards compatibility
if isinstance(config_superusers, dict):
users += cls._parse_backwards_compatible(config_superusers, True)

View File

@ -17,13 +17,13 @@ storage: Dict[str, Any] = {
# os.path.abspath(f'{os.path.dirname(__file__)}/../examples')
],
'UPSTREAM_URL': 'https://raw.githubusercontent.com/archlinux/archinstall/master/profiles',
'PROFILE_DB': None, # Used in cases when listing profiles is desired, not mandatory for direct profile grabing.
'PROFILE_DB': None, # Used in cases when listing profiles is desired, not mandatory for direct profile grabbing.
'LOG_PATH': '/var/log/archinstall',
'LOG_FILE': 'install.log',
'MOUNT_POINT': '/mnt/archinstall',
'ENC_IDENTIFIER': 'ainst',
'DISK_TIMEOUTS' : 1, # seconds
'DISK_RETRY_ATTEMPTS' : 5, # RETRY_ATTEMPTS * DISK_TIMEOUTS is used in disk operations
'CMD_LOCALE':{'LC_ALL':'C'}, # default locale for execution commands. Can be overriden with set_cmd_locale()
'CMD_LOCALE':{'LC_ALL':'C'}, # default locale for execution commands. Can be overridden with set_cmd_locale()
'CMD_LOCALE_DEFAULT':{'LC_ALL':'C'}, # should be the same as the former. Not be used except in reset_cmd_locale()
}

View File

@ -88,7 +88,7 @@ class Boot:
if len(args) >= 2 and args[1]:
log(args[1], level=logging.ERROR, fg='red')
log(f"The error above occured in a temporary boot-up of the installation {self.instance}", level=logging.ERROR, fg="red")
log(f"The error above occurred in a temporary boot-up of the installation {self.instance}", level=logging.ERROR, fg="red")
shutdown = None
shutdown_exit_code = -1

View File

@ -28,7 +28,7 @@ class LanguageDefinitions:
if entry['abbr'] == abbr:
return entry['lang']
raise ValueError(f'No language with abbrevation "{abbr}" found')
raise ValueError(f'No language with abbreviation "{abbr}" found')
class DeferredTranslation:

View File

@ -40,7 +40,7 @@ def generic_select(
# We check that the options are iterable. If not we abort. Else we copy them to lists
# it options is a dictionary we use the values as entries of the list
# if options is a string object, each character becomes an entry
# if options is a list, we implictily build a copy to mantain immutability
# if options is a list, we implictily build a copy to maintain immutability
if not isinstance(p_options, Iterable):
log(f"Objects of type {type(p_options)} is not iterable, and are not supported at generic_select", fg="red")
log(f"invalid parameter at Menu() call was at <{sys._getframe(1).f_code.co_name}>", level=logging.WARNING)

View File

@ -224,7 +224,7 @@ def manage_new_and_existing_partitions(block_device: 'BlockDevice') -> Dict[str,
continue
block_device_struct["partitions"].append({
"type": "primary", # Strictly only allowed under MSDOS, but GPT accepts it so it's "safe" to inject
"type": "primary", # Strictly only allowed under MS-DOS, but GPT accepts it so it's "safe" to inject
"start": start,
"size": end,
"mountpoint": None,

View File

@ -12,7 +12,7 @@ Some of the features of Archinstall are:
* **Context friendly.** The library always executes calls in sequential order to ensure installation-steps don't overlap or execute in the wrong order. It also supports *(and uses)* context wrappers to ensure cleanup and final tasks such as ``mkinitcpio`` are called when needed.
* **Full transparancy** Logs and insights can be found at ``/var/log/archinstall`` both in the live ISO and the installed system.
* **Full transparency** Logs and insights can be found at ``/var/log/archinstall`` both in the live ISO and the installed system.
* **Accessibility friendly** Archinstall works with ``espeakup`` and other accessibility tools thanks to the use of a TUI.

View File

@ -115,7 +115,7 @@ Options for ``--config``
+----------------------+--------------------------------------------------------+---------------------------------------------------------------------------------------------+-----------------------------------------------+
| hostname | any | Hostname of machine after installation. Default will be ``archinstall`` | No |
+----------------------+--------------------------------------------------------+---------------------------------------------------------------------------------------------+-----------------------------------------------+
| kernels | [ "kernel1", "kernel2"] | List of kernels to install eg: linux, linux-lts, linux-zen etc | Atleast 1 |
| kernels | [ "kernel1", "kernel2"] | List of kernels to install eg: linux, linux-lts, linux-zen etc | At least 1 |
+----------------------+--------------------------------------------------------+---------------------------------------------------------------------------------------------+-----------------------------------------------+
| keyboard-language | Any valid layout given by ``localectl list-keymaps`` | eg: ``us``, ``de`` or ``de-latin1`` etc. Defaults to ``us`` | No |
+----------------------+--------------------------------------------------------+---------------------------------------------------------------------------------------------+-----------------------------------------------+
@ -149,7 +149,7 @@ Options for ``--config``
+----------------------+--------------------------------------------------------+---------------------------------------------------------------------------------------------+-----------------------------------------------+
.. note::
[1] If no entires are found in ``harddrives``, archinstall guided installation will use whatever is mounted currently under ``/mnt/archinstall``.
[1] If no entries are found in ``harddrives``, archinstall guided installation will use whatever is mounted currently under ``/mnt/archinstall``.
Options for ``--creds``
-----------------------

View File

@ -1,14 +1,14 @@
"""
Script swiss (army knife)
Designed to make different workflows for the installation process. Which is controled by the argument --mode
Designed to make different workflows for the installation process. Which is controlled by the argument --mode
mode full guides the full process of installation
mode only_hd only proceeds to the creation of the disk infraestructure (partition, mount points, encryption)
mode only_os processes only the installation of Archlinux and software at --mountpoint (or /mnt/archinstall)
mode minimal (still not implemented)
mode lineal. Instead of a menu, shows a sequence of selection screens (eq. to the old mode for guided.py)
When using the argument --advanced. an aditional menu for several special parameters needed during installation appears
When using the argument --advanced. an additional menu for several special parameters needed during installation appears
This script respects the --dry_run argument
@ -180,7 +180,7 @@ class SetupMenu(archinstall.GeneralMenu):
self.set_option(item,
archinstall.Selector(
f'{get_locale_mode_text(item)} locale',
lambda x,item=item: select_installed_locale(item), # the parmeter is needed for the lambda in the loop
lambda x,item=item: select_installed_locale(item), # the parameter is needed for the lambda in the loop
enabled=True,
dependencies_not=['LC_ALL'] if item != 'LC_ALL' else []))
self.option('LC_ALL').set_enabled(True)
@ -286,7 +286,7 @@ class MyMenu(archinstall.GlobalMenu):
"""
Instalation general subroutines
Installation general subroutines
"""
def get_current_status():

View File

@ -33,7 +33,7 @@ def _prep_function(*args, **kwargs):
before continuing any further.
"""
choice = Menu(str(_(
'Choose which servers to install, if none then a minimal installation wil be done')),
'Choose which servers to install, if none then a minimal installation will be done')),
available_servers,
preset_values=kwargs['servers'],
multi=True