P
Peter Palsherm
Hi,
I want to install RPM's (Redhat Packet Manager) out of a java
programm.
Therefore I use the getRuntime() method that allows me to execute
commands
from java.
This works fine for simple RPM's which have no pre or
postinstallationscripts.
But if I try to install a RPM-Pakete that executes a script before or
after
the installation (like webmin) the programm hangs forever.
I think when rpm trys to execute the per/postscripts it attempts to
open a new
process,fork or something like that, but the environment doesn't
support it.
Here is the java code:
public String executeRPM() {
String iStr="";
String eStr="";
StringBuffer buff= new StringBuffer();
try {
Process proc = Runtime.getRuntime().exec("rpm -iv
/path/to/rpm/webmin-1.130-1.noarch.rpm");
InputStream iStream = proc.getInputStream();
InputStream eStream = proc.getErrorStream();
BufferedReader bReader = new BufferedReader(new
InputStreamReader(iStream));
BufferedReader eReader = new BufferedReader(new
InputStreamReader(eStream));
while ((iStr = bReader.readLine()) != null)
{ buff.append(iStr);
buff.append("|");
}
buff.append("%");
while ((eStr = eReader.readLine()) != null)
{ buff.append(eStr);
buff.append("|");
}
} catch (Exception e) {
return ("Fehler in Methode executeRPM() " + e);
}
// returns errormsg and feedback from rpm
return buff.toString();
}
If I use the command : "rpm -iv --noscripts
/path/to/rpm/webmin-1.130-1.noarch.rpm"
then the installation runs without errors. But then I have a damaged /
scrap installation!
Is there a way that the environment supports forking? (Maybe a wrapper
program in c or c++? And how must it look like?)
Or can I execute the pre/postinstallstionscripts manually?
Any other solutions, workarounds or ideas????
thanks in advance
Peter Palsherm
I want to install RPM's (Redhat Packet Manager) out of a java
programm.
Therefore I use the getRuntime() method that allows me to execute
commands
from java.
This works fine for simple RPM's which have no pre or
postinstallationscripts.
But if I try to install a RPM-Pakete that executes a script before or
after
the installation (like webmin) the programm hangs forever.
I think when rpm trys to execute the per/postscripts it attempts to
open a new
process,fork or something like that, but the environment doesn't
support it.
Here is the java code:
public String executeRPM() {
String iStr="";
String eStr="";
StringBuffer buff= new StringBuffer();
try {
Process proc = Runtime.getRuntime().exec("rpm -iv
/path/to/rpm/webmin-1.130-1.noarch.rpm");
InputStream iStream = proc.getInputStream();
InputStream eStream = proc.getErrorStream();
BufferedReader bReader = new BufferedReader(new
InputStreamReader(iStream));
BufferedReader eReader = new BufferedReader(new
InputStreamReader(eStream));
while ((iStr = bReader.readLine()) != null)
{ buff.append(iStr);
buff.append("|");
}
buff.append("%");
while ((eStr = eReader.readLine()) != null)
{ buff.append(eStr);
buff.append("|");
}
} catch (Exception e) {
return ("Fehler in Methode executeRPM() " + e);
}
// returns errormsg and feedback from rpm
return buff.toString();
}
If I use the command : "rpm -iv --noscripts
/path/to/rpm/webmin-1.130-1.noarch.rpm"
then the installation runs without errors. But then I have a damaged /
scrap installation!
Is there a way that the environment supports forking? (Maybe a wrapper
program in c or c++? And how must it look like?)
Or can I execute the pre/postinstallstionscripts manually?
Any other solutions, workarounds or ideas????
thanks in advance
Peter Palsherm