I've been writing a class based on something my pkAppMan application does...
As it loads it checks the pkexec policy list to see if '/usr/bin/gbr3' is in it.
if not run as root and gbr3 is not in pkexec list then it displays a message
telling the user to run the application from a shell as root to configure pkexec
to allow gambas apps to ask for root.
Running as root from a terminal will auto-add gbr3 to pkexec list if it's not there and
inform the user via a terminal message that it's been added and now pkexec will work for gambas apps.
now the app can be launched in many ways and still ask for root access via pkexec. (even just double clicking the application.gambas file.)
if gbr3 exists in pkexec list and app has not been run as root it uses the shell command to relaunch itself and quit the current loading app
With the following code...
Code: Select all
' Gambas class file
Public pkp As PkPolicy
Public Sub Form_Open()
pkp = New PkPolicy
pkp.pkLaunch
End
Make it pass any other additional arguments from the initial calling command