#!/bin/bash source /etc/holoiso-release if [[ $EUID -ne 0 ]]; then exec pkexec --disable-internal-agent "$0" "$@" fi EFI_LOCATION=$(realpath /dev/disk/by-label/holo_efi) EFI_STORAGE="/dev/$(lsblk -no pkname ${EFI_LOCATION} | tr -d '[:space:]')" echo ${EFI_LOCATION} | grep -q -P "^/dev/(nvme|loop|mmcblk)" if [ $? -eq 0 ]; then EFI_PARTNUM=$(echo ${EFI_LOCATION} | cut -d "p" -f 2) else EFI_PARTNUM=$(echo ${EFI_LOCATION} | rev | cut -c 1 | rev) fi echo "Removing previous HoloISO boot entries" for entry in $(efibootmgr | grep -e steamos -e HoloISO | awk '{gsub(/Boot|[*0]/,""); print $1}') do efibootmgr -b $entry -B 1>/dev/null done mount -L holo_efi /boot/efi echo "Removing previous HoloISO EFI installations" rm -rf /boot/efi/* grub-install --target=x86_64-efi --efi-directory=/boot/efi grub-mkconfig -o /boot/grub/grub.cfg echo "Installing grub entry on ${EFI_STORAGE}, partition number ${EFI_PARTNUM}" CENTRY=$(find /boot/efi/ | sed 's/\/boot\/efi//g' | sed 's|/|\\|g' | tail -n1) efibootmgr -c -d ${EFI_STORAGE} -p ${EFI_PARTNUM} -L "HoloISO $OS_TAG (GRUB)" -l "${CENTRY}" 1>/dev/null umount -l /boot/efi