summaryrefslogtreecommitdiff
path: root/vendor/github.com/projectatomic/buildah/util.go
blob: 33b5b9e836a019b65cbc761b2f603aede4eb31a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package buildah

import (
	"github.com/containers/storage/pkg/chrootarchive"
	"github.com/containers/storage/pkg/reexec"
)

var (
	// CopyWithTar defines the copy method to use.
	copyWithTar     = chrootarchive.NewArchiver(nil).CopyWithTar
	copyFileWithTar = chrootarchive.NewArchiver(nil).CopyFileWithTar
	untarPath       = chrootarchive.NewArchiver(nil).UntarPath
)

// InitReexec is a wrapper for reexec.Init().  It should be called at
// the start of main(), and if it returns true, main() should return
// immediately.
func InitReexec() bool {
	return reexec.Init()
}

func copyStringStringMap(m map[string]string) map[string]string {
	n := map[string]string{}
	for k, v := range m {
		n[k] = v
	}
	return n
}

func copyStringSlice(s []string) []string {
	t := make([]string, len(s))
	copy(t, s)
	return t
}