mirror of
https://github.com/rancher/os.git
synced 2025-09-04 16:21:07 +00:00
make centos/fedora consoles work by just starting bash
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au> WIP - dont merge Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
@@ -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 {
|
||||
|
@@ -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 \
|
||||
|
@@ -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} "
|
||||
|
Reference in New Issue
Block a user