Skip to content

WIP: Add support for GRUB #4

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

Closed
wants to merge 3 commits into from
Closed

WIP: Add support for GRUB #4

wants to merge 3 commits into from

Conversation

mkessler001
Copy link
Collaborator

@mkessler001 mkessler001 commented Feb 17, 2020

Similar to zedenv, this project needs support for GRUB. This means, that after a change of the current state by one of the following commands

  • activate
  • destroy
  • clone
  • rename

all boot environments must be mounted and the grub.cfg file re-created.
I've labeled this pull request as work in progress. This makes it easier to discuss about code segments and keep track of the current state.

TODO List:

  • Mount all boot environments to a temporary directory (C - grub_generator)
  • Create main entries from activated boot environment (C - grub_generator)
  • Create submenu from all boot environments (Python / C - grub_generator)
  • Unmount all boot environments (C - grub_generator)

As already discussed, it would be preferable to implement the generator in Python instead of placing a non-readable binary at /etc/grub.d/. An additional advantage of this method is that we avoid the String-handling in C and reuse your code from zedenv.

Update: For the first version, I am going to implement the grub_generator in C.

@johnramsden
Copy link
Owner

@mkessler001 did you need help with getting this going, and did you want to split up some of the work? Potentially to start one of us could work on the generator, and one of us the plugin integration.

Let me know if that would be helpful.

We had also also discussed writing the generator in C++, is that still the route you wanted to take?

@mkessler001
Copy link
Collaborator Author

@mkessler001 did you need help with getting this going, and did you want to split up some of the work? Potentially to start one of us could work on the generator, and one of us the plugin integration.

Let me know if that would be helpful.

We had also also discussed writing the generator in C++, is that still the route you wanted to take?

I updated the PL description - the first version will be in C (b4eb455). As our setups are quite different in terms of mounting the boot dataset (reading /etc/fstab vs. determining the current boot environment via a custom script during startup), I would suggest to implement the grub support not as a plugin bot as a standalone executable (b4eb455 - grub.d/grub_generator).

@johnramsden
Copy link
Owner

Yeah that makes perfect sense having a stand-alone executable, just like what we did in Python.

What is the plan in terms of determining the boot dataset? Consolidating on using fstab could be an option, especially since much of the work has already been done once in the systemd plugin.

The other option would be a systemd mount unit, which is essentially what the fstab generates, however I think this would be a bad option with grub in case users want to use the plugin without systemd.

The last option like you said is a script which determines the correct dataset, what do you see as the benefits of this over modifying fstab?

@johnramsden
Copy link
Owner

Moved grub work to an external plugin johnramsden/zectl-grub

@johnramsden johnramsden closed this Jun 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants