login-app: warning if not booted UEFI

This commit is contained in:
nemunaire 2021-02-17 20:25:36 +01:00
parent 5a723d2ad6
commit 1ff63190b2
2 changed files with 28 additions and 17 deletions

View File

@ -0,0 +1,21 @@
package main
import (
"github.com/rivo/tview"
)
func CreateUEFIDialog(app *tview.Application, next func()) {
modal := tview.NewModal().
SetText("Not UEFI boot\nYou should reboot, enter UEFI Setup (F2) and disable Legacy boot").
AddButtons([]string{"Reboot", "Ignore"}).
SetDoneFunc(func(buttonIndex int, buttonLabel string) {
if buttonLabel == "Reboot" {
app.Stop()
} else if buttonLabel == "Ignore" {
next()
}
})
app.SetRoot(modal, true)
app.SetFocus(modal)
}

View File

@ -39,22 +39,6 @@ func askLogin(app *tview.Application) {
}
}()
})
/*lgd.beforeClose = func() {
// Display next dialoag
ckd := CreateCheckDialog(" SRS AdLin - Login ", lgd.Username, lgd.Password)
ckd.beforeClose = func(ev ui.Event) {
if ev.Err == nil {
logged = true
CreateRebootDialog(" SRS AdLin - Login", lgd.Username)
} else {
errd := CreateErrMsgDialog(" SRS AdLin - Login ", ev.Err)
errd.beforeClose = func() {
askLogin()
}
}
}
}*/
}
func main() {
@ -70,7 +54,13 @@ func main() {
return event
})
askLogin(app)
if _, err := os.Stat("/sys/firmware/efi"); err != nil {
CreateUEFIDialog(app, func() {
askLogin(app)
})
} else {
askLogin(app)
}
if err := app.Run(); err != nil {
panic(err)