help-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is there any way to intercept "linux" command call and change its ar


From: Glenn Washburn
Subject: Re: Is there any way to intercept "linux" command call and change its args?
Date: Tue, 6 Jun 2023 01:01:42 -0500

On Sun, 4 Jun 2023 18:41:56 +0300
Adam Vodopjan <adam.vodopjan@gmail.com> wrote:

> I make a grub config to boot iso images which provide loopback.cfg. So
> after some preliminary steps I run `configfile
> /boot/grub/loopback.cfg` and it works as supposed.
> 
> The problem is I'd like to modify `linux`'s args used in
> `loopback.cfg` (or its subsequent configs) without touching the iso
> images.
> 
> Speaking in bash terms let `linux` be a builtin and I want to remove
> `quiet` from all calls to `linux`. Since functions override builtins,
> I'd just override it with a function:
> 
> linux () {
>     local arg args=()
> 
>     for arg; do
>         [[ $arg == quiet ]] || args+=("$arg")
>     done
> 
>     builtin linux "${args[@]}"
> 
> }
> 
> 
> Is there anything similar in grubscript (not in the approach, but in
> the result)? I tried to create `linux` function, but the command still
> overrides it when called.

Unfortunately official GRUB2 does not allow this type of behavior. I've
submitted two patch series providing this functionality, one in 2014
and one in 2021[1]. There was no reply, so I'm not sure if the current
GRUB2 maintainer is in principle against this or not.

Glenn

[1] https://lists.gnu.org/archive/html/grub-devel/2021-03/msg00292.html



reply via email to

[Prev in Thread] Current Thread [Next in Thread]