env.go 687 B

123456789101112131415161718192021222324252627282930
  1. package env
  2. import (
  3. "os"
  4. "github.com/rancher/os/config"
  5. "github.com/rancher/os/pkg/init/fsmount"
  6. "github.com/rancher/os/pkg/log"
  7. "github.com/rancher/os/pkg/util/network"
  8. )
  9. func Init(c *config.CloudConfig) (*config.CloudConfig, error) {
  10. os.Setenv("PATH", "/sbin:/usr/sbin:/usr/bin")
  11. if fsmount.IsInitrd() {
  12. log.Debug("Booting off an in-memory filesystem")
  13. // Magic setting to tell Docker to do switch_root and not pivot_root
  14. os.Setenv("DOCKER_RAMDISK", "true")
  15. } else {
  16. log.Debug("Booting off a persistent filesystem")
  17. }
  18. return c, nil
  19. }
  20. func Proxy(cfg *config.CloudConfig) (*config.CloudConfig, error) {
  21. network.SetProxyEnvironmentVariables()
  22. return cfg, nil
  23. }