diff --git a/changes/issue-5734-fix-orbit-shell-root b/changes/issue-5734-fix-orbit-shell-root new file mode 100644 index 0000000000..73530d3b56 --- /dev/null +++ b/changes/issue-5734-fix-orbit-shell-root @@ -0,0 +1 @@ +* Fixed an issue with detecting root directory when using `orbit shell`. diff --git a/orbit/cmd/orbit/orbit.go b/orbit/cmd/orbit/orbit.go index 8ba56e42d0..8f49fab4cf 100644 --- a/orbit/cmd/orbit/orbit.go +++ b/orbit/cmd/orbit/orbit.go @@ -135,12 +135,7 @@ func main() { EnvVars: []string{"ORBIT_FLEET_DESKTOP"}, }, } - app.Action = func(c *cli.Context) error { - if c.Bool("version") { - fmt.Println("orbit " + build.Version) - return nil - } - + app.Before = func(c *cli.Context) error { // handle old installations, which had default root dir set to /var/lib/orbit if c.String("root-dir") == "" { rootDir := update.DefaultOptions.RootDirectory @@ -155,6 +150,14 @@ func main() { c.Set("root-dir", rootDir) } + return nil + } + app.Action = func(c *cli.Context) error { + if c.Bool("version") { + fmt.Println("orbit " + build.Version) + return nil + } + var logFile io.Writer if logf := c.String("log-file"); logf != "" { if logDir := filepath.Dir(logf); logDir != "." {