diff options
author | Kurt Zenker <kz@openoffice.org> | 2010-08-18 13:32:26 +0200 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2010-08-18 13:32:26 +0200 |
commit | ae0c34553de6ecabbc6420979a99829c11e472fa (patch) | |
tree | 99836d7cbef75720c197ba301e95115dab462d00 | |
parent | 19c39d8ca1d55ac1cd3349a319669ffd0bee7f18 (diff) | |
parent | d5b054dc43970313df80e253c78a424841a4eed4 (diff) |
CWS-TOOLING: integrate CWS native324ooo/OOO330_m5
4 files changed, 186 insertions, 65 deletions
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/InstallData.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/InstallData.java index 8ceec83a7..d3ba4abc5 100755 --- a/javainstaller2/src/JavaSetup/org/openoffice/setup/InstallData.java +++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/InstallData.java @@ -75,6 +75,8 @@ public class InstallData static private boolean databaseQueried = false; static private boolean useRtl = false; static private boolean installedProductMinorSet = false; + static private boolean isDebianSystem = false; + static private boolean debianInvestigated = false; static private String installType; /* custom or typical installation */ static private String osType; /* Linux, SunOS, ... */ static private String installDir = null; @@ -649,6 +651,22 @@ public class InstallData installedProductMinorSet = value; } + public boolean debianInvestigated() { + return debianInvestigated; + } + + public void setDebianInvestigated(boolean value) { + debianInvestigated = value; + } + + public boolean isDebianSystem() { + return isDebianSystem; + } + + public void setIsDebianSystem(boolean value) { + isDebianSystem = 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 e99a93cb0..c66c84a56 100755 --- a/javainstaller2/src/JavaSetup/org/openoffice/setup/Installer/LinuxInstaller.java +++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Installer/LinuxInstaller.java @@ -190,6 +190,22 @@ public class LinuxInstaller extends Installer { if ( sofficeLink.exists() ) { useForce = true; } } + // On Debian based systems, rpms can be installed with the switch --force-debian, if a rpm + // is installed. + + String forceDebianString = ""; + String nodepsString = ""; + + if ( ! data.debianInvestigated() ) { + helper.investigateDebian(data); + data.setDebianInvestigated(true); + } + + if ( data.isDebianSystem() ) { + forceDebianString = "--force-debian"; + nodepsString = "--nodeps"; + } + String rpmCommand = ""; String[] rpmCommandArray; String databasePath = null; @@ -212,107 +228,123 @@ public class LinuxInstaller extends Installer { if (useForce) { if (useLocalDatabase) { if ( relocations != null ) { - rpmCommand = "rpm --upgrade --ignoresize --force -vh " + + rpmCommand = "rpm --upgrade --ignoresize --force " + forceDebianString + " " + nodepsString + " -vh " + "--relocate " + relocations + " " + databaseString + " " + databasePath + " " + packageName; - rpmCommandArray = new String[10]; + rpmCommandArray = new String[12]; rpmCommandArray[0] = "rpm"; rpmCommandArray[1] = "--upgrade"; rpmCommandArray[2] = "--ignoresize"; rpmCommandArray[3] = "--force"; - rpmCommandArray[4] = "-vh"; - rpmCommandArray[5] = "--relocate"; - rpmCommandArray[6] = relocations; - rpmCommandArray[7] = databaseString; - rpmCommandArray[8] = databasePath; - rpmCommandArray[9] = packageName; + 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 -vh " + + rpmCommand = "rpm --upgrade --ignoresize --force " + forceDebianString + " " + nodepsString + " -vh " + databaseString + " " + databasePath + " " + packageName; - rpmCommandArray = new String[8]; + rpmCommandArray = new String[10]; rpmCommandArray[0] = "rpm"; rpmCommandArray[1] = "--upgrade"; rpmCommandArray[2] = "--ignoresize"; rpmCommandArray[3] = "--force"; - rpmCommandArray[4] = "-vh"; - rpmCommandArray[5] = databaseString; - rpmCommandArray[6] = databasePath; - rpmCommandArray[7] = packageName; + 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 -vh " + + rpmCommand = "rpm --upgrade --ignoresize --force " + forceDebianString + " " + nodepsString + " -vh " + "--relocate " + relocations + " " + packageName; - rpmCommandArray = new String[8]; + rpmCommandArray = new String[10]; rpmCommandArray[0] = "rpm"; rpmCommandArray[1] = "--upgrade"; rpmCommandArray[2] = "--ignoresize"; rpmCommandArray[3] = "--force"; - rpmCommandArray[4] = "-vh"; - rpmCommandArray[5] = "--relocate"; - rpmCommandArray[6] = relocations; - rpmCommandArray[7] = packageName; + rpmCommandArray[4] = forceDebianString; + rpmCommandArray[5] = nodepsString; + rpmCommandArray[6] = "-vh"; + rpmCommandArray[7] = "--relocate"; + rpmCommandArray[8] = relocations; + rpmCommandArray[9] = packageName; } else { - rpmCommand = "rpm --upgrade --ignoresize --force -vh " + packageName; - rpmCommandArray = new String[6]; + 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] = "-vh"; - rpmCommandArray[5] = packageName; + rpmCommandArray[4] = forceDebianString; + rpmCommandArray[5] = nodepsString; + rpmCommandArray[6] = "-vh"; + rpmCommandArray[7] = packageName; } } } else { if (useLocalDatabase) { if ( relocations != null ) { - rpmCommand = "rpm --upgrade --ignoresize -vh " + + rpmCommand = "rpm --upgrade --ignoresize " + forceDebianString + " " + nodepsString + " -vh " + "--relocate " + relocations + " " + databaseString + " " + databasePath + " " + packageName; - rpmCommandArray = new String[9]; + rpmCommandArray = new String[11]; rpmCommandArray[0] = "rpm"; rpmCommandArray[1] = "--upgrade"; rpmCommandArray[2] = "--ignoresize"; - rpmCommandArray[3] = "-vh"; - rpmCommandArray[4] = "--relocate"; - rpmCommandArray[5] = relocations; - rpmCommandArray[6] = databaseString; - rpmCommandArray[7] = databasePath; - rpmCommandArray[8] = packageName; + 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 -vh " + + rpmCommand = "rpm --upgrade --ignoresize " + forceDebianString + " " + nodepsString + " -vh " + databaseString + " " + databasePath + " " + packageName; - rpmCommandArray = new String[7]; + rpmCommandArray = new String[9]; rpmCommandArray[0] = "rpm"; rpmCommandArray[1] = "--upgrade"; rpmCommandArray[2] = "--ignoresize"; - rpmCommandArray[3] = "-vh"; - rpmCommandArray[4] = databaseString; - rpmCommandArray[5] = databasePath; - rpmCommandArray[6] = packageName; + 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 -vh " + + rpmCommand = "rpm --upgrade --ignoresize " + forceDebianString + " " + nodepsString + " -vh " + "--relocate " + relocations + " " + packageName; - rpmCommandArray = new String[7]; + rpmCommandArray = new String[9]; rpmCommandArray[0] = "rpm"; rpmCommandArray[1] = "--upgrade"; rpmCommandArray[2] = "--ignoresize"; - rpmCommandArray[3] = "-vh"; - rpmCommandArray[4] = "--relocate"; - rpmCommandArray[5] = relocations; - rpmCommandArray[6] = packageName; + rpmCommandArray[3] = forceDebianString; + rpmCommandArray[4] = nodepsString; + rpmCommandArray[5] = "-vh"; + rpmCommandArray[6] = "--relocate"; + rpmCommandArray[7] = relocations; + rpmCommandArray[8] = packageName; } else { - rpmCommand = "rpm --upgrade --ignoresize -vh " + packageName; - rpmCommandArray = new String[5]; + rpmCommand = "rpm --upgrade --ignoresize " + forceDebianString + " " + nodepsString + " -vh " + packageName; + rpmCommandArray = new String[7]; rpmCommandArray[0] = "rpm"; rpmCommandArray[1] = "--upgrade"; rpmCommandArray[2] = "--ignoresize"; - rpmCommandArray[3] = "-vh"; - rpmCommandArray[4] = packageName; + rpmCommandArray[3] = forceDebianString; + rpmCommandArray[4] = nodepsString; + rpmCommandArray[5] = "-vh"; + rpmCommandArray[6] = packageName; } } } @@ -382,21 +414,63 @@ public class LinuxInstaller extends Installer { databaseString = "--dbpath"; useLocalDatabase = true; } + + // On Debian based systems, rpms can be installed with the switch --force-debian, if a rpm + // is installed. + + String forceDebianString = ""; + String nodepsString = ""; + + if ( ! data.debianInvestigated() ) { + helper.investigateDebian(data); + data.setDebianInvestigated(true); + } + + if ( data.isDebianSystem() ) { + forceDebianString = "--force-debian"; + nodepsString = "--nodeps"; + } + + // 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 -ev" + " " + databaseString + " " + databasePath + " " + packageName; - rpmCommandArray = new String[5]; - rpmCommandArray[0] = "rpm"; - rpmCommandArray[1] = "-ev"; - rpmCommandArray[2] = databaseString; - rpmCommandArray[3] = databasePath; - rpmCommandArray[4] = packageName; + 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 { - rpmCommand = "rpm -ev" + " " + packageName; - rpmCommandArray = new String[3]; - rpmCommandArray[0] = "rpm"; - rpmCommandArray[1] = "-ev"; - rpmCommandArray[2] = packageName; + 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; + } } Vector returnVector = 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 1ce882713..9ce41daf2 100755 --- a/javainstaller2/src/JavaSetup/org/openoffice/setup/InstallerHelper/LinuxHelper.java +++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/InstallerHelper/LinuxHelper.java @@ -380,6 +380,27 @@ import java.util.Vector;public class LinuxHelper { databasePath = databaseFile.getPath(); return databasePath; } + + 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); + + // 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); + } + } + } public void getLinuxFileInfo(PackageDescription packageData) { // analyzing a string like "openoffice-core01-2.0.3-159" as "name-version-release" diff --git a/setup_native/scripts/install_linux.sh b/setup_native/scripts/install_linux.sh index 955a185ac..12801b62f 100644 --- a/setup_native/scripts/install_linux.sh +++ b/setup_native/scripts/install_linux.sh @@ -121,6 +121,14 @@ then exit 2 fi +# #163256# check if we are on a debian system... +if rpm --help | grep debian >/dev/null; +then + DEBIAN_FLAGS="--force-debian --nodeps" +else + DEBIAN_FLAGS= +fi + # # Determine whether this should be an update or a fresh install # @@ -227,7 +235,7 @@ FAKEDBRPM=/tmp/fake-db-1.0-$$.noarch.rpm linenum=??? tail -n +$linenum $0 > $FAKEDBRPM -rpm --upgrade --ignoresize --dbpath $RPM_DB_PATH $FAKEDBRPM +rpm ${DEBIAN_FLAGS} --upgrade --ignoresize --dbpath $RPM_DB_PATH $FAKEDBRPM rm -f $FAKEDBRPM @@ -253,7 +261,7 @@ echo "Installing the RPMs" ABSROOT=`cd ${INSTALLDIR}; pwd` RELOCATIONS=`rpm -qp --qf "--relocate %{PREFIXES}=${ABSROOT}%{PREFIXES} \n" $RPMLIST | sort -u | tr -d "\012"` -UserInstallation=\$BRAND_BASE_DIR/../UserInstallation rpm $RPMCMD --ignoresize -vh $RELOCATIONS --dbpath $RPM_DB_PATH $RPMLIST +UserInstallation=\$BRAND_BASE_DIR/../UserInstallation rpm ${DEBIAN_FLAGS} $RPMCMD --ignoresize -vh $RELOCATIONS --dbpath $RPM_DB_PATH $RPMLIST # # Create a link into the users home directory @@ -268,11 +276,11 @@ if [ "$UPDATE" = "yes" -a ! -f $INSTALLDIR/program/bootstraprc ] then echo echo "Update failed due to a bug in RPM, uninstalling .." - rpm --erase -v --nodeps --dbpath $RPM_DB_PATH `rpm --query --queryformat "%{NAME} " --package $RPMLIST --dbpath $RPM_DB_PATH` + rpm ${DEBIAN_FLAGS} --erase -v --nodeps --dbpath $RPM_DB_PATH `rpm --query --queryformat "%{NAME} " --package $RPMLIST --dbpath $RPM_DB_PATH` echo echo "Now re-installing new packages .." echo - rpm --install --nodeps --ignoresize -vh $RELOCATIONS --dbpath $RPM_DB_PATH $RPMLIST + rpm ${DEBIAN_FLAGS} --install --nodeps --ignoresize -vh $RELOCATIONS --dbpath $RPM_DB_PATH $RPMLIST echo fi |