From 256b7cad924ca5a86187b2f7a15fbcc3a4f545ba Mon Sep 17 00:00:00 2001 From: Thomas Bellman <bellman@lysator.liu.se> Date: Wed, 11 Apr 2018 19:05:12 +0200 Subject: [PATCH] Handle UEFI systems when rebuilding Grub 2 config file. On UEFI systems, grub.cfg is in /boot/efi/EFI/<os>/grub.cfg instead of in /boot/grub2/grub.cfg. Luckily, instead of having to know what "<os>" needs to be instantiated with (e.g. "centos"), it seems that we can just point grub2-mkconfig to the symlink /etc/grub2-efi.cfg. (This at least works on RedHat:ish systems.) --- manifests/grub2/rebuild_grub_cfg.pp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/manifests/grub2/rebuild_grub_cfg.pp b/manifests/grub2/rebuild_grub_cfg.pp index 498f890..d63944b 100644 --- a/manifests/grub2/rebuild_grub_cfg.pp +++ b/manifests/grub2/rebuild_grub_cfg.pp @@ -1,4 +1,4 @@ -# Copyright © 2017 Thomas Bellman, Linköping, Sweden +# Copyright © 2017-2018 Thomas Bellman, Linköping, Sweden # Licensed under the GNU LGPL v3+; see the README file for more information. @@ -9,8 +9,9 @@ class bootloader::grub2::rebuild_grub_cfg { exec { 'bootloader::grub2::rebuild_grub_cfg': - command => 'grub2-mkconfig -o /boot/grub2/grub.cfg', + command => 'if [ -f /etc/grub2-efi.cfg ]; then grub2-mkconfig -o /etc/grub2-efi.cfg; else grub2-mkconfig -o /boot/grub2/grub.cfg; fi', path => ['/bin', '/usr/bin', '/sbin', '/usr/sbin'], + provider => 'shell', refreshonly => true; } } -- GitLab