mirror of
https://github.com/containers/skopeo.git
synced 2025-09-01 14:47:10 +00:00
Bump github.com/containers/storage from 1.16.0 to 1.16.1
Bumps [github.com/containers/storage](https://github.com/containers/storage) from 1.16.0 to 1.16.1. - [Release notes](https://github.com/containers/storage/releases) - [Changelog](https://github.com/containers/storage/blob/master/docs/containers-storage-changes.md) - [Commits](https://github.com/containers/storage/compare/v1.16.0...v1.16.1) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
committed by
Daniel J Walsh
parent
9b984e8eba
commit
7dcfc18309
55
vendor/github.com/containers/storage/.cirrus.yml
generated
vendored
55
vendor/github.com/containers/storage/.cirrus.yml
generated
vendored
@@ -19,7 +19,7 @@ env:
|
||||
####
|
||||
# GCE project where images live
|
||||
IMAGE_PROJECT: "libpod-218412"
|
||||
_BUILT_IMAGE_SUFFIX: "libpod-6228273469587456"
|
||||
_BUILT_IMAGE_SUFFIX: "libpod-5874660151656448"
|
||||
FEDORA_CACHE_IMAGE_NAME: "fedora-31-${_BUILT_IMAGE_SUFFIX}"
|
||||
PRIOR_FEDORA_CACHE_IMAGE_NAME: "fedora-30-${_BUILT_IMAGE_SUFFIX}"
|
||||
UBUNTU_CACHE_IMAGE_NAME: "ubuntu-19-${_BUILT_IMAGE_SUFFIX}"
|
||||
@@ -50,31 +50,50 @@ gce_instance:
|
||||
disk: 200
|
||||
image_name: "${FEDORA_CACHE_IMAGE_NAME}"
|
||||
|
||||
|
||||
testing_task:
|
||||
|
||||
depends_on:
|
||||
- lint
|
||||
|
||||
# Not all $TEST_DRIVER combinations are valid for all OS types.
|
||||
# Note: Nested-variable resolution happens at runtime, not eval. time.
|
||||
# Use verbose logic for ease of reading/maintaining.
|
||||
only_if: >-
|
||||
( $VM_IMAGE =~ '.*UBUNTU.*' && $TEST_DRIVER == "vfs" ) ||
|
||||
( $VM_IMAGE =~ '.*UBUNTU.*' && $TEST_DRIVER == "aufs" ) ||
|
||||
( $VM_IMAGE =~ '.*UBUNTU.*' && $TEST_DRIVER == "overlay" ) ||
|
||||
( $VM_IMAGE =~ '.*UBUNTU.*' && $TEST_DRIVER == "fuse-overlay" ) ||
|
||||
( $VM_IMAGE =~ '.*FEDORA.*' && $TEST_DRIVER != "aufs" )
|
||||
|
||||
allow_failures: $TEST_DRIVER == "devicemapper"
|
||||
|
||||
env:
|
||||
matrix:
|
||||
VM_IMAGE: "${FEDORA_CACHE_IMAGE_NAME}"
|
||||
VM_IMAGE: "${PRIOR_FEDORA_CACHE_IMAGE_NAME}"
|
||||
VM_IMAGE: "${UBUNTU_CACHE_IMAGE_NAME}"
|
||||
# VM_IMAGE: "${PRIOR_UBUNTU_CACHE_IMAGE_NAME}" # No fuse3 support
|
||||
matrix: # See ./contrib/cirrus/build_and_test.sh
|
||||
TEST_DRIVER: "vfs"
|
||||
TEST_DRIVER: "aufs"
|
||||
TEST_DRIVER: "overlay"
|
||||
TEST_DRIVER: "fuse-overlay"
|
||||
TEST_DRIVER: "devicemapper"
|
||||
TEST_DRIVER: "fuse-overlay-whiteout"
|
||||
|
||||
gce_instance: # Only need to specify differences from defaults (above)
|
||||
matrix: # Duplicate this task for each matrix product.
|
||||
image_name: "${FEDORA_CACHE_IMAGE_NAME}"
|
||||
image_name: "${PRIOR_FEDORA_CACHE_IMAGE_NAME}"
|
||||
image_name: "${UBUNTU_CACHE_IMAGE_NAME}"
|
||||
# image_name: "${PRIOR_UBUNTU_CACHE_IMAGE_NAME}" # No fuse3 support
|
||||
image_name: "${VM_IMAGE}"
|
||||
|
||||
# Separate scripts for separate outputs, makes debugging easier.
|
||||
setup_script: '${CIRRUS_WORKING_DIR}/${SCRIPT_BASE}/setup.sh |& ${_TIMESTAMP}'
|
||||
build_and_test_script: '${CIRRUS_WORKING_DIR}/${SCRIPT_BASE}/build_and_test.sh |& ${_TIMESTAMP}'
|
||||
|
||||
# Log collection when job was successful
|
||||
df_script: '${_DFCMD} || true'
|
||||
rh_audit_log_script: '${_RAUDITCMD} || true'
|
||||
ubuntu_audit_log_script: '${_UAUDITCMD} || true'
|
||||
journal_log_script: '${_JOURNALCMD} || true'
|
||||
|
||||
on_failure: # Script names must be different from above
|
||||
failure_df_script: '${_DFCMD} || true'
|
||||
failure_rh_audit_log_script: '${_RAUDITCMD} || true'
|
||||
failure_ubuntu_audit_log_script: '${_UAUDITCMD} || true'
|
||||
failure_journal_log_script: '${_JOURNALCMD} || true'
|
||||
always:
|
||||
df_script: '${_DFCMD} || true'
|
||||
rh_audit_log_script: '${_RAUDITCMD} || true'
|
||||
ubuntu_audit_log_script: '${_UAUDITCMD} || true'
|
||||
journal_log_script: '${_JOURNALCMD} || true'
|
||||
|
||||
lint_task:
|
||||
env:
|
||||
@@ -94,7 +113,7 @@ lint_task:
|
||||
meta_task:
|
||||
|
||||
container:
|
||||
image: "quay.io/libpod/imgts:latest" # see contrib/imgts
|
||||
image: "quay.io/libpod/imgts:master"
|
||||
cpu: 1
|
||||
memory: 1
|
||||
|
||||
|
62
vendor/github.com/containers/storage/.travis.yml
generated
vendored
62
vendor/github.com/containers/storage/.travis.yml
generated
vendored
@@ -1,62 +0,0 @@
|
||||
---
|
||||
|
||||
sudo: required
|
||||
|
||||
# N/B: host go env. not actually used, see .run_ci_tests.sh
|
||||
language: go
|
||||
go:
|
||||
- master
|
||||
|
||||
services:
|
||||
- docker
|
||||
|
||||
env:
|
||||
# Ubuntu
|
||||
- GO_VERSION="stable"
|
||||
DISTRO="ubuntu"
|
||||
|
||||
- GO_VERSION="1.12.12"
|
||||
DISTRO="ubuntu"
|
||||
|
||||
# Fedora
|
||||
- GO_VERSION="stable"
|
||||
DISTRO="fedora"
|
||||
|
||||
- GO_VERSION="1.12.12"
|
||||
DISTRO="fedora"
|
||||
|
||||
# CentOS
|
||||
- GO_VERSION="stable"
|
||||
DISTRO="centos"
|
||||
|
||||
- GO_VERSION="1.12.12"
|
||||
DISTRO="centos"
|
||||
|
||||
# GO_VERSION="stable" builds successfully, but tests fail on all platforms.
|
||||
# Run the tests, but ignore the result (for now)
|
||||
matrix:
|
||||
allow_failures:
|
||||
- env: GO_VERSION="stable" DISTRO="ubuntu"
|
||||
- env: GO_VERSION="stable" DISTRO="fedora"
|
||||
- env: GO_VERSION="stable" DISTRO="centos"
|
||||
|
||||
before_install:
|
||||
- sudo apt-get -qq update
|
||||
- sudo apt-get -qq install realpath
|
||||
|
||||
script:
|
||||
- echo "Travis/host environment:"
|
||||
- export TRAVIS_ENV="-e TRAVIS=$TRAVIS
|
||||
-e CI=$CI
|
||||
-e TRAVIS_COMMIT=$TRAVIS_COMMIT
|
||||
-e TRAVIS_COMMIT_RANGE=$TRAVIS_COMMIT_RANGE
|
||||
-e TRAVIS_REPO_SLUG=$TRAVIS_REPO_SLUG
|
||||
-e TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST
|
||||
-e TRAVIS_PULL_REQUEST_SHA=$TRAVIS_PULL_REQUEST_SHA
|
||||
-e TRAVIS_PULL_REQUEST_SLUG=$TRAVIS_PULL_REQUEST_SLUG
|
||||
-e TRAVIS_BRANCH=$TRAVIS_BRANCH
|
||||
-e TRAVIS_JOB_ID=$TRAVIS_JOB_ID
|
||||
-e TRAVIS_BUILD_DIR=$TRAVIS_BUILD_DIR"
|
||||
- env
|
||||
- echo "Running tests in SPC using ./hack/run_ci_tests.sh"
|
||||
- ./hack/run_ci_tests.sh
|
2
vendor/github.com/containers/storage/VERSION
generated
vendored
2
vendor/github.com/containers/storage/VERSION
generated
vendored
@@ -1 +1 @@
|
||||
1.16.0
|
||||
1.16.1
|
||||
|
6
vendor/github.com/containers/storage/go.mod
generated
vendored
6
vendor/github.com/containers/storage/go.mod
generated
vendored
@@ -7,19 +7,19 @@ require (
|
||||
github.com/Microsoft/hcsshim v0.8.7
|
||||
github.com/docker/docker v0.0.0-20171019062838-86f080cff091 // indirect
|
||||
github.com/docker/go-units v0.4.0
|
||||
github.com/klauspost/compress v1.10.0
|
||||
github.com/klauspost/compress v1.10.2
|
||||
github.com/klauspost/cpuid v1.2.1 // indirect
|
||||
github.com/klauspost/pgzip v1.2.1
|
||||
github.com/mattn/go-shellwords v1.0.10
|
||||
github.com/mistifyio/go-zfs v2.1.1+incompatible
|
||||
github.com/opencontainers/go-digest v1.0.0-rc1
|
||||
github.com/opencontainers/runc v1.0.0-rc9
|
||||
github.com/opencontainers/selinux v1.3.1
|
||||
github.com/opencontainers/selinux v1.3.3
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/pquerna/ffjson v0.0.0-20181028064349-e517b90714f7
|
||||
github.com/sirupsen/logrus v1.4.2
|
||||
github.com/spf13/pflag v1.0.3 // indirect
|
||||
github.com/stretchr/testify v1.4.0
|
||||
github.com/stretchr/testify v1.5.1
|
||||
github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2
|
||||
github.com/tchap/go-patricia v2.3.0+incompatible
|
||||
github.com/vbatts/tar-split v0.11.1
|
||||
|
12
vendor/github.com/containers/storage/go.sum
generated
vendored
12
vendor/github.com/containers/storage/go.sum
generated
vendored
@@ -81,6 +81,10 @@ github.com/klauspost/compress v1.9.8 h1:VMAMUUOh+gaxKTMk+zqbjsSjsIcUcL/LF4o63i82
|
||||
github.com/klauspost/compress v1.9.8/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
|
||||
github.com/klauspost/compress v1.10.0 h1:92XGj1AcYzA6UrVdd4qIIBrT8OroryvRvdmg/IfmC7Y=
|
||||
github.com/klauspost/compress v1.10.0/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
|
||||
github.com/klauspost/compress v1.10.1 h1:a/QY0o9S6wCi0XhxaMX/QmusicNUqCqFugR6WKPOSoQ=
|
||||
github.com/klauspost/compress v1.10.1/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
|
||||
github.com/klauspost/compress v1.10.2 h1:Znfn6hXZAHaLPNnlqUYRrBSReFHYybslgv4PTiyz6P0=
|
||||
github.com/klauspost/compress v1.10.2/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
|
||||
github.com/klauspost/cpuid v1.2.1 h1:vJi+O/nMdFt0vqm8NZBI6wzALWdA2X+egi0ogNyrC/w=
|
||||
github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
|
||||
github.com/klauspost/pgzip v1.2.1 h1:oIPZROsWuPHpOdMVWLuJZXwgjhrW8r1yEX8UqMyeNHM=
|
||||
@@ -121,6 +125,10 @@ github.com/opencontainers/selinux v1.3.0 h1:xsI95WzPZu5exzA6JzkLSfdr/DilzOhCJOqG
|
||||
github.com/opencontainers/selinux v1.3.0/go.mod h1:+BLncwf63G4dgOzykXAxcmnFlUaOlkDdmw/CqsW6pjs=
|
||||
github.com/opencontainers/selinux v1.3.1 h1:dn2Rc3wTEvTB6iVqoFrKKeMb0uZ38ZheeyMu2h5C1TI=
|
||||
github.com/opencontainers/selinux v1.3.1/go.mod h1:yTcKuYAh6R95iDpefGLQaPaRwJFwyzAJufJyiTt7s0g=
|
||||
github.com/opencontainers/selinux v1.3.2 h1:DR4lL9SYVjgcTZKEZIncvDU06fKSc/eygjmNGOA3E1s=
|
||||
github.com/opencontainers/selinux v1.3.2/go.mod h1:yTcKuYAh6R95iDpefGLQaPaRwJFwyzAJufJyiTt7s0g=
|
||||
github.com/opencontainers/selinux v1.3.3 h1:RX0wAeqtvVSYQcr017X3pFXPkLEtB6V4NjRD7gVQgg4=
|
||||
github.com/opencontainers/selinux v1.3.3/go.mod h1:yTcKuYAh6R95iDpefGLQaPaRwJFwyzAJufJyiTt7s0g=
|
||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
@@ -151,6 +159,10 @@ github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.5.0 h1:DMOzIV76tmoDNE9pX6RSN0aDtCYeCg5VueieJaAo1uw=
|
||||
github.com/stretchr/testify v1.5.0/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||
github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
|
||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||
github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
|
||||
github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2 h1:b6uOv7YOFK0TYG7HtkIgExQo+2RdLuwRft63jn2HWj8=
|
||||
github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
|
||||
|
8
vendor/github.com/containers/storage/storage.conf
generated
vendored
8
vendor/github.com/containers/storage/storage.conf
generated
vendored
@@ -13,6 +13,10 @@ runroot = "/var/run/containers/storage"
|
||||
# Primary Read/Write location of container storage
|
||||
graphroot = "/var/lib/containers/storage"
|
||||
|
||||
# Storage path for rootless users
|
||||
#
|
||||
# rootless_storage_path = "$HOME/.local/share/containers/storage"
|
||||
|
||||
[storage.options]
|
||||
# Storage options to be passed to underlying storage drivers
|
||||
|
||||
@@ -107,7 +111,7 @@ mountopt = "nodev"
|
||||
# Value 0% disables
|
||||
# min_free_space = "10%"
|
||||
|
||||
# mkfsarg specifies extra mkfs arguments to be used when creating the base.
|
||||
# mkfsarg specifies extra mkfs arguments to be used when creating the base
|
||||
# device.
|
||||
# mkfsarg = ""
|
||||
|
||||
@@ -115,7 +119,7 @@ mountopt = "nodev"
|
||||
# size = ""
|
||||
|
||||
# use_deferred_removal marks devicemapper block device for deferred removal.
|
||||
# If the thinpool is in use when the driver attempts to remove it, the driver
|
||||
# If the thinpool is in use when the driver attempts to remove it, the driver
|
||||
# tells the kernel to remove it as soon as possible. Note this does not free
|
||||
# up the disk space, use deferred deletion to fully remove the thinpool.
|
||||
# use_deferred_removal = "True"
|
||||
|
23
vendor/github.com/containers/storage/store.go
generated
vendored
23
vendor/github.com/containers/storage/store.go
generated
vendored
@@ -139,6 +139,9 @@ type StoreOptions struct {
|
||||
// GraphRoot is the filesystem path under which we will store the
|
||||
// contents of layers, images, and containers.
|
||||
GraphRoot string `json:"root,omitempty"`
|
||||
// RootlessStoragePath is the storage path for rootless users
|
||||
// default $HOME/.local/share/containers/storage
|
||||
RootlessStoragePath string `toml:"rootless_storage_path"`
|
||||
// GraphDriverName is the underlying storage driver that we'll be
|
||||
// using. It only needs to be specified the first time a Store is
|
||||
// initialized for a given RunRoot and GraphRoot.
|
||||
@@ -3288,10 +3291,11 @@ func DefaultConfigFile(rootless bool) (string, error) {
|
||||
// TOML-friendly explicit tables used for conversions.
|
||||
type tomlConfig struct {
|
||||
Storage struct {
|
||||
Driver string `toml:"driver"`
|
||||
RunRoot string `toml:"runroot"`
|
||||
GraphRoot string `toml:"graphroot"`
|
||||
Options cfg.OptionsConfig `toml:"options"`
|
||||
Driver string `toml:"driver"`
|
||||
RunRoot string `toml:"runroot"`
|
||||
GraphRoot string `toml:"graphroot"`
|
||||
RootlessStoragePath string `toml:"rootless_storage_path"`
|
||||
Options cfg.OptionsConfig `toml:"options"`
|
||||
} `toml:"storage"`
|
||||
}
|
||||
|
||||
@@ -3312,6 +3316,9 @@ func ReloadConfigurationFile(configFile string, storeOptions *StoreOptions) {
|
||||
fmt.Printf("Failed to parse %s %v\n", configFile, err.Error())
|
||||
return
|
||||
}
|
||||
if os.Getenv("STORAGE_DRIVER") != "" {
|
||||
config.Storage.Driver = os.Getenv("STORAGE_DRIVER")
|
||||
}
|
||||
if config.Storage.Driver != "" {
|
||||
storeOptions.GraphDriverName = config.Storage.Driver
|
||||
}
|
||||
@@ -3321,6 +3328,9 @@ func ReloadConfigurationFile(configFile string, storeOptions *StoreOptions) {
|
||||
if config.Storage.GraphRoot != "" {
|
||||
storeOptions.GraphRoot = config.Storage.GraphRoot
|
||||
}
|
||||
if config.Storage.RootlessStoragePath != "" {
|
||||
storeOptions.RootlessStoragePath = config.Storage.RootlessStoragePath
|
||||
}
|
||||
for _, s := range config.Storage.Options.AdditionalImageStores {
|
||||
storeOptions.GraphDriverOptions = append(storeOptions.GraphDriverOptions, fmt.Sprintf("%s.imagestore=%s", config.Storage.Driver, s))
|
||||
}
|
||||
@@ -3364,11 +3374,8 @@ func ReloadConfigurationFile(configFile string, storeOptions *StoreOptions) {
|
||||
} else {
|
||||
storeOptions.GIDMap = append(storeOptions.GIDMap, gidmap...)
|
||||
}
|
||||
if os.Getenv("STORAGE_DRIVER") != "" {
|
||||
storeOptions.GraphDriverName = os.Getenv("STORAGE_DRIVER")
|
||||
}
|
||||
|
||||
storeOptions.GraphDriverOptions = cfg.GetGraphDriverOptions(storeOptions.GraphDriverName, config.Storage.Options)
|
||||
storeOptions.GraphDriverOptions = append(storeOptions.GraphDriverOptions, cfg.GetGraphDriverOptions(storeOptions.GraphDriverName, config.Storage.Options)...)
|
||||
|
||||
if os.Getenv("STORAGE_OPTS") != "" {
|
||||
storeOptions.GraphDriverOptions = append(storeOptions.GraphDriverOptions, strings.Split(os.Getenv("STORAGE_OPTS"), ",")...)
|
||||
|
35
vendor/github.com/containers/storage/utils.go
generated
vendored
35
vendor/github.com/containers/storage/utils.go
generated
vendored
@@ -4,7 +4,9 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/user"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
@@ -146,6 +148,7 @@ func getRootlessStorageOpts(rootlessUID int) (StoreOptions, error) {
|
||||
}
|
||||
opts.RunRoot = rootlessRuntime
|
||||
opts.GraphRoot = filepath.Join(dataDir, "containers", "storage")
|
||||
opts.RootlessStoragePath = opts.GraphRoot
|
||||
if path, err := exec.LookPath("fuse-overlayfs"); err == nil {
|
||||
opts.GraphDriverName = "overlay"
|
||||
opts.GraphDriverOptions = []string{fmt.Sprintf("overlay.mount_program=%s", path)}
|
||||
@@ -161,6 +164,7 @@ func getTomlStorage(storeOptions *StoreOptions) *tomlConfig {
|
||||
config.Storage.Driver = storeOptions.GraphDriverName
|
||||
config.Storage.RunRoot = storeOptions.RunRoot
|
||||
config.Storage.GraphRoot = storeOptions.GraphRoot
|
||||
config.Storage.RootlessStoragePath = storeOptions.RootlessStoragePath
|
||||
for _, i := range storeOptions.GraphDriverOptions {
|
||||
s := strings.Split(i, "=")
|
||||
if s[0] == "overlay.mount_program" {
|
||||
@@ -227,6 +231,19 @@ func DefaultStoreOptions(rootless bool, rootlessUID int) (StoreOptions, error) {
|
||||
if storageOpts.GraphRoot == "" {
|
||||
storageOpts.GraphRoot = defaultRootlessGraphRoot
|
||||
}
|
||||
if storageOpts.RootlessStoragePath != "" {
|
||||
if err = validRootlessStoragePathFormat(storageOpts.RootlessStoragePath); err != nil {
|
||||
return storageOpts, err
|
||||
}
|
||||
rootlessStoragePath := strings.Replace(storageOpts.RootlessStoragePath, "$HOME", homedir.Get(), -1)
|
||||
rootlessStoragePath = strings.Replace(rootlessStoragePath, "$UID", strconv.Itoa(rootlessUID), -1)
|
||||
usr, err := user.LookupId(strconv.Itoa(rootlessUID))
|
||||
if err != nil {
|
||||
return storageOpts, err
|
||||
}
|
||||
rootlessStoragePath = strings.Replace(rootlessStoragePath, "$USER", usr.Username, -1)
|
||||
storageOpts.GraphRoot = rootlessStoragePath
|
||||
}
|
||||
} else {
|
||||
if err := os.MkdirAll(filepath.Dir(storageConf), 0755); err != nil {
|
||||
return storageOpts, errors.Wrapf(err, "cannot make directory %s", filepath.Dir(storageConf))
|
||||
@@ -248,3 +265,21 @@ func DefaultStoreOptions(rootless bool, rootlessUID int) (StoreOptions, error) {
|
||||
}
|
||||
return storageOpts, nil
|
||||
}
|
||||
|
||||
// validRootlessStoragePathFormat checks if the environments contained in the path are accepted
|
||||
func validRootlessStoragePathFormat(path string) error {
|
||||
if !strings.Contains(path, "$") {
|
||||
return nil
|
||||
}
|
||||
|
||||
splitPaths := strings.SplitAfter(path, "$")
|
||||
validEnv := regexp.MustCompile(`^(HOME|USER|UID)([^a-zA-Z]|$)`).MatchString
|
||||
if len(splitPaths) > 1 {
|
||||
for _, p := range splitPaths[1:] {
|
||||
if !validEnv(p) {
|
||||
return errors.Errorf("Unrecognized environment variable")
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user