Skip to content

Commit

Permalink
Merge pull request #2341 from DaanDeMeyer/uefi
Browse files Browse the repository at this point in the history
Move shim for Fedora to uefi only packages
  • Loading branch information
DaanDeMeyer authored Feb 2, 2024
2 parents 50814f3 + aa78259 commit d3b035a
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
1 change: 0 additions & 1 deletion mkosi.conf.d/30-centos-fedora/mkosi.conf
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ Packages=
rpminspect-data-centos
rpminspect-data-fedora
shadow-utils
shim
socat
squashfs-tools
strace
Expand Down
1 change: 1 addition & 0 deletions mkosi.conf.d/30-centos-fedora/mkosi.conf.d/20-uefi.conf
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ Packages=
systemd-boot
pesign
edk2-ovmf
shim
7 changes: 1 addition & 6 deletions mkosi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
format_tree,
parse_config,
summary,
systemd_tool_version,
want_selinux_relabel,
yes_no,
)
Expand Down Expand Up @@ -2220,12 +2221,6 @@ def check_outputs(config: Config) -> None:
die(f"Output path {f} exists already. (Consider invocation with --force.)")


def systemd_tool_version(config: Config, tool: PathString) -> GenericVersion:
return GenericVersion(
run([tool, "--version"], stdout=subprocess.PIPE, sandbox=config.sandbox()).stdout.split()[2].strip("()")
)


def check_tool(config: Config, *tools: PathString, reason: str, hint: Optional[str] = None) -> Path:
tool = find_binary(*tools, root=config.tools())
if not tool:
Expand Down
6 changes: 6 additions & 0 deletions mkosi/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3763,3 +3763,9 @@ def want_selinux_relabel(config: Config, root: Path, fatal: bool = True) -> Opti
binpolicy = sorted(policies, key=lambda p: GenericVersion(p.name), reverse=True)[0]

return policy, fc, binpolicy


def systemd_tool_version(config: Config, tool: PathString) -> GenericVersion:
return GenericVersion(
run([tool, "--version"], stdout=subprocess.PIPE, sandbox=config.sandbox()).stdout.split()[2].strip("()")
)
12 changes: 10 additions & 2 deletions mkosi/qemu.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
QemuFirmware,
QemuVsockCID,
format_bytes,
systemd_tool_version,
want_selinux_relabel,
)
from mkosi.log import die
Expand Down Expand Up @@ -139,8 +140,15 @@ class KernelType(StrEnum):

@classmethod
def identify(cls, config: Config, path: Path) -> "KernelType":
type = run(["bootctl", "kernel-identify", path],
stdout=subprocess.PIPE, sandbox=config.sandbox(options=["--ro-bind", path, path])).stdout.strip()
if systemd_tool_version(config, "bootctl") < 253:
logging.warning("bootctl doesn't know kernel-identify verb, assuming 'unknown' kernel type")
return KernelType.unknown

type = run(
["bootctl", "kernel-identify", path],
stdout=subprocess.PIPE,
sandbox=config.sandbox(options=["--ro-bind", path, path]),
).stdout.strip()

try:
return cls(type)
Expand Down

0 comments on commit d3b035a

Please sign in to comment.