1
0
mirror of https://github.com/rancher/os.git synced 2025-06-09 15:05:36 +00:00
os/cmd/control/recovery_init.go

27 lines
512 B
Go
Raw Normal View History

2016-11-30 01:06:23 +00:00
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")
os.Setenv("PS1", `[Recovery Console: \l \u@\h \W]\$`)
2016-11-30 01:06:23 +00:00
respawnBinPath, err := exec.LookPath("respawn")
if err != nil {
return err
}
return syscall.Exec(respawnBinPath, []string{"respawn", "-f", "/etc/respawn.conf"}, os.Environ())
}