dcsimg
Java Installation
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Monday, November 26, 2001 01:46 AM

Hi gurus, This query is regarding java installation using a UI. Im working on Redhat Linux. Im a normal/domain user and Im writing an installation program which opens up a UI asking for root password and installs Java (jdk) using the j2sdkXXX.rpm package. If I run a shell script with the command su -c "rpm -i j2sdkXXX.rpm" how can I pass the super user password to the script from my UI ??. su seems to be taking the password only thru the console and not from other sources (variable,file etc) Can anybody help me ??!! OR is there a better way to install Java using UI ????????? (I also tried to use st   More>>
			
Hi gurus,
This query is regarding java installation using a UI.

Im working on Redhat Linux.
Im a normal/domain user and Im writing an installation program which opens up
a UI asking for root password and installs Java (jdk) using the
j2sdkXXX.rpm package.

If I run a shell script with the command

su -c "rpm -i j2sdkXXX.rpm"

how can I pass the super user password to the script from my UI ??.

su seems to be taking the password only thru the console and not from other
sources (variable,file etc)
Can anybody help me ??!!
OR
is there a better way to install Java using UI ?????????

(I also tried to use

stty -F file.txt

with file.txt containing password
It dint work out)

Awaiting solution ...


Thanks in advance,
rameshvl
   <<Less

Re: Java Installation

Posted By:   Nathan_Meyers  
Posted On:   Monday, November 26, 2001 09:14 AM

This is a pretty ugly problem.


The su utility expects to receive its password through a tty interface on stdin (at least that's how it looks on the Mandrake 8.1 distro). The easiest solution would be to make the user run your installer as root (make the user type "su -c installer" and supply the password).


If that's not possible, here's something that I think will work. It assumes your installer is in C, Perl, or some other environment that lets you manage subprocesses. file descriptors, and pseudo-ttys:



  • Allocate a pseudo-tty pair.


  • Fork a subprocess


  • Reassociate the subprocess' stdin and stdout with the slave pty.


  • Exec su from the subprocess.


  • In the parent process, feed the password to the master side of the pty.



No, this isn't pretty. And it assumes that su will always work from a stdin that looks like a tty (which I haven't checked outside of Mandrake 8.1). But I think it has a chance of working.

About | Sitemap | Contact