Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Followup to #526 Ubuntu 19+ tar symlink fix #577

Merged
merged 2 commits into from
Apr 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pkg/dmlegacy/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,9 @@ func copyKernelToOverlay(vm *api.VM, mountPoint string) error {
}
// It is important to not replace existing symlinks to directories when extracting because
// /lib might be a symlink (usually to usr/lib)
_, err = util.ExecuteCommand("tar", "--keep-directory-symlink", "-xf", kernelTarPath, "-C", mountPoint)
// WARNING: `-h` is only available on GNU and Busybox tar. It is not present on BSD's bsdtar
// It means "Follow symlinks"
_, err = util.ExecuteCommand("tar", "-h", "-xf", kernelTarPath, "-C", mountPoint)
return err
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/operations/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func importKernel(c *client.Client, ociRef meta.OCIImageRef) (*api.Kernel, error
defer reader.Close()

// Extract only the /boot and /lib directories of the tar stream into the tempDir
tarCmd := exec.Command("tar", "-x", "-C", tempDir, "boot", "lib")
tarCmd := exec.Command("tar", "-x", "-C", tempDir, "boot", "lib/modules")
tarCmd.Stdin = reader
if err := tarCmd.Start(); err != nil {
return nil, err
Expand Down