[grub-mkconfig] Unable to modify current generating grub.cfg

Bug #2052381 reported by Alban Ponche
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
grub2 (Ubuntu)
Confirmed
Undecided
Unassigned

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 <email address hidden>
>
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>

Revision history for this message
Alban Ponche (albanponche) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in grub2 (Ubuntu):
status: New → Confirmed
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

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
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.