[Bug 2052381] Re: [grub-mkconfig] Unable to modify current generating grub.cfg
Ubuntu Foundations Team Bug Bot
2052381 at bugs.launchpad.net
Sun Feb 4 16:14:43 UTC 2024
The attachment "Patch file" seems to be a patch. If it isn't, please
remove the "patch" flag from the attachment, remove the "patch" tag, and
if you are a member of the ~ubuntu-reviewers, unsubscribe the team.
[This is an automated message performed by a Launchpad user owned by
~brian-murray, for any issues please contact him.]
** Tags added: patch
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to grub2 in Ubuntu.
https://bugs.launchpad.net/bugs/2052381
Title:
[grub-mkconfig] Unable to modify current generating grub.cfg
Status in grub2 package in Ubuntu:
Confirmed
Bug description:
When you want to "alterate" current generating grub.cfg.new in
/etc/grub.d/* scripts, you cant sed -i in /boot/grub/grub.cfg.new due
to the used method for generating grub.cfg.new 'exec redirection'
I propose a more 'common' method, wich permit, for example, alterating
grub.cfg.new content, generated from /etc/grub.d/30_linux, in a
/etc/grub.d/90_custom script
diff file :
<pre>
19a20,22
> # [grub-mkconfig] Problem with generation method in grub-mkconfig
> # Patch submitted to bug-grub at gnu.org
>
39c42
< grub_cfg=""
---
> grub_cfg="/boot/grub/grub.cfg"
271a275
> NEW_GRUBCFG="${grub_cfg}.new"
273c277
< rm -f "${grub_cfg}.new"
---
> rm -f "${NEW_GRUBCFG}"
275c279
< exec > "${grub_cfg}.new"
---
> printf "" > "${NEW_GRUBCFG}"
281,282c285
< cat << EOF
< #
---
> DISCLAIMER="#
288c291,292
< EOF
---
> "
> printf "%s\n" "${DISCLAIMER}" >> "${NEW_GRUBCFG}"
299,302c303,309
< echo
< echo "### BEGIN $i ###"
< "$i"
< echo "### END $i ###"
---
> echo "" >> "${NEW_GRUBCFG}"
> echo "### BEGIN $i ###" >> "${NEW_GRUBCFG}"
> if ! "$i" >> "${NEW_GRUBCFG}";then
> echo "[ERROR] '$i' failed !" >&2
> exit 99
> fi
> echo "### END $i ###" >> "${NEW_GRUBCFG}"
308,311d314
< if [ "x${grub_cfg}" != "x" ] && ! grep "^password" ${grub_cfg}.new >/dev/null; then
< chmod 444 ${grub_cfg}.new || true
< fi
<
318c321
< %s file attached." "${grub_cfg}.new" >&2
---
> %s file attached." "${NEW_GRUBCFG}" >&2
</pre>
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/2052381/+subscriptions
More information about the foundations-bugs
mailing list