X-Git-Url: https://git.proxmox.com/?p=pve-installer.git;a=blobdiff_plain;f=Proxmox%2FInstall%2FRunEnv.pm;h=39505d08e9856aa28906d818a2aa332e33d2ac13;hp=25b6bb3db25a648328ac69f321e84c93ca895fd8;hb=refs%2Fheads%2Fmaster;hpb=db8fe71b259dd7f1cf713de0f97295924f9ba2cb diff --git a/Proxmox/Install/RunEnv.pm b/Proxmox/Install/RunEnv.pm index 25b6bb3..7eaf96a 100644 --- a/Proxmox/Install/RunEnv.pm +++ b/Proxmox/Install/RunEnv.pm @@ -8,7 +8,7 @@ use JSON qw(from_json to_json); use Proxmox::Log; use Proxmox::Sys::Command qw(run_command CMD_FINISHED); -use Proxmox::Sys::File qw(file_read_firstline); +use Proxmox::Sys::File qw(file_read_all file_read_firstline); use Proxmox::Sys::Block; use Proxmox::Sys::Net; @@ -285,6 +285,16 @@ sub query_installation_environment : prototype() { $output->{hvm_supported} = query_cpu_hvm_support(); $output->{boot_type} = -d '/sys/firmware/efi' ? 'efi' : 'bios'; + if ($output->{boot_type} eq 'efi') { + my $content = eval { file_read_all("/sys/firmware/efi/efivars/SecureBoot-8be4df61-93ca-11d2-aa0d-00e098032b8c") }; + if ($@) { + log_warn("Failed to read secure boot state: $@\n"); + } else { + my @secureboot = unpack("CCCCC", $content); + $output->{secure_boot} = $secureboot[4] == 1; + } + } + my $err; my $country; if ($routes->{gateway4}) { @@ -302,7 +312,7 @@ sub query_installation_environment : prototype() { if (defined($country)) { $output->{country} = $country; } else { - warn ($err // "unable to detect country\n"); + warn ($err || "unable to detect country\n"); } return $output;