mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-19 17:26:28 +00:00
Merge pull request #1415 from tych0/fake-hardlink-support
init: fake supporting hard links slightly differently
This commit is contained in:
commit
c7826ef8c2
@ -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