Skip to content

Commit

Permalink
Make %{efi_arch} and %{efi_arch_upper} work.
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Jones <[email protected]>
  • Loading branch information
vathpela committed Apr 30, 2018
1 parent 78034f6 commit f3b5e45
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 12 deletions.
1 change: 1 addition & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ The following rpm macros are set:
%efi_esp_boot the full path to \EFI\BOOT on the EFI System Partition
%efi_esp_dir the full path to your vendor directory on the EFI System Partition
%efi_arch the EFI architecture name, e.g. x64
%efi_arch_upper the EFI architecture name in upper case, e.g. X64
63 changes: 51 additions & 12 deletions macros.efi.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,54 @@
%efi_esp_boot %{efi_esp_efi}/BOOT
%efi_esp_dir %{efi_esp_efi}/%{efi_vendor}

%ifarch aarch64
%global efi_arch aa64
%endif
%ifarch %{arm}
%global efi_arch arm
%endif
%ifarch %{ix86}
%global efi_arch ia32
%endif
%ifarch x86_64
%global efi_arch x64
%endif
%efi_arch %{lua:
-- test if our arch matches
local function ifarch(archmacro)
local target = rpm.expand(" %{_target_cpu} ")
local arches = rpm.expand(" " .. archmacro .. " ")
local match = string.match(arches, target)
if not (match == nil) then
return true
end
end
-- Do the work
if ifarch("x86_64") then
print("x64")
elseif ifarch("%{ix86}") then
print("ia32")
elseif ifarch("aarch64") then
print("aa64")
elseif ifarch("%{arm}") then
print("arm")
elseif ifarch("ia64") then
print("ia64")
else
print("")
end
}

%efi_arch_upper %{lua:
-- test if our arch matches
local function ifarch(archmacro)
local target = rpm.expand(" %{_target_cpu} ")
local arches = rpm.expand(" " .. archmacro .. " ")
local match = string.match(arches, target)
if not (match == nil) then
return true
end
end
-- Do the work
if ifarch("x86_64") then
print("X64")
elseif ifarch("%{ix86}") then
print("IA32")
elseif ifarch("aarch64") then
print("AA64")
elseif ifarch("%{arm}") then
print("ARM")
elseif ifarch("ia64") then
print("IA64")
else
print("")
end
}

0 comments on commit f3b5e45

Please sign in to comment.