mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-19 17:26:28 +00:00
Use pure Go unix.Reboot function in rc.init
Use unix.Reboot from golang.org/x/sys/unix for poweroff and reboot instead of relying on external commands. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
This commit is contained in:
parent
c84b6ea474
commit
642c6f23ac
@ -411,13 +411,9 @@ func doShutdown(action string) {
|
||||
unmountAll()
|
||||
switch action {
|
||||
case "poweroff":
|
||||
// TODO use syscall
|
||||
cmd := exec.Command("/sbin/poweroff", "-f")
|
||||
_ = cmd.Run()
|
||||
_ = unix.Reboot(unix.LINUX_REBOOT_CMD_POWER_OFF)
|
||||
case "reboot":
|
||||
// TODO use syscall
|
||||
cmd := exec.Command("/sbin/reboot", "-f")
|
||||
_ = cmd.Run()
|
||||
_ = unix.Reboot(unix.LINUX_REBOOT_CMD_RESTART)
|
||||
}
|
||||
// if this failed, init will try again
|
||||
os.Exit(0)
|
||||
|
Loading…
Reference in New Issue
Block a user