41 lines
1.6 KiB
Diff
41 lines
1.6 KiB
Diff
From bc988b0c48d337d7b3447ad8a634551ca5080178 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
|
|
Date: Thu, 9 Mar 2023 14:15:21 +0100
|
|
Subject: [PATCH] generator: Fix creation of target directory
|
|
|
|
This attempts to fix a regression introduced in commit
|
|
e13aa77e49aef93cc1370a269785b471758cb546 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.
|
|
---
|
|
generator/generator.go | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
diff --git a/generator/generator.go b/generator/generator.go
|
|
index 4a030e5..0ab135c 100644
|
|
--- a/generator/generator.go
|
|
+++ b/generator/generator.go
|
|
@@ -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
|
|
}
|