Re: [Gambas-user] kdesu vs gksu

2009-05-20 Thread Jesus Guardon
Thanks for your offer, still very interested to look at your own 
example. I think may be hard to happen on the universal solution.

Thanks in advance

Jesus


Steven James Drinnan escribió:
 For me I would use neither, it would rely on those packages being
 available. In Fedora it uses its own graphical system - sorry can tell
 you the name its linked directly to the authentication system. As such
 those packages are nowhere to be seen.
 
 Instead let your package do the checking using shell. 
 
 There some examples around. If you need I can give you one that you can
 add in to the sample given by Jose J. Rodriguez.
 
 Steven.
 
 
 
 On Tue, 2009-05-19 at 22:00 +0200, Jesus Guardon wrote:
 Thanks, Jose

 This is a good approach, too. But also not perfect, ;-) ... A friend of 
 mine tells that in his Debian testing (KDE), no kdesu is available. 
 Instead it have 'kdesudo', so in this case your code (and David's too) 
 might fail. We must check for this, too.

 Another issue is that I want to start, is a daemon process and a bit 
 later, another process that connects to this daemon. So, to clarify:

 1st) I start a daemon with shell gksu -u root 'some process'

 2nd) Meanwhile (we type the passwd), the other process has started, but 
 no host to connect to, because this process has started before the 1st 
 one, which is the host. So my client process fails misserably.

 I'm not be able to use WAIT in the first shell statement, because a 
 daemon never stops running, so I need to insert a 'WAIT n' in between, 
 not very elegant...

 Sorry for the brick

 Best regards

 Jesus

 Jose J. Rodriguez escribió:
 On 5/18/09, Jesus Guardon jguar...@telefonica.net wrote:
 Yes, I know it may be a little off-topic, but the question is:

  I need to launch a process with root privileges from SHELL command in
  Gambas. Users of my application can have Gnome or KDE, so I don't know
  which command I must issue to get it to work.

  Is there a way to choose between either gksu o kdesu commands at runtime?
  I've figured it out if it could be something like:

   SHELL gksu | kdesu -u root 'some_command'

  or

  SHELL gksu -u root 'some_command' | kdesu -u root 'some_command'

 Here's what I do in the vl-hot-config utility:

 ***
 ' Gambas module file

 PUBLIC SUB Main()
 DIM MyProc AS Process
 DIM Ret AS String

 IF System.User.Id  0 THEN
EXEC [which, kdesu] TO Ret
IF InStr(Ret, kdesu) THEN
   EXEC [kdesu, Application.Path / vl-hot-config.gambas]
ELSE
   EXEC [which, gksu] TO Ret
   IF InStr(Ret, gksu) THEN
  EXEC [gksu, Application.Path / vl-hot-config.gambas]
   ELSE
  PRINT No kdesu or gksu available (vl-hot-config needs to run
 as root)...
   ENDIF
ENDIF
QUIT
 ENDIF

 FMain.Show

 END
 ***

 Regards,
 Joe1962

 

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] kdesu vs gksu

2009-05-19 Thread Jose J. Rodriguez
On 5/18/09, Jesus Guardon jguar...@telefonica.net wrote:
 Yes, I know it may be a little off-topic, but the question is:

  I need to launch a process with root privileges from SHELL command in
  Gambas. Users of my application can have Gnome or KDE, so I don't know
  which command I must issue to get it to work.

  Is there a way to choose between either gksu o kdesu commands at runtime?
  I've figured it out if it could be something like:

   SHELL gksu | kdesu -u root 'some_command'

  or

  SHELL gksu -u root 'some_command' | kdesu -u root 'some_command'


Here's what I do in the vl-hot-config utility:

***
' Gambas module file

PUBLIC SUB Main()
DIM MyProc AS Process
DIM Ret AS String

IF System.User.Id  0 THEN
   EXEC [which, kdesu] TO Ret
   IF InStr(Ret, kdesu) THEN
  EXEC [kdesu, Application.Path / vl-hot-config.gambas]
   ELSE
  EXEC [which, gksu] TO Ret
  IF InStr(Ret, gksu) THEN
 EXEC [gksu, Application.Path / vl-hot-config.gambas]
  ELSE
 PRINT No kdesu or gksu available (vl-hot-config needs to run
as root)...
  ENDIF
   ENDIF
   QUIT
ENDIF

FMain.Show

END
***

Regards,
Joe1962

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] kdesu vs gksu

2009-05-19 Thread Jesus Guardon
Thanks, Jose

