Conversation
|
This flow for arch setups seems much better, the only concern I have is here: If it's an arch system and is being run by the package manager, I think it should raise an exception if it can't determine the output file name It would also be possible to simply turn this arch detection stuff into its own autodetect hook which runs after "get_kernel_version" so the out_file can be set there and nothing needs to be adjusted in the cpio module. The "get_archive_name" function should only be run if the out_file is not already set, so the logic there is mostly for determining a sane name if nothing is set. This custom arch function doesn't necessarily have to be in the kmod module either. Within reason, things should not be setting "out_file" if it's already set unless it's certain it should get a custom name. In the case of gentoo systems, installkernel passes the file name it wants as an arg and that's simply used without any "internal" logic. If the install script/hook can somehow pass this info, most of the custom logic for arch stuff could possibly be removed. If possible, I'd lean towards a way for the file name to be determined in the hook. (no extra internal logic) |
|
The install hook and script should guarantee that an initramfs is generated at I think
I think I'd like that approach since it sounds like a more simple change, but I'm not sure where that would go. Could you point me to that? |
Ah I see, this line alone should be enough: ugrd --kver "$kver" "/boot/initramfs-${pkgbase}.img" I'm not sure there is any need to adjust the ugrd code itself for the hook updates you made. The typo/doc fixes are still nice though |
I'd still like to make it the default when Arch users run ugrd directly. I think users coming from other initramfs generators will find it weird if they have to manually set it or copy it |
this is kinda the intended behavior if it's run without args being supplied, just so important files are never overwritten if someone wants to test ugrd. If someone wants ugrd to overwrite a particular file all of the time, setting I can see the value in the kver determining bit working a different way to use package info instead of reading a kernel file, but that mechanism was mostly a crutch to handle the install hook not passing kver info (or the output file) |
I think that how it currently cycles the old initramfs instead of overwriting: is a good way to handle that.
What do you mean? |
This behavior is defined by the The problem is that someone could run ugrd a few times to see if it works for their setup and end up cycling the old initramfs out of existence. This is probably unlikely but if someone was confused ran ugrd a few times, it would happen. Not that it's impossible to regenerate the old initramfs in most cases, but I like that it's entirely non-destructive unless you tell it to replace an "important" file, or the package manager does.
I mean as long as the kernel install hook is setting the kver and output file name, ugrd itself doesn't need any internal logic. The current logic for arch setups is a bit of a hack to make things work without the hook providing that info. If there is going to be a hack used, I think it makes sense that it gets the kernel info from the package manager instead of reading files somewhat blindly to get that info. In most cases, just running "ugrd" with no extra config is designed to not touch any boot files. The intended design is that this info is provided by the install script, and will fail if that info (mostly the kver) is not usable. |
Ok, I'm fine with not touching boot files when run without args. Should I revert all the logic changes in cpio + kmod? |
yes, the hooks look good to me (i have not tested them yet because i don't have an up to date arch setup) the typo fixes are nice but probably belong in another PR, I don't mind the adjustment to get the kver from pkgbuild, but I think the logic should be setup so it doesn't run if out_file is already set. I'd prioritize the hook so it can just get passed the correct kver/output file path "externally" |
Install vmlinuz to /boot and generate initramfs with pkgbase-based naming (/boot/initramfs-linux.img) instead of kernel version. Add removal hook to clean up files when kernel packages are removed.
dfdc494 to
8fceeee
Compare
|
Removed changes to cpio and kmod. cherry-picked typo fixes to a different branch. and squashed my changes to one clean commit. I've tested the install and remove hook and they're working properly |
|
Thank you very much, this looks good to me! |
Arch Linux kernel packages include a
pkgbasefile that identifies the packagename (e.g., "linux", "linux-lts"). Bootloaders typically expect initramfs files named
by this
pkgbasevalue, not by kernel version.This adds
pkgbasesupport. When thepkgbasefile exists, initramfsfiles are generated using Arch naming conventions (
initramfs-{pkgbase}.img).When it doesn't exist, behavior is unchanged (
ugrd-{kver}.cpio.xz).Also, add install and remove hooks/scripts (I'll add these in the
ugrd-gitandugrdAUR packages).