mirror of
https://github.com/rancher/os.git
synced 2025-06-18 19:27:26 +00:00
26 lines
457 B
Go
26 lines
457 B
Go
|
package control
|
||
|
|
||
|
import (
|
||
|
"os"
|
||
|
"os/exec"
|
||
|
"syscall"
|
||
|
|
||
|
log "github.com/Sirupsen/logrus"
|
||
|
"github.com/codegangsta/cli"
|
||
|
)
|
||
|
|
||
|
func recoveryInitAction(c *cli.Context) error {
|
||
|
if err := writeRespawn("root", false); err != nil {
|
||
|
log.Error(err)
|
||
|
}
|
||
|
|
||
|
os.Setenv("TERM", "linux")
|
||
|
|
||
|
respawnBinPath, err := exec.LookPath("respawn")
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
return syscall.Exec(respawnBinPath, []string{"respawn", "-f", "/etc/respawn.conf"}, os.Environ())
|
||
|
}
|