Fix root dir detection when using orbit shell (#5844)

* fix old root dir in orbit

* add changes
This commit is contained in:
Michal Nicpon 2022-05-23 13:47:46 -06:00 committed by GitHub
parent 1365bb6cf8
commit 4398644185
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 6 deletions

View file

@ -0,0 +1 @@
* Fixed an issue with detecting root directory when using `orbit shell`.

View file

@ -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 != "." {