class base_installation::grub inherits base_installation { ensure_packages(['grub']) if !empty($base_installation::grub_efi_device) { ensure_packages(['efibootmgr']) exec { 'install GRUB UEFI': command => "/usr/bin/mkdir /boot/efi && /usr/bin/mount ${base_installation::grub_efi_device} /boot/efi && /usr/bin/grub-install --efi-directory=/boot/efi --target=x86_64-efi && /usr/bin/umount /boot/efi && /usr/bin/rmdir /boot/efi", creates => "/boot/grub/x86_64-efi", subscribe => Package["grub"], } } elsif !empty($base_installation::grub_device) { exec { 'install GRUB MBR': command => "/usr/bin/grub-install --target=i386-pc $base_installation::grub_device", creates => "/boot/grub/i386-pc", subscribe => Package["grub"], } } if ($environment == "workstation" and !empty($base_installation::cryptroot_device)) { file_line { "/etc/default/grub#GRUB_CMDLINE_LINUX": path => "/etc/default/grub", line => "GRUB_CMDLINE_LINUX=\" cryptdevice=UUID=${base_installation::cryptroot_device}:cryptroot\"", match => '^GRUB_CMDLINE_LINUX=', require => Package["grub"], notify => Exec["update GRUB config"], } } elsif ($environment != "workstation") { file_line { "/etc/default/grub#GRUB_CMDLINE_LINUX": path => "/etc/default/grub", line => 'GRUB_CMDLINE_LINUX=" console=tty0 console=ttyS0,115200"', match => '^GRUB_CMDLINE_LINUX=', require => Package["grub"], notify => Exec["update GRUB config"], } } exec { 'update GRUB config': command => "/usr/bin/grub-mkconfig -o /boot/grub/grub.cfg", refreshonly => true } }