This is a good approach, too. But also not perfect, ;-) ... A friend of 
mine tells that in his Debian testing (KDE), no kdesu is available. 
Instead it have 'kdesudo', so in this case your code (and David's too) 
might fail. We must check for this, too.

Another issue is that I want to start, is a daemon process and a bit 
later, another process that connects to this daemon. So, to clarify:

1st) I start a daemon with shell gksu -u root 'some process'

2nd) Meanwhile (we type the passwd), the other process has started, but 
no host to connect to, because this process has started before the 1st 
one, which is the host. So my client process fails misserably.

I'm not be able to use WAIT in the first shell statement, because a 
daemon never stops running, so I need to insert a 'WAIT n' in between, 
not very elegant...

Sorry for the brick

Best regards

Jesus

Jose J. Rodriguez escribió:
 On 5/18/09, Jesus Guardon jguar...@telefonica.net wrote:
 Yes, I know it may be a little off-topic, but the question is:

  I need to launch a process with root privileges from SHELL command in
  Gambas. Users of my application can have Gnome or KDE, so I don't know
  which command I must issue to get it to work.

  Is there a way to choose between either gksu o kdesu commands at runtime?
  I've figured it out if it could be something like:

   SHELL gksu | kdesu -u root 'some_command'

  or

  SHELL gksu -u root 'some_command' | kdesu -u root 'some_command'

 
 Here's what I do in the vl-hot-config utility:
 
 ***
 ' Gambas module file
 
 PUBLIC SUB Main()
 DIM MyProc AS Process
 DIM Ret AS String
 
 IF System.User.Id  0 THEN
EXEC [which, kdesu] TO Ret
IF InStr(Ret, kdesu) THEN
   EXEC [kdesu, Application.Path / vl-hot-config.gambas]
ELSE
   EXEC [which, gksu] TO Ret
   IF InStr(Ret, gksu) THEN
  EXEC [gksu, Application.Path / vl-hot-config.gambas]
   ELSE
  PRINT No kdesu or gksu available (vl-hot-config needs to run
 as root)...
   ENDIF
ENDIF
QUIT
 ENDIF
 
 FMain.Show
 
 END
 ***
 
 Regards,
 Joe1962
 
 --
 Crystal Reports - New Free Runtime and 30 Day Trial
 Check out the new simplified licensing option that enables 
 unlimited royalty-free distribution of the report engine 
 for externally facing server and web deployment. 
 http://p.sf.net/sfu/businessobjects
 ___
 Gambas-user mailing list
 Gambas-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/gambas-user
 


--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] kdesu vs gksu

2009-05-19 Thread Steven James Drinnan
For me I would use neither, it would rely on those packages being
available. In Fedora it uses its own graphical system - sorry can tell
you the name its linked directly to the authentication system. As such
those packages are nowhere to be seen.

Instead let your package do the checking using shell. 

There some examples around. If you need I can give you one that you can
add in to the sample given by Jose J. Rodriguez.

Steven.



On Tue, 2009-05-19 at 22:00 +0200, Jesus Guardon wrote:
 Thanks, Jose
 
 This is a good approach, too. But also not perfect, ;-) ... A friend of 
 mine tells that in his Debian testing (KDE), no kdesu is available. 
 Instead it have 'kdesudo', so in this case your code (and David's too) 
 might fail. We must check for this, too.
 
 Another issue is that I want to start, is a daemon process and a bit 
 later, another process that connects to this daemon. So, to clarify:
 
 1st) I start a daemon with shell gksu -u root 'some process'
 
 2nd) Meanwhile (we type the passwd), the other process has started, but 
 no host to connect to, because this process has started before the 1st 
 one, which is the host. So my client process fails misserably.
 
 I'm not be able to use WAIT in the first shell statement, because a 
 daemon never stops running, so I need to insert a 'WAIT n' in between, 
 not very elegant...
 
 Sorry for the brick
 
 Best regards
 
 Jesus
 
 Jose J. Rodriguez escribió:
  On 5/18/09, Jesus Guardon jguar...@telefonica.net wrote:
  Yes, I know it may be a little off-topic, but the question is:
 
   I need to launch a process with root privileges from SHELL command in
   Gambas. Users of my application can have Gnome or KDE, so I don't know
   which command I must issue to get it to work.
 
   Is there a way to choose between either gksu o kdesu commands at runtime?
   I've figured it out if it could be something like:
 
SHELL gksu | kdesu -u root 'some_command'
 
   or
 
   SHELL gksu -u root 'some_command' | kdesu -u root 'some_command'
 
  
  Here's what I do in the vl-hot-config utility:
  
  ***
  ' Gambas module file
  
  PUBLIC SUB Main()
  DIM MyProc AS Process
  DIM Ret AS String
  
  IF System.User.Id  0 THEN
 EXEC [which, kdesu] TO Ret
 IF InStr(Ret, kdesu) THEN
