mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-24 11:25:40 +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()
|
unmountAll()
|
||||||
switch action {
|
switch action {
|
||||||
case "poweroff":
|
case "poweroff":
|
||||||
// TODO use syscall
|
_ = unix.Reboot(unix.LINUX_REBOOT_CMD_POWER_OFF)
|
||||||
cmd := exec.Command("/sbin/poweroff", "-f")
|
|
||||||
_ = cmd.Run()
|
|
||||||
case "reboot":
|
case "reboot":
|
||||||
// TODO use syscall
|
_ = unix.Reboot(unix.LINUX_REBOOT_CMD_RESTART)
|
||||||
cmd := exec.Command("/sbin/reboot", "-f")
|
|
||||||
_ = cmd.Run()
|
|
||||||
}
|
}
|
||||||
// if this failed, init will try again
|
// if this failed, init will try again
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
|
Loading…
Reference in New Issue
Block a user