[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
grub 2.00 conditional structures syntax (in *.cfg)
From: |
sashab |
Subject: |
grub 2.00 conditional structures syntax (in *.cfg) |
Date: |
Wed, 16 Oct 2013 20:58:48 +0200 |
User-agent: |
freenetMail |
Dear all,
unfortunately i was not able to find any documentation on usage of conditional
statements in grub configuration files.
According to the “GNU GRUB Manual 2.00~rc1” found on http://www.gnu.org/ the
words 'if', 'fi', 'case', 'esac', 'in' and so on are reserved.
Furthermore the scripting language is referred to as “Shell-like”.
Simple “if ; then #dosomething; fi”-statements are not problematic.
But I wasn't able to find a functional syntax for the case-statements.
To make it short: I would like to compare strings in the grub cli.
Is there any more or less exhaustive documentation about the syntax or am I
just too dumb to use google?
The most recent version I used to test stuff was the 2.00 that comes shipped
with arch linux.
What I'm trying to do:
I want to implement a grub configuration file that automatically generates menu
entries.
For en example:
The following procedure should create entries for (small) files to be loaded
with memdisk ( from the syslinux project).
/boot/memsik is our kernel.
Our file is the initrd.
We assume that the files can be PREFIX_*.* or just *.* or README*.
(e.g. README || FLOPPY_dellbiosupdate.img || freedos.img)
The README*-files should not be processed.
For files with a prefix, the prefix should be appended as a kernel-parameter.
For files without there are no parameters to append.
I supposed that this would be “shell-like” (file=$img):
. ..
insmod ext2
insmod regexp
. ..
set pathtoimages=”/boot/images”
. ..
for img in $/*; do
set appendstr=””
...
case $ in
$/README*) continue ;;
$/FLOPPY_*) set appendstr=$ floppy ;;
…
esac
menuentry “MEMDISK - $img” “$img” “$appendstr”
initrd16 $
}
done
. ..
I also tried to use other quoting notations with no success.
Futhermore I also tried “if ]; ...”.
Of course, in this case, I could do somthing like this:
for foo in $/FLOPPY_*; do
if ; then
menuentry “MEMDISK - $img” “$img”
}
fi
done
for foo in $/RAW_*; do
...
done
But i think this is less nice and produces much more code...
Thank you very much in advance!
With kind regards,
sashab
P.S.: Sorry if something's misspelled, English isn't my native tongue.
---
Alle Postfächer an einem Ort. Jetzt wechseln und E-Mail-Adresse mitnehmen!
http://email.freenet.de/basic/Informationen
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- grub 2.00 conditional structures syntax (in *.cfg),
sashab <=