Add accessibility packages to installed system if using the on the live ISO (#760)
* Add group of accesibility tools * Conditionally extend base packages * Enable it if accessibility in use in guided * Fix circular import
This commit is contained in:
parent
6b6c9c84be
commit
72d02a391d
|
|
@ -2,7 +2,6 @@ import os
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
from .helpers import convert_size_to_gb
|
|
||||||
from ..exceptions import DiskError
|
from ..exceptions import DiskError
|
||||||
from ..output import log
|
from ..output import log
|
||||||
from ..general import SysCommand
|
from ..general import SysCommand
|
||||||
|
|
@ -156,6 +155,8 @@ class BlockDevice:
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def size(self):
|
def size(self):
|
||||||
|
from .helpers import convert_size_to_gb
|
||||||
|
|
||||||
output = json.loads(SysCommand(f"lsblk --json -b -o+SIZE {self.path}").decode('UTF-8'))
|
output = json.loads(SysCommand(f"lsblk --json -b -o+SIZE {self.path}").decode('UTF-8'))
|
||||||
|
|
||||||
for device in output['blockdevices']:
|
for device in output['blockdevices']:
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,9 @@ from .exceptions import DiskError, ServiceException, RequirementError, HardwareI
|
||||||
# Any package that the Installer() is responsible for (optional and the default ones)
|
# Any package that the Installer() is responsible for (optional and the default ones)
|
||||||
__packages__ = ["base", "base-devel", "linux-firmware", "linux", "linux-lts", "linux-zen", "linux-hardened"]
|
__packages__ = ["base", "base-devel", "linux-firmware", "linux", "linux-lts", "linux-zen", "linux-hardened"]
|
||||||
|
|
||||||
|
# Additional packages that are installed if the user is running the Live ISO with accessibility tools enabled
|
||||||
|
__accessibility_packages__ = ["brltty", "espeakup", "alsa-utils"]
|
||||||
|
|
||||||
|
|
||||||
class InstallationFile:
|
class InstallationFile:
|
||||||
def __init__(self, installation, filename, owner, mode="w"):
|
def __init__(self, installation, filename, owner, mode="w"):
|
||||||
|
|
@ -52,6 +55,10 @@ class InstallationFile:
|
||||||
return self.fh.poll(*args)
|
return self.fh.poll(*args)
|
||||||
|
|
||||||
|
|
||||||
|
def accessibility_tools_in_use() -> bool:
|
||||||
|
return os.system('systemctl is-active --quiet espeakup.service') == 0
|
||||||
|
|
||||||
|
|
||||||
class Installer:
|
class Installer:
|
||||||
"""
|
"""
|
||||||
`Installer()` is the wrapper for most basic installation steps.
|
`Installer()` is the wrapper for most basic installation steps.
|
||||||
|
|
@ -96,6 +103,10 @@ class Installer:
|
||||||
for kernel in kernels:
|
for kernel in kernels:
|
||||||
self.base_packages.append(kernel)
|
self.base_packages.append(kernel)
|
||||||
|
|
||||||
|
# If using accessibility tools in the live environment, append those to the packages list
|
||||||
|
if accessibility_tools_in_use():
|
||||||
|
self.base_packages.extend(__accessibility_packages__)
|
||||||
|
|
||||||
self.post_base_install = []
|
self.post_base_install = []
|
||||||
|
|
||||||
storage['session'] = self
|
storage['session'] = self
|
||||||
|
|
@ -307,6 +318,10 @@ class Installer:
|
||||||
with Boot(self) as session:
|
with Boot(self) as session:
|
||||||
session.SysCommand(["timedatectl", "set-ntp", 'true'])
|
session.SysCommand(["timedatectl", "set-ntp", 'true'])
|
||||||
|
|
||||||
|
def enable_espeakup(self):
|
||||||
|
self.log('Enabling espeakup.service for speech synthesis (accessibility).', level=logging.INFO)
|
||||||
|
self.enable_service('espeakup')
|
||||||
|
|
||||||
def enable_service(self, *services):
|
def enable_service(self, *services):
|
||||||
for service in services:
|
for service in services:
|
||||||
self.log(f'Enabling service {service}', level=logging.INFO)
|
self.log(f'Enabling service {service}', level=logging.INFO)
|
||||||
|
|
@ -448,7 +463,7 @@ class Installer:
|
||||||
self.MODULES.append('btrfs')
|
self.MODULES.append('btrfs')
|
||||||
if '/usr/bin/btrfs-progs' not in self.BINARIES:
|
if '/usr/bin/btrfs-progs' not in self.BINARIES:
|
||||||
self.BINARIES.append('/usr/bin/btrfs')
|
self.BINARIES.append('/usr/bin/btrfs')
|
||||||
|
|
||||||
# There is not yet an fsck tool for NTFS. If it's being used for the root filesystem, the hook should be removed.
|
# There is not yet an fsck tool for NTFS. If it's being used for the root filesystem, the hook should be removed.
|
||||||
if partition.filesystem == 'ntfs3' and partition.mountpoint == self.target:
|
if partition.filesystem == 'ntfs3' and partition.mountpoint == self.target:
|
||||||
if 'fsck' in self.HOOKS:
|
if 'fsck' in self.HOOKS:
|
||||||
|
|
@ -615,7 +630,7 @@ class Installer:
|
||||||
self.helper_flags['bootloader'] = bootloader
|
self.helper_flags['bootloader'] = bootloader
|
||||||
|
|
||||||
elif bootloader == "grub-install":
|
elif bootloader == "grub-install":
|
||||||
self.pacstrap('grub') # no need?
|
self.pacstrap('grub') # no need?
|
||||||
|
|
||||||
if real_device := self.detect_encryption(root_partition):
|
if real_device := self.detect_encryption(root_partition):
|
||||||
root_uuid = SysCommand(f"blkid -s UUID -o value {real_device.path}").decode().rstrip()
|
root_uuid = SysCommand(f"blkid -s UUID -o value {real_device.path}").decode().rstrip()
|
||||||
|
|
|
||||||
|
|
@ -334,6 +334,9 @@ def perform_installation(mountpoint):
|
||||||
if archinstall.arguments.get('ntp', False):
|
if archinstall.arguments.get('ntp', False):
|
||||||
installation.activate_time_syncronization()
|
installation.activate_time_syncronization()
|
||||||
|
|
||||||
|
if installation.accessibility_tools_in_use():
|
||||||
|
installation.enable_espeakup()
|
||||||
|
|
||||||
if (root_pw := archinstall.arguments.get('!root-password', None)) and len(root_pw):
|
if (root_pw := archinstall.arguments.get('!root-password', None)) and len(root_pw):
|
||||||
installation.user_set_pw('root', root_pw)
|
installation.user_set_pw('root', root_pw)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue