summaryrefslogtreecommitdiff
path: root/mkgrubcfg.sh
blob: 4be770bc8208cac342f4d2e0a7c82f877bd4be40 (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
32
33
34
35
36
37
# generate GRUB menuentry
# usage: UUID="$UUID" ISOFILE="$ISOFILE" ./mkgrubcfg.sh <entryfile>
#
# variables in entryfile:
# - UUID: the UUID of the partition
# - ISOFILE: the file name of iso
#
# parameters in entry file:
# - TITLE: GRUB menu entry title
# - KERNEL: path to kernel image
# - INITRD: path to initramfs/initrd image
# - OPTION: kernel command line
# - X64: y/n, indicates whether it's 64-bit

source "$1"

if [ "$X64" = y ]; then
	echo 'if cpuid -l; then'
fi

cat << EOF
menuentry '$TITLE' {
	linux $KERNEL $OPTION
EOF

for _initrd in "${INITRD[@]}"
do
	echo -e "\tinitrd $_initrd"
done

echo '}'

if [ "$X64" = y ]; then
	echo 'fi'
fi

echo