Works on the same principal as my GRoot app , no messing about with pkexec policies or anything like that this time.
It just re-launches using sudo in it's own hidden terminal that closes when the app closes.
It checks if you're root
if not it pops open a password asker. Just add this code to your Startup class or FMain
PS. As Cogier pointed out (Cheers dude) you also need to add the gb.form.terminal component in the project settings.
For a sudo only app...
Public Sub _new()
If GRoot.GetRoot() Then Me.Close()
' Only continues if root
End
for an app that can run without root as well...
Public Sub _new()
If GRoot.GetRoot() Then
If Not GRoot.Cancelled Then
Me.Close()
Return
Endif
Endif
' Continues with or without root access
End
Shimples If anyone knows of a better way to make an app get it's own root access please tell me.