Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions archinstall/lib/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1480,20 +1480,20 @@ def _add_limine_bootloader(

parent_dev_path = get_parent_device_path(efi_partition.safe_dev_path)

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'
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'
config_path = efi_dir_path / 'limine.conf'

efi_dir_path.mkdir(parents=True, exist_ok=True)
efi_dir_path.mkdir(parents=True, exist_ok=True)

try:
for file in ('BOOTIA32.EFI', 'BOOTX64.EFI'):
(limine_path / file).copy_into(efi_dir_path)
except Exception as err:
Expand Down
59 changes: 30 additions & 29 deletions archinstall/lib/network/wifi_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ async def run(self) -> bool | None:
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')
Expand All @@ -72,18 +72,19 @@ async def _enable_supplicant(self, wifi_iface: str) -> 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')

Expand Down Expand Up @@ -197,22 +198,22 @@ def _wpa_cli(self, command: str, iface: str | None = None) -> WpaCliResult:

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(
success=False,
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)

Expand Down Expand Up @@ -254,18 +255,18 @@ def _get_scan_results(self, iface: str) -> list[WifiNetwork]:

try:
result = self._wpa_cli('scan_results', iface)
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.success:
debug(f'Failed to retrieve scan results: {result.error}')
return []

if not result.response:
debug('No wifi networks found')
return []
if not result.response:
debug('No wifi networks found')
return []

networks = WifiNetwork.from_wpa(result.response)
networks = WifiNetwork.from_wpa(result.response)

return networks
except SysCallError as err:
debug('Unable to retrieve wifi results')
raise err
return networks
8 changes: 4 additions & 4 deletions archinstall/lib/profile/profiles_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,10 @@ def _import_profile_from_url(self, url: str) -> None:
"""
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:
Expand All @@ -266,10 +270,6 @@ def _import_profile_from_url(self, url: str) -> None:

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]:
"""
Expand Down
37 changes: 19 additions & 18 deletions archinstall/lib/translationhandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,14 @@ def save_console_font(self) -> None:
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}')
Expand Down Expand Up @@ -136,21 +137,21 @@ def _get_translations(self) -> list[Language]:
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]]:
Expand Down