Skip to content

Commit

Permalink
generator: Fix creation of target directory
Browse files Browse the repository at this point in the history
This attempts to fix a regression introduced in commit
e13aa77 since this commit
the `usr/lib` target directroy is not created if the host system
does not ship any files in `usr/lib` (e.g. Alpine). This causes
initramfs images generated on such systems to not be bootable
as `lib` is a symlink to the non-existend `usr/lib` then.

The problem is the current implementation:

	filepath.Dir(filepath.Join(filepath.Dir(l.src), l.target))

Would return `/usr` for `{"/lib", "usr/lib"}` and hence `/usr/lib`
was never created. I believe this was intended to be:

	filepath.Join(filepath.Dir(l.src), l.target)

This commit changes this accordingly and fixes booting Booster
images on Alpine.
  • Loading branch information
nmeum authored and anatol committed Mar 9, 2023
1 parent 5305e8e commit bc988b0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion generator/generator.go
Expand Up @@ -263,7 +263,7 @@ func appendCompatibilitySymlinks(img *Image) error {
for _, l := range symlinks {
// Ensure that target always exist which may not be the
// case if we only install files from /lib or /bin.
targetDir := filepath.Dir(filepath.Join(filepath.Dir(l.src), l.target))
targetDir := filepath.Join(filepath.Dir(l.src), l.target)
if err := img.AppendDirEntry(targetDir); err != nil {
return err
}
Expand Down

0 comments on commit bc988b0

Please sign in to comment.