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
9 changes: 4 additions & 5 deletions archinstall/lib/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import re
import shlex
import shutil
import stat
import subprocess
import textwrap
import time
Expand All @@ -29,6 +28,7 @@
)
from archinstall.lib.exceptions import DiskError, HardwareIncompatibilityError, RequirementError, ServiceException, SysCallError
from archinstall.lib.hardware import SysInfo
from archinstall.lib.linux_path import LPath
from archinstall.lib.locale.utils import verify_keyboard_layout, verify_x11_keyboard_layout
from archinstall.lib.mirror.mirror_handler import MirrorListHandler
from archinstall.lib.models.application import ZramAlgorithm
Expand Down Expand Up @@ -1386,7 +1386,7 @@ def _add_grub_bootloader(
raise DiskError(f'Failed to install GRUB boot on {boot_partition.dev_path}: {err}')

if SysInfo.has_uefi() and uki_enabled:
grub_d = self.target / 'etc/grub.d'
grub_d = LPath(self.target) / 'etc/grub.d'
linux_file = grub_d / '10_linux'
uki_file = grub_d / '15_uki'

Expand All @@ -1406,10 +1406,9 @@ def _add_grub_bootloader(
)

try:
mode = linux_file.stat().st_mode
linux_file.chmod(mode & ~(stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH))
uki_file.write_text(content)
uki_file.chmod(mode)
uki_file.add_exec()
linux_file.remove_exec()
except OSError:
error('Failed to enable UKI menu entries')
else:
Expand Down
11 changes: 11 additions & 0 deletions archinstall/lib/linux_path.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import stat
from pathlib import Path
from typing import Self

Expand All @@ -9,3 +10,13 @@ def fs_root(cls) -> Self:

def relative_to_root(self) -> Self:
return self.relative_to(self.fs_root())

def add_exec(self) -> None:
"""Add execute permissions (mirrors `chmod +x`)."""
mode = self.stat().st_mode
self.chmod(mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)

def remove_exec(self) -> None:
"""Remove execute permissions (mirrors `chmod -x`)."""
mode = self.stat().st_mode
self.chmod(mode & ~(stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH))
Loading