From a495a20d9577d9111b8764a71bdaf5f6b47d0553 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 20 Dec 2016 11:08:24 +0100 Subject: [PATCH] uefi support Signed-off-by: Steven Armstrong --- .../__install_bootloader_grub/gencode-remote | 40 ++++++++++++++----- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/cdist/conf/type/__install_bootloader_grub/gencode-remote b/cdist/conf/type/__install_bootloader_grub/gencode-remote index 0ca94b90..0db6dee6 100755 --- a/cdist/conf/type/__install_bootloader_grub/gencode-remote +++ b/cdist/conf/type/__install_bootloader_grub/gencode-remote @@ -35,22 +35,41 @@ printf '#!/bin/sh -l\n' case "$target_os" in ubuntu|debian) - printf 'grub-install "%s"\n' "$device" - printf 'update-grub\n' + if [ -s "$__global/explorer/efi" ]; then + # FIXME: untested. maybe also just run update-grub for EFI system? + printf 'grub-mkconfig --output=/boot/efi/EFI/%s/grub.cfg\n' "$target_os" + printf 'mkdir -p /boot/efi/EFI/BOOT\n' + printf 'cp /boot/efi/EFI/%s/grubx64.efi /boot/efi/EFI/BOOT/bootx64.efi' "$target_os" + else + printf 'grub-install "%s"\n' "$device" + printf 'update-grub\n' + fi ;; archlinux) - # bugfix/workarround: rebuild initramfs - # FIXME: doesn't belong here - printf 'grub-install "%s"\n' "$device" - printf 'mkinitcpio -p linux\n' - printf 'grub-mkconfig -o /boot/grub/grub.cfg\n' + if [ -s "$__global/explorer/efi" ]; then + echo "EFI boot loader installation is on your operating system ($target_os) is currently not supported by this type (${__type##*/})." >&2 + echo "Please contribute an implementation for it if you can." >&2 + exit 1 + else + printf 'grub-install "%s"\n' "$device" + # bugfix/workarround: rebuild initramfs + # FIXME: doesn't belong here + printf 'mkinitcpio -p linux\n' + printf 'grub-mkconfig -o /boot/grub/grub.cfg\n' + fi ;; centos) - printf 'grub2-install "%s"\n' "$device" - printf 'grub2-mkconfig --output=/boot/grub2/grub.cfg\n' + if [ -s "$__global/explorer/efi" ]; then + printf 'grub2-mkconfig --output=/boot/efi/EFI/%s/grub.cfg\n' "$target_os" + printf 'mkdir -p /boot/efi/EFI/BOOT\n' + printf 'cp /boot/efi/EFI/%s/grubx64.efi /boot/efi/EFI/BOOT/bootx64.efi' "$target_os" + else + printf 'grub2-install "%s"\n' "$device" + printf 'grub2-mkconfig --output=/boot/grub2/grub.cfg\n' + fi ;; *) - echo "Your operating system ($os) is currently not supported by this type (${__type##*/})." >&2 + echo "Your operating system ($target_os) is currently not supported by this type (${__type##*/})." >&2 echo "If you can, please contribute an implementation for it." >&2 exit 1 ;; @@ -74,4 +93,5 @@ chmod +x "\$script" # Run script in chroot relative_script="\${script#$chroot}" chroot "$chroot" "\$relative_script" +rm -rf \$script DONE