Desktop.RunAsRoot, Desktop.RunAs
Posted
#1
(In Topic #742)
Guru

Desktop.RunAsRoot() now uses 'pkexec' by default as its sudoer. Desktop.RunAs() is a new method that allows to specify the username used for running a program.
Benoit said
[GB.DESKTOP]
* NEW: Desktop.RunAsRoot() now takes an optional argument to wait for the program ends, and now uses 'pkexec' by default.
* NEW: Desktop.RunAs() is a method similar as RunAsRoot() that takes the username used for running the program.
I added an option to set UserName and a Wait option.
Ben wasn't too keen on adding a UserName option to a "RunAsRoot" command as he said it "should" be root. kinda makes sense.
So he added my changes as a Desktop.RunAs() command that takes a UserName parameter (root by default)
then he modified the Desktop.RunAsRoot to run the new command without a username so it only runs as root but still now looks for pkexec first
So now with the gambas development branch if you wanted to simply create your own version of a GKSU command you could write the following gbs gambas script file.
That's it, If you saved that as /usr/bin/GSU and set the executable flag then you could type the following (or set a menu launcher command)
GSU pluma
GSU gambas3
etc, etc
of course that's as basic as it gets, you might want to handle the args a bit better but that the essential code
Shimples
1 guest and 0 members have just viewed this.



