diff --git a/scripts/latecommand.tar.gz b/scripts/latecommand.tar.gz index 2f30054..3ee2337 100644 Binary files a/scripts/latecommand.tar.gz and b/scripts/latecommand.tar.gz differ diff --git a/scripts/latecommand/post.stretch.sh b/scripts/latecommand/post.stretch.sh index ca49ad3..3ff22dd 100755 --- a/scripts/latecommand/post.stretch.sh +++ b/scripts/latecommand/post.stretch.sh @@ -83,6 +83,26 @@ aptitude -y purge '~c' ## }}} +# Grub {{{ + +## If EFI directory is present +EFI_PATH="/boot/efi" +if [ -d "${EFI_PATH}" ]; then + ## Install grub-efi + aptitude install -y grub-efi-amd64 + ## Get grub device (keep only some patterns, eg. /dev/sda, /dev/vda, /dev/nvme0n1,…) + GRUB_DEVICE=$(sed -n "s;^\(/dev/[a-z]\{3\}\|/dev/nvme[a-z0-9]\{3\}\)\(p[0-9]\|[0-9]\) ${EFI_PATH} .*;\1;p" /etc/mtab) + grub-install --target=x86_64-efi "${GRUB_DEVICE}" 2>/dev/null + if [ -d "${EFI_PATH}"/EFI ]; then + ## Copy efi entries to a boot directory + mkdir -p -- "${EFI_PATH}"/EFI/boot + find "${EFI_PATH}"/EFI/grub -type f -iname "grubx64.efi" -exec cp {} "${EFI_PATH}"/EFI/boot/bootx64.efi \; -quit 2>/dev/null + find "${EFI_PATH}"/EFI/debian -type f -iname "grubx64.efi" -exec cp {} "${EFI_PATH}"/EFI/boot/bootx64.efi \; -quit + fi +fi + +### }}} + ### Rsyslog {{{ # Install new Rsyslog configuration @@ -95,7 +115,6 @@ cp -- "${RSYSLOGD_INCLUDE_SRC}"* "${RSYSLOGD_INCLUDE_PATH}" systemctl restart rsyslog ### }}} - ### Logrotate {{{ # Install new Logrotate configuration