main.go 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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/docker-from-scratch"
  9. "github.com/rancher/os/cmd/cloudinitexecute"
  10. "github.com/rancher/os/cmd/cloudinitsave"
  11. "github.com/rancher/os/cmd/console"
  12. "github.com/rancher/os/cmd/control"
  13. "github.com/rancher/os/cmd/dockerinit"
  14. "github.com/rancher/os/cmd/network"
  15. "github.com/rancher/os/cmd/power"
  16. "github.com/rancher/os/cmd/respawn"
  17. "github.com/rancher/os/cmd/switchconsole"
  18. "github.com/rancher/os/cmd/sysinit"
  19. "github.com/rancher/os/cmd/systemdocker"
  20. "github.com/rancher/os/cmd/userdocker"
  21. "github.com/rancher/os/cmd/wait"
  22. osInit "github.com/rancher/os/init"
  23. )
  24. var entrypoints = map[string]func(){
  25. "cloud-init-execute": cloudinitexecute.Main,
  26. "cloud-init-save": cloudinitsave.Main,
  27. "console": console.Main,
  28. "console.sh": console.Main,
  29. "docker": docker.Main,
  30. "docker-init": dockerinit.Main,
  31. "dockerlaunch": dockerlaunch.Main,
  32. "halt": power.Halt,
  33. "init": osInit.MainInit,
  34. "netconf": network.Main,
  35. "poweroff": power.PowerOff,
  36. "reboot": power.Reboot,
  37. "respawn": respawn.Main,
  38. "ros-sysinit": sysinit.Main,
  39. "shutdown": power.Main,
  40. "switch-console": switchconsole.Main,
  41. "system-docker": systemdocker.Main,
  42. "user-docker": userdocker.Main,
  43. "wait-for-docker": wait.Main,
  44. "cni-glue": glue.Main,
  45. "bridge": bridge.Main,
  46. "host-local": hostlocal.Main,
  47. }
  48. func main() {
  49. for name, f := range entrypoints {
  50. reexec.Register(name, f)
  51. }
  52. if !reexec.Init() {
  53. control.Main()
  54. }
  55. }