Kaydet (Commit) 73971533 authored tarafından Ingo Schmidt's avatar Ingo Schmidt

native330 #163564# fixing installation on Cent OS

üst 109c2197
...@@ -76,6 +76,7 @@ public class InstallData ...@@ -76,6 +76,7 @@ public class InstallData
static private boolean useRtl = false; static private boolean useRtl = false;
static private boolean installedProductMinorSet = false; static private boolean installedProductMinorSet = false;
static private boolean isDebianSystem = false; static private boolean isDebianSystem = false;
static private boolean useForceDebian = false;
static private boolean debianInvestigated = false; static private boolean debianInvestigated = false;
static private String installType; /* custom or typical installation */ static private String installType; /* custom or typical installation */
static private String osType; /* Linux, SunOS, ... */ static private String osType; /* Linux, SunOS, ... */
...@@ -667,6 +668,14 @@ public class InstallData ...@@ -667,6 +668,14 @@ public class InstallData
isDebianSystem = value; isDebianSystem = value;
} }
public boolean useForceDebian() {
return useForceDebian;
}
public void setUseForceDebian(boolean value) {
useForceDebian = value;
}
public boolean databaseQueried() { public boolean databaseQueried() {
return databaseQueried; return databaseQueried;
} }
......
...@@ -202,12 +202,13 @@ public class LinuxInstaller extends Installer { ...@@ -202,12 +202,13 @@ public class LinuxInstaller extends Installer {
} }
if ( data.isDebianSystem() ) { if ( data.isDebianSystem() ) {
forceDebianString = "--force-debian";
nodepsString = "--nodeps"; nodepsString = "--nodeps";
if ( data.useForceDebian() ) {
forceDebianString = "--force-debian";
}
} }
String rpmCommand = "";
String[] rpmCommandArray;
String databasePath = null; String databasePath = null;
String databaseString = ""; String databaseString = "";
boolean useLocalDatabase = false; boolean useLocalDatabase = false;
...@@ -225,130 +226,57 @@ public class LinuxInstaller extends Installer { ...@@ -225,130 +226,57 @@ public class LinuxInstaller extends Installer {
useLocalDatabase = true; useLocalDatabase = true;
} }
if (useForce) { // Defining a Vector that contains the full rpm command. Then the string array can be
if (useLocalDatabase) { // created dynamically.
if ( relocations != null ) {
rpmCommand = "rpm --upgrade --ignoresize --force " + forceDebianString + " " + nodepsString + " -vh " + Vector rpmVector = new Vector();
"--relocate " + relocations + " " + databaseString +
" " + databasePath + " " + packageName; rpmVector.add("rpm");
rpmCommandArray = new String[12]; rpmVector.add("--upgrade");
rpmCommandArray[0] = "rpm"; rpmVector.add("--ignoresize");
rpmCommandArray[1] = "--upgrade";
rpmCommandArray[2] = "--ignoresize"; if ( useForce ) {
rpmCommandArray[3] = "--force"; rpmVector.add("--force");
rpmCommandArray[4] = forceDebianString; }
rpmCommandArray[5] = nodepsString;
rpmCommandArray[6] = "-vh"; if ( ! forceDebianString.equals("") ) {
rpmCommandArray[7] = "--relocate"; rpmVector.add(forceDebianString);
rpmCommandArray[8] = relocations;
rpmCommandArray[9] = databaseString;
rpmCommandArray[10] = databasePath;
rpmCommandArray[11] = packageName;
} else {
rpmCommand = "rpm --upgrade --ignoresize --force " + forceDebianString + " " + nodepsString + " -vh " +
databaseString + " " + databasePath + " " + packageName;
rpmCommandArray = new String[10];
rpmCommandArray[0] = "rpm";
rpmCommandArray[1] = "--upgrade";
rpmCommandArray[2] = "--ignoresize";
rpmCommandArray[3] = "--force";
rpmCommandArray[4] = forceDebianString;
rpmCommandArray[5] = nodepsString;
rpmCommandArray[6] = "-vh";
rpmCommandArray[7] = databaseString;
rpmCommandArray[8] = databasePath;
rpmCommandArray[9] = packageName;
}
} else {
if ( relocations != null )
{
rpmCommand = "rpm --upgrade --ignoresize --force " + forceDebianString + " " + nodepsString + " -vh " +
"--relocate " + relocations + " " + packageName;
rpmCommandArray = new String[10];
rpmCommandArray[0] = "rpm";
rpmCommandArray[1] = "--upgrade";
rpmCommandArray[2] = "--ignoresize";
rpmCommandArray[3] = "--force";
rpmCommandArray[4] = forceDebianString;
rpmCommandArray[5] = nodepsString;
rpmCommandArray[6] = "-vh";
rpmCommandArray[7] = "--relocate";
rpmCommandArray[8] = relocations;
rpmCommandArray[9] = packageName;
} else {
rpmCommand = "rpm --upgrade --ignoresize --force " + forceDebianString + " " + nodepsString + " -vh " + packageName;
rpmCommandArray = new String[8];
rpmCommandArray[0] = "rpm";
rpmCommandArray[1] = "--upgrade";
rpmCommandArray[2] = "--ignoresize";
rpmCommandArray[3] = "--force";
rpmCommandArray[4] = forceDebianString;
rpmCommandArray[5] = nodepsString;
rpmCommandArray[6] = "-vh";
rpmCommandArray[7] = packageName;
}
}
} else {
if (useLocalDatabase) {
if ( relocations != null ) {
rpmCommand = "rpm --upgrade --ignoresize " + forceDebianString + " " + nodepsString + " -vh " +
"--relocate " + relocations + " " + databaseString +
" " + databasePath + " " + packageName;
rpmCommandArray = new String[11];
rpmCommandArray[0] = "rpm";
rpmCommandArray[1] = "--upgrade";
rpmCommandArray[2] = "--ignoresize";
rpmCommandArray[3] = forceDebianString;
rpmCommandArray[4] = nodepsString;
rpmCommandArray[5] = "-vh";
rpmCommandArray[6] = "--relocate";
rpmCommandArray[7] = relocations;
rpmCommandArray[8] = databaseString;
rpmCommandArray[9] = databasePath;
rpmCommandArray[10] = packageName;
} else {
rpmCommand = "rpm --upgrade --ignoresize " + forceDebianString + " " + nodepsString + " -vh " +
databaseString + " " + databasePath + " " + packageName;
rpmCommandArray = new String[9];
rpmCommandArray[0] = "rpm";
rpmCommandArray[1] = "--upgrade";
rpmCommandArray[2] = "--ignoresize";
rpmCommandArray[3] = forceDebianString;
rpmCommandArray[4] = nodepsString;
rpmCommandArray[5] = "-vh";
rpmCommandArray[6] = databaseString;
rpmCommandArray[7] = databasePath;
rpmCommandArray[8] = packageName;
}
} else {
if ( relocations != null )
{
rpmCommand = "rpm --upgrade --ignoresize " + forceDebianString + " " + nodepsString + " -vh " +
"--relocate " + relocations + " " + packageName;
rpmCommandArray = new String[9];
rpmCommandArray[0] = "rpm";
rpmCommandArray[1] = "--upgrade";
rpmCommandArray[2] = "--ignoresize";
rpmCommandArray[3] = forceDebianString;
rpmCommandArray[4] = nodepsString;
rpmCommandArray[5] = "-vh";
rpmCommandArray[6] = "--relocate";
rpmCommandArray[7] = relocations;
rpmCommandArray[8] = packageName;
} else {
rpmCommand = "rpm --upgrade --ignoresize " + forceDebianString + " " + nodepsString + " -vh " + packageName;
rpmCommandArray = new String[7];
rpmCommandArray[0] = "rpm";
rpmCommandArray[1] = "--upgrade";
rpmCommandArray[2] = "--ignoresize";
rpmCommandArray[3] = forceDebianString;
rpmCommandArray[4] = nodepsString;
rpmCommandArray[5] = "-vh";
rpmCommandArray[6] = packageName;
}
}
} }
if ( ! nodepsString.equals("") ) {
rpmVector.add(nodepsString);
}
rpmVector.add("-vh");
if ( relocations != null ) {
rpmVector.add("--relocate");
rpmVector.add(relocations);
}
if ( useLocalDatabase ) {
rpmVector.add(databaseString);
rpmVector.add(databasePath);
}
rpmVector.add(packageName);
// Creating String and StringArray for rpm command
int capacity = rpmVector.size();
String rpmCommand = "";
String[] rpmCommandArray = new String[capacity];
for (int i = 0; i < rpmVector.size(); i++) {
rpmCommandArray[i] = (String)rpmVector.get(i);
rpmCommand = rpmCommand + " " + (String)rpmVector.get(i);
}
rpmCommand = rpmCommand.trim();
// Staring rpm process
Vector returnVector = new Vector(); Vector returnVector = new Vector();
Vector returnErrorVector = new Vector(); Vector returnErrorVector = new Vector();
// int returnValue = SystemManager.executeProcessReturnVector(rpmCommand, returnVector, returnErrorVector); // int returnValue = SystemManager.executeProcessReturnVector(rpmCommand, returnVector, returnErrorVector);
...@@ -407,8 +335,6 @@ public class LinuxInstaller extends Installer { ...@@ -407,8 +335,6 @@ public class LinuxInstaller extends Installer {
String databasePath = data.getDatabasePath(); String databasePath = data.getDatabasePath();
String databaseString = ""; String databaseString = "";
boolean useLocalDatabase = false; boolean useLocalDatabase = false;
String rpmCommand;
String[] rpmCommandArray;
if (( databasePath != null ) && (! databasePath.equalsIgnoreCase("null"))) { if (( databasePath != null ) && (! databasePath.equalsIgnoreCase("null"))) {
databaseString = "--dbpath"; databaseString = "--dbpath";
...@@ -427,52 +353,53 @@ public class LinuxInstaller extends Installer { ...@@ -427,52 +353,53 @@ public class LinuxInstaller extends Installer {
} }
if ( data.isDebianSystem() ) { if ( data.isDebianSystem() ) {
forceDebianString = "--force-debian";
nodepsString = "--nodeps"; nodepsString = "--nodeps";
if ( data.useForceDebian() ) {
forceDebianString = "--force-debian";
}
} }
// Code duplication for isDebianSystem is necessary, because there is no valid position // Defining a Vector that contains the full rpm command. Then the string array can be
// for forceDebianString, if it is empty. This is no problem in installPackage. // created dynamically.
if ( data.isDebianSystem() ) { Vector rpmVector = new Vector();
if (useLocalDatabase) { rpmVector.add("rpm");
rpmCommand = "rpm " + forceDebianString + " " + nodepsString + " -ev" + " " + databaseString + " " + databasePath + " " + packageName;
rpmCommandArray = new String[7]; if ( ! forceDebianString.equals("") ) {
rpmCommandArray[0] = "rpm"; rpmVector.add(forceDebianString);
rpmCommandArray[1] = forceDebianString; }
rpmCommandArray[2] = nodepsString;
rpmCommandArray[3] = "-ev"; if ( ! nodepsString.equals("") ) {
rpmCommandArray[4] = databaseString; rpmVector.add(nodepsString);
rpmCommandArray[5] = databasePath; }
rpmCommandArray[6] = packageName;
} else { rpmVector.add("-ev");
rpmCommand = "rpm " + forceDebianString + " " + nodepsString + " -ev" + " " + packageName;
rpmCommandArray = new String[5]; if ( useLocalDatabase ) {
rpmCommandArray[0] = "rpm"; rpmVector.add(databaseString);
rpmCommandArray[1] = forceDebianString; rpmVector.add(databasePath);
rpmCommandArray[2] = nodepsString;
rpmCommandArray[3] = "-ev";
rpmCommandArray[4] = packageName;
}
} else {
if (useLocalDatabase) {
rpmCommand = "rpm -ev" + " " + databaseString + " " + databasePath + " " + packageName;
rpmCommandArray = new String[5];
rpmCommandArray[0] = "rpm";
rpmCommandArray[1] = "-ev";
rpmCommandArray[2] = databaseString;
rpmCommandArray[3] = databasePath;
rpmCommandArray[4] = packageName;
} else {
rpmCommand = "rpm -ev" + " " + packageName;
rpmCommandArray = new String[3];
rpmCommandArray[0] = "rpm";
rpmCommandArray[1] = "-ev";
rpmCommandArray[2] = packageName;
}
} }
rpmVector.add(packageName);
// Creating String and StringArray for rpm command
int capacity = rpmVector.size();
String rpmCommand = "";
String[] rpmCommandArray = new String[capacity];
for (int i = 0; i < rpmVector.size(); i++) {
rpmCommandArray[i] = (String)rpmVector.get(i);
rpmCommand = rpmCommand + " " + (String)rpmVector.get(i);
}
rpmCommand = rpmCommand.trim();
// Starting rpm process
Vector returnVector = new Vector(); Vector returnVector = new Vector();
Vector returnErrorVector = new Vector(); Vector returnErrorVector = new Vector();
int returnValue = ExecuteProcess.executeProcessReturnVector(rpmCommandArray, returnVector, returnErrorVector); int returnValue = ExecuteProcess.executeProcessReturnVector(rpmCommandArray, returnVector, returnErrorVector);
......
...@@ -383,21 +383,32 @@ import java.util.Vector;public class LinuxHelper { ...@@ -383,21 +383,32 @@ import java.util.Vector;public class LinuxHelper {
public void investigateDebian(InstallData data) { public void investigateDebian(InstallData data) {
// String rpmQuery = "rpm --help; // First check: Is this a Debian system?
String[] rpmQueryArray = new String[2];
rpmQueryArray[0] = "rpm";
rpmQueryArray[1] = "--help";
Vector returnVector = new Vector(); String dpkgFile = "/usr/bin/dpkg";
Vector returnErrorVector = new Vector();
int returnValue = ExecuteProcess.executeProcessReturnVector(rpmQueryArray, returnVector, returnErrorVector);
// Checking if the return vector contains the string "force-debian" if ( new File(dpkgFile).exists() ) {
for (int i = 0; i < returnVector.size(); i++) { data.setIsDebianSystem(true);
String line = (String) returnVector.get(i);
if ( line.indexOf("force-debian") > -1 ) { // Second check: If this is a Debian system, is "--force-debian" required?
data.setIsDebianSystem(true);
// String rpmQuery = "rpm --help;
String[] rpmQueryArray = new String[2];
rpmQueryArray[0] = "rpm";
rpmQueryArray[1] = "--help";
Vector returnVector = new Vector();
Vector returnErrorVector = new Vector();
int returnValue = ExecuteProcess.executeProcessReturnVector(rpmQueryArray, returnVector, returnErrorVector);
// Checking if the return vector contains the string "force-debian"
for (int i = 0; i < returnVector.size(); i++) {
String line = (String) returnVector.get(i);
if ( line.indexOf("force-debian") > -1 ) {
data.setUseForceDebian(true);
}
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment