main.go 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package main
  2. import (
  3. "github.com/containernetworking/cni/plugins/ipam/host-local"
  4. "github.com/containernetworking/cni/plugins/main/bridge"
  5. "github.com/docker/docker/docker"
  6. "github.com/docker/docker/pkg/reexec"
  7. "github.com/rancher/cniglue"
  8. "github.com/rancher/os/cmd/cloudinitexecute"
  9. "github.com/rancher/os/cmd/cloudinitsave"
  10. "github.com/rancher/os/cmd/control"
  11. "github.com/rancher/os/cmd/network"
  12. "github.com/rancher/os/cmd/power"
  13. "github.com/rancher/os/cmd/respawn"
  14. "github.com/rancher/os/cmd/sysinit"
  15. "github.com/rancher/os/cmd/systemdocker"
  16. "github.com/rancher/os/cmd/wait"
  17. "github.com/rancher/os/dfs"
  18. osInit "github.com/rancher/os/init"
  19. )
  20. var entrypoints = map[string]func(){
  21. "cloud-init-execute": cloudinitexecute.Main,
  22. "cloud-init-save": cloudinitsave.Main,
  23. "console": control.ConsoleInitMain,
  24. "console.sh": control.ConsoleInitMain,
  25. "docker": docker.Main,
  26. "dockerlaunch": dfs.Main,
  27. "halt": power.Halt,
  28. "init": osInit.MainInit,
  29. "netconf": network.Main,
  30. "poweroff": power.Off,
  31. "reboot": power.Reboot,
  32. "respawn": respawn.Main,
  33. "ros-sysinit": sysinit.Main,
  34. "shutdown": power.Main,
  35. "system-docker": systemdocker.Main,
  36. "wait-for-docker": wait.Main,
  37. "cni-glue": glue.Main,
  38. "bridge": bridge.Main,
  39. "host-local": hostlocal.Main,
  40. }
  41. func main() {
  42. for name, f := range entrypoints {
  43. reexec.Register(name, f)
  44. }
  45. if !reexec.Init() {
  46. control.Main()
  47. }
  48. }