mirror of
https://github.com/rancher/os.git
synced 2025-08-28 19:21:42 +00:00
Merge pull request #808 from datawolf/print-proper-tips
print proper tips when running `ros` or `system-docker` without using sudo
This commit is contained in:
commit
f7301fa1b0
@ -3,6 +3,7 @@ package control
|
||||
import (
|
||||
"os"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/codegangsta/cli"
|
||||
"github.com/rancher/os/config"
|
||||
)
|
||||
@ -15,6 +16,12 @@ func Main() {
|
||||
app.Version = config.VERSION
|
||||
app.Author = "Rancher Labs, Inc."
|
||||
app.EnableBashCompletion = true
|
||||
app.Before = func(c *cli.Context) error {
|
||||
if os.Geteuid() != 0 {
|
||||
log.Fatalf("%s: Need to be root", os.Args[0])
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
app.Commands = []cli.Command{
|
||||
{
|
||||
|
@ -19,6 +19,10 @@ func Main() {
|
||||
|
||||
newEnv = append(newEnv, "DOCKER_HOST="+config.DOCKER_SYSTEM_HOST)
|
||||
|
||||
if os.Geteuid() != 0 {
|
||||
log.Fatalf("%s: Need to be root", os.Args[0])
|
||||
}
|
||||
|
||||
os.Args[0] = config.DOCKER_DIST_BIN
|
||||
if err := syscall.Exec(os.Args[0], os.Args, newEnv); err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -14,6 +14,6 @@ def test_system_docker_survives_custom_docker_install(qemu):
|
||||
SSH(qemu).check_call('bash', '-c', '''
|
||||
set -x -e
|
||||
mkdir x
|
||||
sudo mount $(ros dev LABEL=RANCHER_STATE) x
|
||||
sudo mount $(sudo ros dev LABEL=RANCHER_STATE) x
|
||||
[ -d x/ros_subdir/home/rancher ]
|
||||
'''.strip())
|
||||
|
Loading…
Reference in New Issue
Block a user