main.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package main
  2. import (
  3. "github.com/docker/docker/docker"
  4. "github.com/docker/docker/pkg/reexec"
  5. "github.com/rancher/docker-from-scratch"
  6. "github.com/rancher/os/cmd/cloudinit"
  7. "github.com/rancher/os/cmd/control"
  8. "github.com/rancher/os/cmd/network"
  9. "github.com/rancher/os/cmd/power"
  10. "github.com/rancher/os/cmd/respawn"
  11. "github.com/rancher/os/cmd/switchconsole"
  12. "github.com/rancher/os/cmd/sysinit"
  13. "github.com/rancher/os/cmd/systemdocker"
  14. "github.com/rancher/os/cmd/userdocker"
  15. "github.com/rancher/os/cmd/wait"
  16. osInit "github.com/rancher/os/init"
  17. )
  18. var entrypoints = map[string]func(){
  19. "cloud-init": cloudinit.Main,
  20. "docker": docker.Main,
  21. "dockerlaunch": dockerlaunch.Main,
  22. "halt": power.Halt,
  23. "init": osInit.MainInit,
  24. "netconf": network.Main,
  25. "poweroff": power.PowerOff,
  26. "reboot": power.Reboot,
  27. "respawn": respawn.Main,
  28. "ros-sysinit": sysinit.Main,
  29. "shutdown": power.Main,
  30. "switch-console": switchconsole.Main,
  31. "system-docker": systemdocker.Main,
  32. "user-docker": userdocker.Main,
  33. "wait-for-docker": wait.Main,
  34. }
  35. func main() {
  36. for name, f := range entrypoints {
  37. reexec.Register(name, f)
  38. }
  39. if !reexec.Init() {
  40. control.Main()
  41. }
  42. }