EXEC [kdesu, Application.Path / vl-hot-config.gambas]
 ELSE
EXEC [which, gksu] TO Ret
IF InStr(Ret, gksu) THEN
   EXEC [gksu, Application.Path / vl-hot-config.gambas]
ELSE
   PRINT No kdesu or gksu available (vl-hot-config needs to run
  as root)...
ENDIF
 ENDIF
 QUIT
  ENDIF
  
  FMain.Show
  
  END
  ***
  
  Regards,
  Joe1962
  
  --
  Crystal Reports - New Free Runtime and 30 Day Trial
  Check out the new simplified licensing option that enables 
  unlimited royalty-free distribution of the report engine 
  for externally facing server and web deployment. 
  http://p.sf.net/sfu/businessobjects
  ___
  Gambas-user mailing list
  Gambas-user@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/gambas-user
  
 
 
 --
 Crystal Reports - New Free Runtime and 30 Day Trial
 Check out the new simplified licensing option that enables 
 unlimited royalty-free distribution of the report engine 
 for externally facing server and web deployment. 
 http://p.sf.net/sfu/businessobjects
 ___
 Gambas-user mailing list
 Gambas-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/gambas-user
 


--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] kdesu vs gksu

2009-05-18 Thread David Villalobos Cambronero

Hi,

  If Application.Env[KDE_FULL_SESSION] Then
Shell kdesu   Command
  Else If Application.Env[GNOME_DESKTOP_SESSION_ID] Then 
Shell gksu   Command
  Endif


 Saludos


--
David



- Original Message 
From: Jesus Guardon jguar...@telefonica.net
To: mailing list for gambas users gambas-user@lists.sourceforge.net
Sent: Monday, May 18, 2009 3:20:29 PM
Subject: [Gambas-user] kdesu vs gksu

Yes, I know it may be a little off-topic, but the question is:

I need to launch a process with root privileges from SHELL command in 
Gambas. Users of my application can have Gnome or KDE, so I don't know 
which command I must issue to get it to work.

Is there a way to choose between either gksu o kdesu commands at runtime?
I've figured it out if it could be something like:

  SHELL gksu | kdesu -u root 'some_command'

or

SHELL gksu -u root 'some_command' | kdesu -u root 'some_command'

Regards

Jesús

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user



  

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] kdesu vs gksu

2009-05-18 Thread Jesus Guardon
Hey, thanks for your quick reply, David

I'm going to test it now. I didn't know of these constants before.
Just in case they match, because I've found in OpenSuSe 11.1 with KDE 4 
that it is the opposite, it comes with gksu (at least in my testing VM).

Also, we may use which gksu to know if it is installed, otherwise we 
can assume kdesu is. Hmmm...

Thanks a lot!

Saludos

Jesús

David Villalobos Cambronero escribió:
 Hi,
 
   If Application.Env[KDE_FULL_SESSION] Then
 Shell kdesu   Command
   Else If Application.Env[GNOME_DESKTOP_SESSION_ID] Then 
 Shell gksu   Command
   Endif
 
 
  Saludos
 
 
 --
 David
 
 
 
 - Original Message 
 From: Jesus Guardon jguar...@telefonica.net
 To: mailing list for gambas users gambas-user@lists.sourceforge.net
 Sent: Monday, May 18, 2009 3:20:29 PM
 Subject: [Gambas-user] kdesu vs gksu
 
 Yes, I know it may be a little off-topic, but the question is:
 
 I need to launch a process with root privileges from SHELL command in 
 Gambas. Users of my application can have Gnome or KDE, so I don't know 
 which command I must issue to get it to work.
 
 Is there a way to choose between either gksu o kdesu commands at runtime?
 I've figured it out if it could be something like:
 
   SHELL gksu | kdesu -u root 'some_command'
 
 or
 
 SHELL gksu -u root 'some_command' | kdesu -u root 'some_command'
 
 Regards
 
 Jesús
 
 --
 Crystal Reports - New Free Runtime and 30 Day Trial
 Check out the new simplified licensing option that enables 
 unlimited royalty-free distribution of the report engine 
 for externally facing server and web deployment. 
 http://p.sf.net/sfu/businessobjects
 ___
 Gambas-user mailing list
 Gambas-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/gambas-user
 
 
 
   
 
 --
 Crystal Reports - New Free Runtime and 30 Day Trial
 Check out the new simplified licensing option that enables 
 unlimited royalty-free distribution of the report engine 
 for externally facing server and web deployment. 
 http://p.sf.net/sfu/businessobjects
 ___
 Gambas-user mailing list
 Gambas-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/gambas-user
 


--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user