Skip to content

Commit bc988b0

Browse files
nmeumanatol
authored andcommitted
generator: Fix creation of target directory
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.
1 parent 5305e8e commit bc988b0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

generator/generator.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ func appendCompatibilitySymlinks(img *Image) error {
263263
for _, l := range symlinks {
264264
// Ensure that target always exist which may not be the
265265
// case if we only install files from /lib or /bin.
266-
targetDir := filepath.Dir(filepath.Join(filepath.Dir(l.src), l.target))
266+
targetDir := filepath.Join(filepath.Dir(l.src), l.target)
267267
if err := img.AppendDirEntry(targetDir); err != nil {
268268
return err
269269
}

0 commit comments

Comments
 (0)