Skip to content

Commit

Permalink
Fixes #16705 - copy signed grubx64.efi from /boot (#311)
Browse files Browse the repository at this point in the history
  • Loading branch information
lzap authored and ekohl committed Nov 24, 2016
1 parent af05b07 commit 3c11b38
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
13 changes: 3 additions & 10 deletions manifests/tftp.pp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
} else {
$grub_type = 'redhat'
}
# taken from http://pkgs.fedoraproject.org/cgit/rpms/grub2.git/tree/grub2.spec
$grub_modules = 'all_video boot btrfs cat chain configfile echo efifwsetup efinet ext2 fat font gfxmenu gfxterm gzio halt hfsplus iso9660 jpeg loadenv loopback lvm mdraid09 mdraid1x minicmd normal part_apple part_msdos part_gpt password_pbkdf2 png reboot search search_fs_uuid search_fs_file search_label serial sleep syslinuxcfg test tftp video xfs linux backtrace usb usbserial_common usbserial_pl2303 usbserial_ftdi usbserial_usbdebug linuxefi'
}
'Debian': {
$grub_type = 'debian'
Expand Down Expand Up @@ -67,14 +65,9 @@
'redhat': {
ensure_packages(['grub2-efi','grub2-efi-modules','grub2-tools','shim'], { ensure => 'installed', })

exec {'build-grub2-efi-image':
command => "/usr/bin/grub2-mkimage -O x86_64-efi -d ${efi_dir} -o ${foreman_proxy::tftp_root}/grub2/grubx64.efi -p '' ${grub_modules}",
creates => "${foreman_proxy::tftp_root}/grub2/grubx64.efi",
require => [File[$foreman_proxy::tftp_dirs], Package['grub2-tools']],
} ->
file {"${foreman_proxy::tftp_root}/grub2/grubx64.efi":
mode => '0644',
owner => 'root',
foreman_proxy::tftp::copy_file{"/boot/efi/EFI/${grub_efi_path}/grubx64.efi":
target_path => "${foreman_proxy::tftp_root}/grub2",
require => File[$foreman_proxy::tftp_dirs],
}

foreman_proxy::tftp::copy_file{"/boot/efi/EFI/${grub_efi_path}/shim.efi":
Expand Down
17 changes: 9 additions & 8 deletions spec/classes/foreman_proxy__config__spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -324,24 +324,25 @@
it { should contain_package('grub2-efi-modules').with_ensure('installed') }
it { should contain_package('grub2-tools').with_ensure('installed') }
it { should contain_package('shim').with_ensure('installed') }
it 'should generate efi image from grub2 modules' do
should contain_exec('build-grub2-efi-image').
with_creates("#{tftp_root}/grub2/grubx64.efi")
should contain_file("#{tftp_root}/grub2/grubx64.efi").
with_mode('0644').
with_owner('root').
that_requires('Exec[build-grub2-efi-image]')
end
case facts[:operatingsystem]
when /^(RedHat|Scientific|OracleLinux)$/
it 'should copy the grubx64.efi for Red Hat and clones' do
should contain_foreman_proxy__tftp__copy_file('/boot/efi/EFI/redhat/grubx64.efi')
end
it 'should copy the shim.efi for Red Hat and clones' do
should contain_foreman_proxy__tftp__copy_file('/boot/efi/EFI/redhat/shim.efi')
end
when 'Fedora'
it 'should copy the grubx64.efi for Red Hat and clones' do
should contain_foreman_proxy__tftp__copy_file('/boot/efi/EFI/fedora/grubx64.efi')
end
it 'should copy the shim.efi for Fedora' do
should contain_foreman_proxy__tftp__copy_file('/boot/efi/EFI/fedora/shim.efi')
end
when 'CentOS'
it 'should copy the grubx64.efi for Red Hat and clones' do
should contain_foreman_proxy__tftp__copy_file('/boot/efi/EFI/centos/grubx64.efi')
end
it 'should copy the shim.efi for CentOS' do
should contain_foreman_proxy__tftp__copy_file('/boot/efi/EFI/centos/shim.efi')
end
Expand Down

0 comments on commit 3c11b38

Please sign in to comment.