github.com/demonoid81/containerd@v1.3.4/install_opts.go (about)

     1  /*
     2     Copyright The containerd Authors.
     3  
     4     Licensed under the Apache License, Version 2.0 (the "License");
     5     you may not use this file except in compliance with the License.
     6     You may obtain a copy of the License at
     7  
     8         http://www.apache.org/licenses/LICENSE-2.0
     9  
    10     Unless required by applicable law or agreed to in writing, software
    11     distributed under the License is distributed on an "AS IS" BASIS,
    12     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     See the License for the specific language governing permissions and
    14     limitations under the License.
    15  */
    16  
    17  package containerd
    18  
    19  // InstallOpts configures binary installs
    20  type InstallOpts func(*InstallConfig)
    21  
    22  // InstallConfig sets the binary install configuration
    23  type InstallConfig struct {
    24  	// Libs installs libs from the image
    25  	Libs bool
    26  	// Replace will overwrite existing binaries or libs in the opt directory
    27  	Replace bool
    28  	// Path to install libs and binaries to
    29  	Path string
    30  }
    31  
    32  // WithInstallLibs installs libs from the image
    33  func WithInstallLibs(c *InstallConfig) {
    34  	c.Libs = true
    35  }
    36  
    37  // WithInstallReplace will replace existing files
    38  func WithInstallReplace(c *InstallConfig) {
    39  	c.Replace = true
    40  }
    41  
    42  // WithInstallPath sets the optional install path
    43  func WithInstallPath(path string) InstallOpts {
    44  	return func(c *InstallConfig) {
    45  		c.Path = path
    46  	}
    47  }