install_opts.go 1.3 KB

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