Skip to content

functions: fix resolving of nested symbolic links + some add_runscript improvements

nl6720 requested to merge nl6720/mkinitcpio:nested-symlinks into master

functions: fix support for nested symbolic links in add_symlink

38a62e22 broke support for adding files via nested symbolic links. Before the change, the first level symlink was pointed to the end target, but after the change it pointed to the second symlink which was not added to the initamfs.

Recursively adding each nested symlink is not possible since any directory in the next target's path could itself be a symlink. Parsing it all is not sanely possible. Instead limit relative symlink support to target that are not symlinks and reside in the same directory. Everything else will get pointed to the resolved end target.

Fixes https://bugs.archlinux.org/task/76711

functions: do not add symlinks to the /hooks directory in the initramfs

Use realpath to resolve the target file and add it as regular file with add_runscript. Otherwise, if the hooks are symlinks, the initramfs image could expose the paths used on the host system.

Edited by nl6720

Merge request reports