binctr/rootfs_ops.go
Jess Frazelle 2446892a69 update go generated project files
Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
2018-03-19 21:52:49 -04:00

37 lines
757 B
Go

package main
import (
"bytes"
"encoding/base64"
"io/ioutil"
"os"
"path/filepath"
"github.com/docker/docker/pkg/archive"
"github.com/opencontainers/runtime-spec/specs-go"
)
const DATA = ""
func unpackRootfs(spec *specs.Spec) error {
data, err := base64.StdEncoding.DecodeString(DATA)
if err != nil {
return err
}
if err := os.MkdirAll(defaultRootfsDir, 0755); err != nil {
return err
}
r := bytes.NewReader(data)
if err := archive.Untar(r, defaultRootfsDir, &archive.TarOptions{NoLchown: true}); err != nil {
return err
}
// write a resolv.conf
if err := ioutil.WriteFile(filepath.Join(defaultRootfsDir, "etc", "resolv.conf"), []byte("nameserver 8.8.8.8\nnameserver 8.8.4.4"), 0755); err != nil {
return err
}
return nil
}