Skip to content

Commit e13aa77

Browse files
thomasfsteeplesanatol
authored andcommitted
Replace symlink forest targets with relative path
It makes easier to handle unpacked image files. The symlinks point to the image's location, rather than to system directories.
1 parent 2b49c7c commit e13aa77

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

Diff for: generator/generator.go

+12-11
Original file line numberDiff line numberDiff line change
@@ -243,22 +243,23 @@ func generateInitRamfs(conf *generatorConfig) error {
243243
// appendCompatibilitySymlinks appends symlinks for compatibility with older firmware that loads extra files from non-standard locations
244244
func appendCompatibilitySymlinks(img *Image) error {
245245
symlinks := []struct{ src, target string }{
246-
{"/lib", "/usr/lib"},
247-
{"/usr/local/lib", "/usr/lib"},
248-
{"/usr/sbin", "/usr/bin"},
249-
{"/bin", "/usr/bin"},
250-
{"/sbin", "/usr/bin"},
251-
{"/usr/local/bin", "/usr/bin"},
252-
{"/usr/local/sbin", "/usr/bin"},
253-
{"/var/run", "/run"},
254-
{"/usr/lib64", "/usr/lib"},
255-
{"/lib64", "/usr/lib"},
246+
{"/lib", "usr/lib"},
247+
{"/usr/local/lib", "../lib"},
248+
{"/usr/sbin", "bin"},
249+
{"/bin", "usr/bin"},
250+
{"/sbin", "usr/bin"},
251+
{"/usr/local/bin", "../bin"},
252+
{"/usr/local/sbin", "../bin"},
253+
{"/var/run", "../run"},
254+
{"/usr/lib64", "lib"},
255+
{"/lib64", "usr/lib"},
256256
}
257257

258258
for _, l := range symlinks {
259259
// Ensure that target always exist which may not be the
260260
// case if we only install files from /lib or /bin.
261-
if err := img.AppendDirEntry(l.target); err != nil {
261+
targetDir := filepath.Dir(filepath.Join(filepath.Dir(l.src), l.target))
262+
if err := img.AppendDirEntry(targetDir); err != nil {
262263
return err
263264
}
264265

0 commit comments

Comments
 (0)