login-app: warning if not booted UEFI
This commit is contained in:
parent
5a723d2ad6
commit
1ff63190b2
21
pkg/login-app/cmd/dialog-uefi.go
Normal file
21
pkg/login-app/cmd/dialog-uefi.go
Normal 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)
|
||||
}
|
@ -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
|
||||
})
|
||||
|
||||
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)
|
||||
|
Reference in New Issue
Block a user