Skip to content
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

zfsbootmenu/install-helpers.sh: preserve relative symlinks #618

Merged
merged 1 commit into from
Apr 30, 2024

Conversation

ahesford
Copy link
Member

When installing symlinks into their initramfs images, both dracut and mkinitcpio attempt to canonicalize symlink targets, copying the resolved target into place and making a new symlink that points to there. This means that, even when building a local image, symlinks like poweroff and zbm will point copies of scripts in /usr/lib/zfsbootmenu/bin rather than the versions already installed into /usr/bin. For container builds or those built from custom installations that override $zfsbootmenu_module_root, the target paths get even weirder in the initramfs image. It's also problematic, because people doing testing may attempt to modify things like /usr/bin/zfsbootmenu in situ and be surprised when they run zbm and get a different copy of the script than the one they modified.

I've made a simple helper that tries to do the right thing with symlink as we use them. When installing a file, if it is a symlink and resides in $zfsbootmenu_module_root, then the relative link will be replicated in the initramfs image. This seems to work as intended for the handful of symlinks that we install.

In the original implementation, I required that the symlink point to a file in the same location and did not attempt to install the target, instead relying on a zbm_install_file call for the actual target to add the file separately. In the fixup commit, I instead attempt to install the target in a location where the symlink will find it. I'm open to suggestions on how to improve this target installation, and am also willing to just drop the fixup commit.

@ahesford ahesford changed the title Demon king ganondorf zfsbootmenu/install-helpers.sh: preserve relative symlinks Apr 15, 2024
@ahesford
Copy link
Member Author

This may or may not be related to #616; I can't reproduce that issue when generating dracut or mkinitcpio images on my host when standing up testbeds.

@ahesford ahesford force-pushed the demon_king_ganondorf branch from 1abe2c3 to 8a15df4 Compare April 30, 2024 13:11
@ahesford ahesford merged commit 1a6c694 into master Apr 30, 2024
3 checks passed
@ahesford ahesford deleted the demon_king_ganondorf branch April 30, 2024 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant