mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-19 01:06:27 +00:00
init: fake supporting hard links slightly differently
Instead, make a hard link a symlink. This isn't much better, but it allows some cases (e.g. installing GCC on moby via alpine) to work. Signed-off-by: Tycho Andersen <tycho@docker.com>
This commit is contained in:
parent
317e48b9dd
commit
3c5040b0f6
@ -19,15 +19,16 @@ type Writer struct {
|
||||
cw *cpio.Writer
|
||||
}
|
||||
|
||||
func typeconv(t byte) int64 {
|
||||
switch t {
|
||||
func typeconv(thdr *tar.Header) int64 {
|
||||
switch thdr.Typeflag {
|
||||
case tar.TypeReg:
|
||||
return cpio.TYPE_REG
|
||||
case tar.TypeRegA:
|
||||
return cpio.TYPE_REG
|
||||
// Currently hard links not supported
|
||||
// Currently hard links not supported very well :)
|
||||
case tar.TypeLink:
|
||||
return cpio.TYPE_REG
|
||||
thdr.Linkname = "/" + thdr.Linkname
|
||||
return cpio.TYPE_SYMLINK
|
||||
case tar.TypeSymlink:
|
||||
return cpio.TYPE_SYMLINK
|
||||
case tar.TypeChar:
|
||||
@ -54,7 +55,7 @@ func CopyTar(w *Writer, r *tar.Reader) (written int64, err error) {
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
tp := typeconv(thdr.Typeflag)
|
||||
tp := typeconv(thdr)
|
||||
if tp == -1 {
|
||||
return written, errors.New("cannot convert tar file")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user