From 466a8179506647d33ee4511c6945f111d31d9500 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Sun, 2 Jun 2019 14:26:25 +0200 Subject: [PATCH] sync: Make this work for Fedora Fedora has grub2-install (rather than grub-install), and it expects grub.cfg to be placed in boot/grub2/ rather than boot/grub/. --- Kernel/sync.sh | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/Kernel/sync.sh b/Kernel/sync.sh index e918d102ce..4ed668a7c0 100755 --- a/Kernel/sync.sh +++ b/Kernel/sync.sh @@ -54,11 +54,23 @@ mkdir -p mnt/{boot,bin,etc,proc,tmp} chmod 1777 mnt/tmp echo "done" -echo "installing grub..." -mkdir -p mnt/boot/grub -cp grub.cfg mnt/boot/grub/grub.cfg -grub-install --boot-directory=mnt/boot --target=i386-pc --modules="ext2 part_msdos" ${dev} -echo "done" +grub=$(which grub-install 2>/dev/null) || true +if [[ -z "$grub" ]]; then + grub=$(which grub2-install 2>/dev/null) || true +fi +if [ -z "$grub" ]; then + echo "can't find a grub-install or grub2-install binary, oh no" + exit 1 +fi +echo "installing grub using $grub..." + +$grub --boot-directory=mnt/boot --target=i386-pc --modules="ext2 part_msdos" ${dev} + +if [ -d mnt/boot/grub2 ]; then + cp grub.cfg mnt/boot/grub2/grub.cfg +else + cp grub.cfg mnt/boot/grub/grub.cfg +fi echo -n "setting up device nodes... " mkdir -p mnt/dev