diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index ca13cf12..53f9841c 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -1476,20 +1476,20 @@ class Installer: parent_dev_path = get_parent_device_path(efi_partition.safe_dev_path) + efi_dir_path = self.target / efi_partition.mountpoint.relative_to('/') / 'EFI' + efi_dir_path_target = efi_partition.mountpoint / 'EFI' + if bootloader_removable: + efi_dir_path = efi_dir_path / 'BOOT' + efi_dir_path_target = efi_dir_path_target / 'BOOT' + else: + efi_dir_path = efi_dir_path / 'arch-limine' + efi_dir_path_target = efi_dir_path_target / 'arch-limine' + + config_path = efi_dir_path / 'limine.conf' + + efi_dir_path.mkdir(parents=True, exist_ok=True) + try: - efi_dir_path = self.target / efi_partition.mountpoint.relative_to('/') / 'EFI' - efi_dir_path_target = efi_partition.mountpoint / 'EFI' - if bootloader_removable: - efi_dir_path = efi_dir_path / 'BOOT' - efi_dir_path_target = efi_dir_path_target / 'BOOT' - else: - efi_dir_path = efi_dir_path / 'arch-limine' - efi_dir_path_target = efi_dir_path_target / 'arch-limine' - - config_path = efi_dir_path / 'limine.conf' - - efi_dir_path.mkdir(parents=True, exist_ok=True) - for file in ('BOOTIA32.EFI', 'BOOTX64.EFI'): (limine_path / file).copy_into(efi_dir_path) except Exception as err: diff --git a/archinstall/lib/network/wifi_handler.py b/archinstall/lib/network/wifi_handler.py index bc068d2a..a0a3f05a 100644 --- a/archinstall/lib/network/wifi_handler.py +++ b/archinstall/lib/network/wifi_handler.py @@ -58,7 +58,7 @@ class WifiHandler(InstanceRunnable[bool]): async def _enable_supplicant(self, wifi_iface: str) -> bool: self._wpa_config.load_config() - result = self._wpa_cli('status') # if it it's running it will blow up + result = self._wpa_cli('status') if result.success: debug('wpa_supplicant already running') @@ -72,18 +72,19 @@ class WifiHandler(InstanceRunnable[bool]): try: SysCommand(f'wpa_supplicant -B -i {wifi_iface} -c {self._wpa_config.config_file}') - result = self._wpa_cli('status') # if it it's running it will blow up - - if result.success: - debug('successfully enabled wpa_supplicant') - return True - else: - debug(f'failed to enable wpa_supplicant: {result.error}') - return False except SysCallError as err: debug(f'failed to enable wpa_supplicant: {err}') return False + result = self._wpa_cli('status') + + if result.success: + debug('successfully enabled wpa_supplicant') + return True + else: + debug(f'failed to enable wpa_supplicant: {result.error}') + return False + def _find_wifi_interface(self) -> str | None: net_path = Path('/sys/class/net') @@ -197,15 +198,6 @@ class WifiHandler(InstanceRunnable[bool]): try: result = SysCommand(cmd).decode() - - if 'FAIL' in result: - debug(f'wpa_cli returned FAIL: {result}') - return WpaCliResult( - success=False, - error=f'wpa_cli returned a failure: {result}', - ) - - return WpaCliResult(success=True, response=result) except SysCallError as err: debug(f'error running wpa_cli command: {err}') return WpaCliResult( @@ -213,6 +205,15 @@ class WifiHandler(InstanceRunnable[bool]): error=f'Error running wpa_cli command: {err}', ) + if 'FAIL' in result: + debug(f'wpa_cli returned FAIL: {result}') + return WpaCliResult( + success=False, + error=f'wpa_cli returned a failure: {result}', + ) + + return WpaCliResult(success=True, response=result) + def _find_network_id(self, ssid: str, iface: str) -> int | None: result = self._wpa_cli('list_networks', iface) @@ -254,18 +255,18 @@ class WifiHandler(InstanceRunnable[bool]): try: result = self._wpa_cli('scan_results', iface) - - if not result.success: - debug(f'Failed to retrieve scan results: {result.error}') - return [] - - if not result.response: - debug('No wifi networks found') - return [] - - networks = WifiNetwork.from_wpa(result.response) - - return networks except SysCallError as err: debug('Unable to retrieve wifi results') raise err + + if not result.success: + debug(f'Failed to retrieve scan results: {result.error}') + return [] + + if not result.response: + debug('No wifi networks found') + return [] + + networks = WifiNetwork.from_wpa(result.response) + + return networks diff --git a/archinstall/lib/profile/profiles_handler.py b/archinstall/lib/profile/profiles_handler.py index 1e770de5..8430e001 100644 --- a/archinstall/lib/profile/profiles_handler.py +++ b/archinstall/lib/profile/profiles_handler.py @@ -258,6 +258,10 @@ class ProfileHandler: """ try: data = fetch_data_from_url(url) + except ValueError: + err = tr('Unable to fetch profile from specified url: {}').format(url) + error(err) + else: b_data = bytes(data, 'utf-8') with NamedTemporaryFile(delete=False, suffix='.py') as fp: @@ -266,10 +270,6 @@ class ProfileHandler: profiles = self._process_profile_file(filepath) self.remove_custom_profiles(profiles) - self.add_custom_profiles(profiles) - except ValueError: - err = tr('Unable to fetch profile from specified url: {}').format(url) - error(err) def _load_profile_class(self, module: ModuleType) -> list[Profile]: """ diff --git a/archinstall/lib/translationhandler.py b/archinstall/lib/translationhandler.py index c2736f35..7da523b2 100644 --- a/archinstall/lib/translationhandler.py +++ b/archinstall/lib/translationhandler.py @@ -82,13 +82,14 @@ class TranslationHandler: if not running_from_iso(): return + font_fd, font_path = tempfile.mkstemp(prefix='archinstall_font_') + cmap_fd, cmap_path = tempfile.mkstemp(prefix='archinstall_cmap_') + os.close(font_fd) + os.close(cmap_fd) + self._font_backup = Path(font_path) + self._cmap_backup = Path(cmap_path) + try: - font_fd, font_path = tempfile.mkstemp(prefix='archinstall_font_') - cmap_fd, cmap_path = tempfile.mkstemp(prefix='archinstall_cmap_') - os.close(font_fd) - os.close(cmap_fd) - self._font_backup = Path(font_path) - self._cmap_backup = Path(cmap_path) SysCommand(['setfont', '-O', str(self._font_backup), '-om', str(self._cmap_backup)]) except SysCallError as err: debug(f'Failed to save console font: {err}') @@ -136,21 +137,21 @@ class TranslationHandler: try: # get a translation for a specific language translation = gettext.translation('base', localedir=self._get_locales_dir(), languages=(abbr, lang)) - - # calculate the percentage of total translated text to total number of messages - if abbr == 'en': - percent = 100 - else: - num_translations = self._get_catalog_size(translation) - percent = int((num_translations / self._total_messages) * 100) - # prevent cases where the .pot file is out of date and the percentage is above 100 - percent = min(100, percent) - - language = Language(abbr, lang, translation, percent, translated_lang, console_font) - languages.append(language) except FileNotFoundError as err: raise FileNotFoundError(f"Could not locate language file for '{lang}': {err}") + # calculate the percentage of total translated text to total number of messages + if abbr == 'en': + percent = 100 + else: + num_translations = self._get_catalog_size(translation) + percent = int((num_translations / self._total_messages) * 100) + # prevent cases where the .pot file is out of date and the percentage is above 100 + percent = min(100, percent) + + language = Language(abbr, lang, translation, percent, translated_lang, console_font) + languages.append(language) + return languages def _load_language_mappings(self) -> list[dict[str, str]]: