2018-02-05 16:05:59 -05:00
|
|
|
package chrootarchive // import "github.com/docker/docker/pkg/chrootarchive"
|
2015-05-14 18:08:00 -04:00
|
|
|
|
2015-06-01 19:42:27 -04:00
|
|
|
import (
|
|
|
|
"io"
|
|
|
|
|
|
|
|
"github.com/docker/docker/pkg/archive"
|
2015-08-24 17:07:22 -04:00
|
|
|
"github.com/docker/docker/pkg/longpath"
|
2015-06-01 19:42:27 -04:00
|
|
|
)
|
|
|
|
|
2015-05-14 18:08:00 -04:00
|
|
|
// chroot is not supported by Windows
|
|
|
|
func chroot(path string) error {
|
|
|
|
return nil
|
|
|
|
}
|
2015-06-01 19:42:27 -04:00
|
|
|
|
|
|
|
func invokeUnpack(decompressedArchive io.ReadCloser,
|
|
|
|
dest string,
|
2019-05-30 14:15:09 -04:00
|
|
|
options *archive.TarOptions, root string) error {
|
2015-06-01 19:42:27 -04:00
|
|
|
// Windows is different to Linux here because Windows does not support
|
|
|
|
// chroot. Hence there is no point sandboxing a chrooted process to
|
|
|
|
// do the unpack. We call inline instead within the daemon process.
|
2015-08-24 17:07:22 -04:00
|
|
|
return archive.Unpack(decompressedArchive, longpath.AddPrefix(dest), options)
|
2015-06-01 19:42:27 -04:00
|
|
|
}
|
2019-05-30 17:55:52 -04:00
|
|
|
|
|
|
|
func invokePack(srcPath string, options *archive.TarOptions, root string) (io.ReadCloser, error) {
|
|
|
|
// Windows is different to Linux here because Windows does not support
|
|
|
|
// chroot. Hence there is no point sandboxing a chrooted process to
|
|
|
|
// do the pack. We call inline instead within the daemon process.
|
|
|
|
return archive.TarWithOptions(srcPath, options)
|
|
|
|
}
|