mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-21 01:59:07 +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
|
cw *cpio.Writer
|
||||||
}
|
}
|
||||||
|
|
||||||
func typeconv(t byte) int64 {
|
func typeconv(thdr *tar.Header) int64 {
|
||||||
switch t {
|
switch thdr.Typeflag {
|
||||||
case tar.TypeReg:
|
case tar.TypeReg:
|
||||||
return cpio.TYPE_REG
|
return cpio.TYPE_REG
|
||||||
case tar.TypeRegA:
|
case tar.TypeRegA:
|
||||||
return cpio.TYPE_REG
|
return cpio.TYPE_REG
|
||||||
// Currently hard links not supported
|
// Currently hard links not supported very well :)
|
||||||
case tar.TypeLink:
|
case tar.TypeLink:
|
||||||
return cpio.TYPE_REG
|
thdr.Linkname = "/" + thdr.Linkname
|
||||||
|
return cpio.TYPE_SYMLINK
|
||||||
case tar.TypeSymlink:
|
case tar.TypeSymlink:
|
||||||
return cpio.TYPE_SYMLINK
|
return cpio.TYPE_SYMLINK
|
||||||
case tar.TypeChar:
|
case tar.TypeChar:
|
||||||
@ -54,7 +55,7 @@ func CopyTar(w *Writer, r *tar.Reader) (written int64, err error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
tp := typeconv(thdr.Typeflag)
|
tp := typeconv(thdr)
|
||||||
if tp == -1 {
|
if tp == -1 {
|
||||||
return written, errors.New("cannot convert tar file")
|
return written, errors.New("cannot convert tar file")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user