Manage grub-efi installation

This commit is contained in:
Jeremy Gardais 2019-01-10 13:33:19 +01:00
parent 15168cad49
commit bc7ee25afb
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
2 changed files with 20 additions and 1 deletions

Binary file not shown.

View File

@ -94,6 +94,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
@ -107,7 +127,6 @@ cp -- "${RSYSLOGD_INCLUDE_SRC}"* "${RSYSLOGD_INCLUDE_PATH}"
systemctl restart rsyslog
### }}}
### Logrotate {{{
# Install new Logrotate configuration