diff --git a/cmd/control/autologin.go b/cmd/control/autologin.go index a92adb5e..312c6d44 100644 --- a/cmd/control/autologin.go +++ b/cmd/control/autologin.go @@ -6,6 +6,7 @@ import ( "os/exec" "runtime" "strings" + "syscall" "github.com/codegangsta/cli" "github.com/rancher/os/config" @@ -59,12 +60,36 @@ func autologinAction(c *cli.Context) error { banner = banner + "\n" fmt.Printf(banner) - cmd = exec.Command("/usr/bin/login", "-f", user) - cmd.Stderr = os.Stderr - cmd.Stdout = os.Stdout - cmd.Stdin = os.Stdin - if err := cmd.Run(); err != nil { - log.Error(err) + loginBin := "" + args := []string{} + if cfg.Rancher.Console == "Acentos" || cfg.Rancher.Console == "Afedora" { + // For some reason, centos and fedora ttyS0 and tty1 don't work with `login -f rancher` + // until I make time to read their source, lets just give us a way to get work done + loginBin = "bash" + args = append(args, "--login") + + } else { + loginBin = "login" + args = append(args, "-f", user) } - return nil + + loginBinPath, err := exec.LookPath(loginBin) + if err != nil { + fmt.Printf("error finding %s in path: %s", cmd.Args[0], err) + return err + } + os.Setenv("PS1", `[`+cfg.Rancher.Console+`: \l \u@\h \W]\$`) + + return syscall.Exec(loginBinPath, args, os.Environ()) + + // cmd = exec.Command(loginBinPath, args...) + // cmd.Env = os.Environ() + + // cmd.Stderr = os.Stderr + // cmd.Stdout = os.Stdout + // cmd.Stdin = os.Stdin + // if err := cmd.Run(); err != nil { + // log.Errorf("\nError starting %s: %s", cmd.Args[0], err) + // } + // return nil } diff --git a/cmd/control/recovery_init.go b/cmd/control/recovery_init.go index 68d6be33..8c7b0841 100644 --- a/cmd/control/recovery_init.go +++ b/cmd/control/recovery_init.go @@ -15,6 +15,7 @@ func recoveryInitAction(c *cli.Context) error { } os.Setenv("TERM", "linux") + os.Setenv("PS1", `[Recovery Console: \l \u@\h \W]\$`) respawnBinPath, err := exec.LookPath("respawn") if err != nil { diff --git a/scripts/run b/scripts/run index 41d0389a..29944846 100755 --- a/scripts/run +++ b/scripts/run @@ -171,7 +171,7 @@ if [ "$APPEND_INIT" != "" ]; then fi if [ "$BOOT_PXE" == "1" ]; then - KERNEL_ARGS="console=tty1 rancher.console=tty1 rancher.autologin=tty1 ${KERNEL_ARGS}" + KERNEL_ARGS="console=tty1 rancher.autologin=tty1 ${KERNEL_ARGS}" set -ex PIXIECORE=$(which pixiecore) sudo -E $PIXIECORE boot \ diff --git a/scripts/run-common b/scripts/run-common index d4f45093..03cc84ad 100755 --- a/scripts/run-common +++ b/scripts/run-common @@ -52,4 +52,4 @@ if [ "$ENGINE_REGISTRY_MIRROR" != "" ]; then REGISTRY_MIRROR="rancher.bootstrap_docker.registry_mirror=${ENGINE_REGISTRY_MIRROR} rancher.system_docker.registry_mirror=${ENGINE_REGISTRY_MIRROR} rancher.docker.registry_mirror=${ENGINE_REGISTRY_MIRROR}" fi -DEFAULT_KERNEL_ARGS="printk.devkmsg=on rancher.debug=true rancher.password=rancher console=${TTYCONS} rancher.autologin=${TTYCONS} ${REGISTRY_MIRROR} " +DEFAULT_KERNEL_ARGS="printk.devkmsg=on rancher.debug=true rancher.password=rancher console=tty1 rancher.autologin=tty1 console=${TTYCONS} rancher.autologin=${TTYCONS} ${REGISTRY_MIRROR} "