|
@@ -7,8 +7,6 @@ import (
|
|
"sort"
|
|
"sort"
|
|
"strconv"
|
|
"strconv"
|
|
"strings"
|
|
"strings"
|
|
-
|
|
|
|
- "github.com/docker/docker/pkg/system"
|
|
|
|
)
|
|
)
|
|
|
|
|
|
// IDMap contains a single entry for user namespace range remapping. An array
|
|
// IDMap contains a single entry for user namespace range remapping. An array
|
|
@@ -49,23 +47,6 @@ func MkdirAs(path string, mode os.FileMode, ownerUID, ownerGID int) error {
|
|
return mkdirAs(path, mode, ownerUID, ownerGID, false)
|
|
return mkdirAs(path, mode, ownerUID, ownerGID, false)
|
|
}
|
|
}
|
|
|
|
|
|
-func mkdirAs(path string, mode os.FileMode, ownerUID, ownerGID int, mkAll bool) error {
|
|
|
|
- if mkAll {
|
|
|
|
- if err := system.MkdirAll(path, mode); err != nil && !os.IsExist(err) {
|
|
|
|
- return err
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- if err := os.Mkdir(path, mode); err != nil && !os.IsExist(err) {
|
|
|
|
- return err
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- // even if it existed, we will chown to change ownership as requested
|
|
|
|
- if err := os.Chown(path, ownerUID, ownerGID); err != nil {
|
|
|
|
- return err
|
|
|
|
- }
|
|
|
|
- return nil
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
// GetRootUIDGID retrieves the remapped root uid/gid pair from the set of maps.
|
|
// GetRootUIDGID retrieves the remapped root uid/gid pair from the set of maps.
|
|
// If the maps are empty, then the root uid/gid will default to "real" 0/0
|
|
// If the maps are empty, then the root uid/gid will default to "real" 0/0
|
|
func GetRootUIDGID(uidMap, gidMap []IDMap) (int, int, error) {
|
|
func GetRootUIDGID(uidMap, gidMap []IDMap) (int, int, error) {
|