#!/bin/bash
[ "$UID" != 0 ] && { exec sudo bash "$0" && exit 0; }
echo "Установка загрузчика GRUB EFI на Void и обновление меню GRUB."
TARGET="/mnt"
#mount -m /dev/sda3 "$TARGET"
#mount -m /dev/sda1 "$TARGET/boot/efi"
mount -B /dev "$TARGET/dev"
mount -B /proc "$TARGET/proc"
mount -B /sys "$TARGET/sys"
xbps-install -r "$TARGET" -y -u xbps
xbps-install -r "$TARGET" -y -Su
xbps-install -r "$TARGET" -y grub-utils grub-x86_64-efi
chroot "$TARGET" grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=void_grub
chroot "$TARGET" grub-mkconfig -o "/boot/grub/grub.cfg"
