On Tue 19 Jan 22:26:51 2010, Robert Millan wrote:
On Mon, Jan 18, 2010 at 09:03:53PM +0000, Martin Orr wrote:
I would like to be able to choose between alternative Linux command
lines in my GRUB menu (specifically, I want a "selinux=0" option, but I
can imagine that people might want other things). I could add an extra
script to /etc/grub.d to do this, but then I have to copy the logic in
10_linux to detect what kernel versions are available, and they do not
appear in the correct place in the menu. It would be simpler if you
could specify variant command lines in /etc/default/grub and have them
handled automatically in 10_linux.
The attached patch allows (for example) the following configuration in
/etc/default/grub:
GRUB_LINUX_VARIANTS="noselinux kms"
GRUB_CMDLINE_LINUX_noselinux="selinux=0"
GRUB_LABEL_LINUX_noselinux="SELinux disabled"
GRUB_CMDLINE_LINUX_kms="i915.modesetting=1"
GRUB_LABEL_LINUX_kms="KMS enabled"
This patch is only intended as a demonstration: various details of the
implementation still need to be sorted out, such as
internationalization. Suggestions of wildly different
approaches/configuration interfaces are welcome.
I think this is growing severely overengineered. It is already more
complex than it needs to be.
The scripts in /etc/grub.d *are* config files. There's no reason you
can't edit them to suit your needs.
I agree that my solution does seem rather overengineered.
My problem is that while /etc/grub.d/* may be config files in some
technical sense, they don't behave like them. In particular for most
config files, changes you make are largely "orthogonal" to the rest of
the file whereas my changes to /etc/grub.d are mixed in with complex
logic which I have no interest in changing. Combined with frequent
changes to the default version of the file, this makes merging new
versions a burden.
My patch reduces the configuration needed to set up variant command
lines to a few lines in /etc/default/grub, which are indeed orthogonal
to the rest of the file.
To specify more precisely what I dislike about just editing 10_linux,
the change that I would want to make (and I would guess that this is
the change people would most often want to make) is to add an extra
call to linux_entry. But linux_entry is an "internal" interface which
could change its arguments in arbitrary ways, and it doesn't even
provide the features I need (specifically a label argument, added to
the title of the menu entry) so I end up having to patch linux_entry
itself as well as adding a new call, and keep these matching whenever
the default linux_entry changes.
Best wishes,
--
Martin Orr
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel