diff options
author | Kurt Zenker <kz@openoffice.org> | 2010-09-24 15:25:02 +0200 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2010-09-24 15:25:02 +0200 |
commit | 414f16693f0828efb240d64cfa1a99fa8486ca4b (patch) | |
tree | 46f98eaa5504ccb4d81b9e6adfcb10d4ff418b7f | |
parent | 9f245ff0a3cc039304c4a4e5205baedaf76dbacc (diff) | |
parent | ce53dcd5bacb13b47afcec9662f98bc729dc1a5e (diff) |
CWS-TOOLING: integrate CWS native330ooo/OOO330_m9
4 files changed, 130 insertions, 183 deletions
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/InstallData.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/InstallData.java index d3ba4abc5..30a222d3b 100755 --- a/javainstaller2/src/JavaSetup/org/openoffice/setup/InstallData.java +++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/InstallData.java @@ -76,6 +76,7 @@ public class InstallData static private boolean useRtl = false; static private boolean installedProductMinorSet = false; static private boolean isDebianSystem = false; + static private boolean useForceDebian = false; /* --force-debian */ static private boolean debianInvestigated = false; static private String installType; /* custom or typical installation */ static private String osType; /* Linux, SunOS, ... */ @@ -667,6 +668,14 @@ public class InstallData isDebianSystem = value; } + public boolean useForceDebian() { + return useForceDebian; + } + + public void setUseForceDebian(boolean value) { + useForceDebian = value; + } + public boolean databaseQueried() { return databaseQueried; } diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Installer/LinuxInstaller.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Installer/LinuxInstaller.java index c66c84a56..204c9e18e 100755 --- a/javainstaller2/src/JavaSetup/org/openoffice/setup/Installer/LinuxInstaller.java +++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Installer/LinuxInstaller.java @@ -202,12 +202,13 @@ public class LinuxInstaller extends Installer { } if ( data.isDebianSystem() ) { - forceDebianString = "--force-debian"; nodepsString = "--nodeps"; + + if ( data.useForceDebian() ) { + forceDebianString = "--force-debian"; + } } - String rpmCommand = ""; - String[] rpmCommandArray; String databasePath = null; String databaseString = ""; boolean useLocalDatabase = false; @@ -225,130 +226,57 @@ public class LinuxInstaller extends Installer { useLocalDatabase = true; } - if (useForce) { - if (useLocalDatabase) { - if ( relocations != null ) { - rpmCommand = "rpm --upgrade --ignoresize --force " + forceDebianString + " " + nodepsString + " -vh " + - "--relocate " + relocations + " " + databaseString + - " " + databasePath + " " + packageName; - rpmCommandArray = new String[12]; - 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] = 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; - } - } + // Defining a Vector that contains the full rpm command. Then the string array can be + // created dynamically. Otherwise there would be too many different scenarios. + + Vector rpmVector = new Vector(); + + rpmVector.add("rpm"); + rpmVector.add("--upgrade"); + rpmVector.add("--ignoresize"); + + if ( useForce ) { + rpmVector.add("--force"); } - + + if ( ! forceDebianString.equals("") ) { + rpmVector.add(forceDebianString); + } + + 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 returnErrorVector = new Vector(); // int returnValue = SystemManager.executeProcessReturnVector(rpmCommand, returnVector, returnErrorVector); @@ -407,8 +335,6 @@ public class LinuxInstaller extends Installer { String databasePath = data.getDatabasePath(); String databaseString = ""; boolean useLocalDatabase = false; - String rpmCommand; - String[] rpmCommandArray; if (( databasePath != null ) && (! databasePath.equalsIgnoreCase("null"))) { databaseString = "--dbpath"; @@ -427,51 +353,52 @@ public class LinuxInstaller extends Installer { } if ( data.isDebianSystem() ) { - forceDebianString = "--force-debian"; nodepsString = "--nodeps"; + + if ( data.useForceDebian() ) { + forceDebianString = "--force-debian"; + } } - - // Code duplication for isDebianSystem is necessary, because there is no valid position - // for forceDebianString, if it is empty. This is no problem in installPackage. - if ( data.isDebianSystem() ) { - - if (useLocalDatabase) { - rpmCommand = "rpm " + forceDebianString + " " + nodepsString + " -ev" + " " + databaseString + " " + databasePath + " " + packageName; - rpmCommandArray = new String[7]; - rpmCommandArray[0] = "rpm"; - rpmCommandArray[1] = forceDebianString; - rpmCommandArray[2] = nodepsString; - rpmCommandArray[3] = "-ev"; - rpmCommandArray[4] = databaseString; - rpmCommandArray[5] = databasePath; - rpmCommandArray[6] = packageName; - } else { - rpmCommand = "rpm " + forceDebianString + " " + nodepsString + " -ev" + " " + packageName; - rpmCommandArray = new String[5]; - rpmCommandArray[0] = "rpm"; - rpmCommandArray[1] = forceDebianString; - 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; - } + // Defining a Vector that contains the full rpm command. Then the string array can be + // created dynamically. Otherwise there would be too many different scenarios. + + Vector rpmVector = new Vector(); + + rpmVector.add("rpm"); + + if ( ! forceDebianString.equals("") ) { + rpmVector.add(forceDebianString); } + + if ( ! nodepsString.equals("") ) { + rpmVector.add(nodepsString); + } + + rpmVector.add("-ev"); + + 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(); + + // Starting rpm process Vector returnVector = new Vector(); Vector returnErrorVector = new Vector(); diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/InstallerHelper/LinuxHelper.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/InstallerHelper/LinuxHelper.java index 9ce41daf2..fb8bfa96a 100755 --- a/javainstaller2/src/JavaSetup/org/openoffice/setup/InstallerHelper/LinuxHelper.java +++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/InstallerHelper/LinuxHelper.java @@ -383,21 +383,33 @@ import java.util.Vector;public class LinuxHelper { public void investigateDebian(InstallData data) { - // 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); + // First check: Is this a Debian system? - // Checking if the return vector contains the string "force-debian" + String dpkgFile = "/usr/bin/dpkg"; + + if ( new File(dpkgFile).exists() ) { + + data.setIsDebianSystem(true); + + // Second check: If this is a Debian system, is "--force-debian" required? Older + // versions do not support "--force-debian". + + // 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.setIsDebianSystem(true); + for (int i = 0; i < returnVector.size(); i++) { + String line = (String) returnVector.get(i); + if ( line.indexOf("force-debian") > -1 ) { + data.setUseForceDebian(true); + } } } } diff --git a/setup_native/scripts/admin.pl b/setup_native/scripts/admin.pl index 466182b24..d90c76650 100644 --- a/setup_native/scripts/admin.pl +++ b/setup_native/scripts/admin.pl @@ -66,7 +66,6 @@ sub usage { print <<Ende; ---------------------------------------------------------------------- -$prog V1.0 (c) Sun Microsystems 2009 This program installs a Windows Installer installation set without using msiexec.exe. The installation is comparable with an administrative installation using the Windows Installer |