-
Notifications
You must be signed in to change notification settings - Fork 305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ostree-grub-generator: allow adding custom scripts to grub.cfg #3162
base: main
Are you sure you want to change the base?
Conversation
This changes allow us to customize grub.cfg without manually editing it. Now, whatever files found under /etc/ostree.d are added (in alphabetical order) between the cfg header and its menuentries, allowing to add custom logic to the bootloader in a non intrusive way. Signed-off-by: Eduardo Ferreira <[email protected]>
Hi @EdTheBearded. Thanks for your PR. I'm waiting for a ostreedev member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
I'm not opposed exactly, but I don't quite understand. grub has a fully generic system for injecting code, why can't you drop your extra stuff into the existing On the topic of configuring rollbacks and grub configs, you may also want to look into https://github.com/coreos/bootupd/ which is intended to pair with ostree - bootupd supports an opinionated "static grub config" model where we don't regenerate any grub configs when updating the kernel, assuming GRUB has been patched to read from Also, there is https://github.com/fedora-iot/greenboot/ (currently relies on rpm-ostree, not ostree, but that is conceptually a bug) which also now injects some grub logic via bootupd, see fedora-iot/greenboot#129 |
@@ -25,6 +25,7 @@ script=$(basename ${0}) | |||
# Atomically safe location where to generete grub.cfg when executing system upgrade. | |||
new_grub2_cfg=${2} | |||
entries_path=$(dirname $new_grub2_cfg)/entries | |||
custom_scripts="/etc/ostree.d" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like it should be e.g. /etc/ostree-grub.d
or so.
Hello!
I would like to propose this change here, since this may help someone else.
First the motivation for this change: rollback
We wanted to be able to perform a rollback if our update was unsuccessful in some way. And for that we needed to add some logic to
grub.cfg
script to get it done.With that in mind, I tried to do this without changing too much or just manually editing
grub.cfg
. I took some inspiration on whatgrub-mkconfig
does: check/etc/grub.d
for custom scripts, and add those to the finalgrub.cfg
script, parsing the files in their alphabetical order.So with this change, whatever files found under
/etc/ostree.d
(just went with whatever name at the time) are added (in alphabetical order) between the cfg header and its menuentries, allowing to add custom logic to the bootloader in a non intrusive way.NOTE: we're using this on Yocto, so there's also a minor change to be done in ostree recipe, to create the
/etc
folder being used.