summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Burchell <robin+git@viroteck.net>2019-06-02 14:26:25 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-06-02 14:46:59 +0200
commit466a8179506647d33ee4511c6945f111d31d9500 (patch)
tree9b3cc48ba2df8fec9b5e1547756182253f2f522e
parent7bce096afdf182216c9da4c94765e12662188c98 (diff)
downloadserenity-466a8179506647d33ee4511c6945f111d31d9500.zip
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/.
-rwxr-xr-xKernel/sync.sh22
1 files 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