aboutsummaryrefslogtreecommitdiff
path: root/tools/gen_grub_cdrom.sh
blob: a1f1a1ce5f5b36f37ad387046f1f6973d72ca0f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env bash

# Ensure to abort on error
set -e

wai=$(dirname $(readlink -f "$0")) # Current script directory
outdir="${wai}/../"
cdrom="${outdir}/cdrom.img"
isodir="$(mktemp -d)" # Mount point (where the floppy will be mounted temporally
kernel="$outdir/src/boucane"

[ ! -e "$kernel" ] && { echo "Boucane not found!"; exit 1; } 

check_for () {
    command -v "$1" &>/dev/null || { echo "Command $1 not found!"; exit 1; }
}

check_for grub-mkconfig

mkdir -p $isodir/boot/grub
cat <<EOT >> $isodir/boot/grub/grub.cfg
set timeout=0
menuentry "kernel" {
    multiboot2 /boot/boucane
    boot
}
EOT
cp $kernel "$isodir/boot/"
grub-mkrescue -o "$cdrom" $isodir

rm -rf "$isodir"