Skip to content

Commit

Permalink
Forcing efibootmgr on UEFI systems
Browse files Browse the repository at this point in the history
Signed-off-by: Fabian Arrotin <[email protected]>
  • Loading branch information
arrfab committed Jan 17, 2023
1 parent 17b4544 commit 2f38cd1
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion templates/convert-to-rhel
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
logfile="/var/log/centos-convert-rhel.log"

function f_log () {
echo "[+] $(date +%Y%m%d-%H:%M) stylo -> $*" >>$logfile
echo "[+] $(date +%Y%m%d-%H:%M) -> $*" >>$logfile
}

f_log "Detecting if we have redhat-release package installed"
Expand All @@ -21,6 +21,16 @@ else
echo "Error converting to RHEL 8" >> $logfile
exit 1
else
if [ -d /sys/firmware/efi ] ; then
f_log "UEFI system detected, forcing efibootmanager"
efi_dev=$(mount|grep "boot/efi"|awk '{print $1}')
f_log "Detected EFI boot device is [${efi_dev:0:-1}]"
grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg
efibootmgr --create --disk=${efi_dev:0:-1} --part=1 --label="Red Hat Enterprise Linux" --loader='EFI\redhat\shimx64.efi' >> $logfile
if [ "$?" -ne "0" ] ; then
f_log "ERROR, not able to configure efibootmgr so machine will not reboot"
fi
fi
exit 2
fi
fi
Expand Down

0 comments on commit 2f38cd1

Please sign in to comment.