diff options
author | Hans-Joachim Lankenau <hjs@openoffice.org> | 2009-03-23 13:20:22 +0000 |
---|---|---|
committer | Hans-Joachim Lankenau <hjs@openoffice.org> | 2009-03-23 13:20:22 +0000 |
commit | ddab0ce7a201c26351925db49ea435f2d7a6170a (patch) | |
tree | 4f200c683424c2aa509e38cb4a8ea3085b63a188 /javainstaller2 | |
parent | 4140aa38e45d3992cd339e7c5aca129cfa8dbe5d (diff) |
CWS-TOOLING: integrate CWS native235_DEV300
2009-03-13 15:30:12 +0100 is r269487 : #i100131# major upgrade for Java GUI Installer
2009-03-13 12:41:03 +0100 is r269471 : #i100131# major upgrade for Java GUI Installer
2009-03-13 12:38:38 +0100 is r269470 : #i100131# major upgrade for Java GUI Installer
2009-03-13 12:37:59 +0100 is r269469 : #i100131# major upgrade for Java GUI Installer
2009-03-12 18:47:26 +0100 is r269437 : #i100131# major upgrade for Java GUI Installer
2009-03-12 18:46:52 +0100 is r269436 : #i100131# major upgrade for Java GUI Installer
2009-03-11 17:17:37 +0100 is r269345 : #i100131# Major Ugrade for Java GUI Installer
2009-03-11 17:11:38 +0100 is r269344 : #i100131# Major Ugrade for Java GUI Installer
2009-03-11 17:10:59 +0100 is r269343 : #i100131# Major Ugrade for Java GUI Installer
Diffstat (limited to 'javainstaller2')
14 files changed, 439 insertions, 31 deletions
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/InstallationOngoingCtrl.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/InstallationOngoingCtrl.java index cb08fb41bbe8..412eae3fdabf 100755 --- a/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/InstallationOngoingCtrl.java +++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/InstallationOngoingCtrl.java @@ -85,6 +85,14 @@ public class InstallationOngoingCtrl extends PanelController { PackageCollector.sortPackages(installPackages, sortedPackages, "install"); installData.setInstallPackages(sortedPackages); + if ( installData.isMajorUpgrade() ) { + // PackageCollector.findOldPackages(installData); + // Sorting for correct order of uninstallation + Vector sortedUninstallPackages = new Vector(); + PackageCollector.sortPackages(installData.getOldPackages(), sortedUninstallPackages, "uninstall"); + installData.setOldPackages(sortedUninstallPackages); + } + Installer installer = InstallerFactory.getInstance(); installer.preInstallationOngoing(); } @@ -96,6 +104,7 @@ public class InstallationOngoingCtrl extends PanelController { InstallData installData = InstallData.getInstance(); InstallationOngoing panel = (InstallationOngoing)getPanel(); Vector installPackages = installData.getInstallPackages(); + Vector removePackages = installData.getOldPackages(); private Vector installedPackages = new Vector(); public void run() { @@ -110,6 +119,18 @@ public class InstallationOngoingCtrl extends PanelController { panel.setProgressValue(progress); panel.setProgressText(packageData.getPackageName()); + // Creating an upgrade process for Solaris packages + if ( installData.getOSType().equalsIgnoreCase("SunOS") ) { + if ( installer.isPackageInstalled(packageData, installData) ) { + if ( installer.isInstalledPackageOlder(packageData, installData) ) { + packageData.setIgnoreDependsForUninstall(true); + installer.uninstallPackage(packageData); + } else { + continue; // no downgrading + } + } + } + installer.installPackage(packageData); installedPackages.add(packageData); @@ -118,6 +139,13 @@ public class InstallationOngoingCtrl extends PanelController { } } + if ( installData.isMajorUpgrade() ) { + for (int i = 0; i < removePackages.size(); i++) { + PackageDescription packageData = (PackageDescription) removePackages.get(i); + installer.uninstallPackage(packageData); + } + } + if ( installData.isAbortedInstallation() ) { // undoing the installation LogManager.setCommandsHeaderLine("Installation aborted!"); diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/UninstallationPrologueCtrl.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/UninstallationPrologueCtrl.java index 2b5773171298..b006e4671abc 100755 --- a/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/UninstallationPrologueCtrl.java +++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/UninstallationPrologueCtrl.java @@ -95,7 +95,9 @@ public class UninstallationPrologueCtrl extends PanelController { // adding information to installData data.setPackagePath((String)map.get("PackagePath")); data.setAdminFileNameReloc((String)map.get("AdminFileReloc")); + data.setAdminFileNameRelocNoDepends((String)map.get("AdminFileRelocNoDepends")); data.setAdminFileNameNoReloc((String)map.get("AdminFileNoReloc")); + data.setAdminFileNameNoRelocNoDepends((String)map.get("AdminFileNoRelocNoDepends")); data.setDatabasePath((String)map.get("DatabasePath")); data.setInstallDir((String)map.get("InstallationDir")); data.setStoredInstallationPrivileges((String)map.get("InstallationPrivileges")); diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/InstallData.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/InstallData.java index 56c21620a6d5..476669c0617f 100755 --- a/javainstaller2/src/JavaSetup/org/openoffice/setup/InstallData.java +++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/InstallData.java @@ -71,11 +71,13 @@ public class InstallData static private boolean olderVersionExists = false; static private boolean sameVersionExists = false; static private boolean newerVersionExists = false; + static private boolean majorUpgrade = false; static private boolean isMultiLingual = false; static private boolean dontUpdate = false; static private boolean hideEula = false; static private boolean databaseQueried = false; static private boolean useRtl = false; + static private boolean installedProductMinorSet = false; static private String installType; /* custom or typical installation */ static private String osType; /* Linux, SunOS, ... */ static private String installDir = null; @@ -87,7 +89,9 @@ public class InstallData static private String packagePath = null; static private String packageSubdir = "packages"; static private String adminFileNameReloc = null; + static private String adminFileNameRelocNoDepends = null; static private String adminFileNameNoReloc = null; + static private String adminFileNameNoRelocNoDepends = null; static private String databasePath = null; static private String getUidPath = null; static private String installationPrivileges = null; @@ -97,6 +101,8 @@ public class InstallData static private String uninstallDirName = "uninstalldata"; static private int availableDiscSpace = 0; static private int preselectedLanguages = 0; + static private int productMinor = 0; + static private int installedProductMinor = 0; static private File jarFilePath = null; static private File resourceRoot; static private File infoRoot; @@ -105,6 +111,7 @@ public class InstallData static private PackageDescription updatePackage = null; static private Vector removeFiles = new Vector(); /* Files to remove, if installation is aborted */ static private Vector installPackages = new Vector(); + static private Vector oldPackages = new Vector(); static private Vector systemLanguages = new Vector(); public static InstallData getInstance() @@ -290,6 +297,22 @@ public class InstallData productDir = dir; } + public int getProductMinor() { + return productMinor; + } + + public void setProductMinor(int minor) { + productMinor = minor; + } + + public int getInstalledProductMinor() { + return installedProductMinor; + } + + public void setInstalledProductMinor(int minor) { + installedProductMinor = minor; + } + public String getInstallDirName() { return installDirName; } @@ -389,6 +412,14 @@ public class InstallData adminFileNameReloc = fileName; } + public String getAdminFileNameRelocNoDepends() { + return adminFileNameRelocNoDepends; + } + + public void setAdminFileNameRelocNoDepends(String fileName) { + adminFileNameRelocNoDepends = fileName; + } + public String getAdminFileNameNoReloc() { return adminFileNameNoReloc; } @@ -397,6 +428,14 @@ public class InstallData adminFileNameNoReloc = fileName; } + public String getAdminFileNameNoRelocNoDepends() { + return adminFileNameNoRelocNoDepends; + } + + public void setAdminFileNameNoRelocNoDepends(String fileName) { + adminFileNameNoRelocNoDepends = fileName; + } + public String getGetUidPath() { return getUidPath; } @@ -565,6 +604,14 @@ public class InstallData olderVersionExists = exists; } + public boolean isMajorUpgrade() { + return majorUpgrade; + } + + public void setMajorUpgrade(boolean upgrade) { + majorUpgrade = upgrade; + } + public boolean sameVersionExists() { return sameVersionExists; } @@ -597,6 +644,14 @@ public class InstallData hideEula = value; } + public boolean installedProductMinorSet() { + return installedProductMinorSet; + } + + public void setInstalledProductMinorSet(boolean value) { + installedProductMinorSet = value; + } + public boolean databaseQueried() { return databaseQueried; } @@ -637,6 +692,14 @@ public class InstallData installPackages = packages; } + public Vector getOldPackages() { + return oldPackages; + } + + public void setOldPackages(Vector packages) { + oldPackages = packages; + } + public Vector getSystemLanguages() { return systemLanguages; } diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Installer/LinuxInstaller.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Installer/LinuxInstaller.java index fc4104cbdc7c..b4a9ffbe7506 100755 --- a/javainstaller2/src/JavaSetup/org/openoffice/setup/Installer/LinuxInstaller.java +++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Installer/LinuxInstaller.java @@ -409,12 +409,17 @@ public class LinuxInstaller extends Installer { log = rpmCommand + "<br><b>Returns: " + returnValue + " Successful uninstallation</b><br>"; LogManager.addCommandsLogfileComment(log); } else { // an error occured during installation - log = rpmCommand + "<br><b>Returns: " + returnValue + " Error during uninstallation</b><br>"; - LogManager.addCommandsLogfileComment(log); - for (int i = 0; i < returnErrorVector.size(); i++) { - LogManager.addCommandsLogfileComment((String)returnErrorVector.get(i)); + if ( packageData.uninstallCanFail() ) { + log = rpmCommand + "<br><b>Returns: " + returnValue + " Problem during uninstallation. Can be ignored.</b><br>"; + LogManager.addCommandsLogfileComment(log); + } else { + log = rpmCommand + "<br><b>Returns: " + returnValue + " Error during uninstallation</b><br>"; + LogManager.addCommandsLogfileComment(log); + for (int i = 0; i < returnErrorVector.size(); i++) { + LogManager.addCommandsLogfileComment((String)returnErrorVector.get(i)); + } + data.setIsErrorInstallation(true); } - data.setIsErrorInstallation(true); } } } @@ -538,7 +543,8 @@ public class LinuxInstaller extends Installer { String onePackage = (String)returnVector.get(i); int pos1 = onePackage.lastIndexOf("-"); int pos2 = onePackage.substring(0, pos1).lastIndexOf("-"); - map.put(onePackage.substring(0, pos2), value); + String key = onePackage.substring(0, pos2); + map.put(key, value); } } @@ -667,6 +673,12 @@ public class LinuxInstaller extends Installer { log = rpmCommand + "<br><b>Returns: " + version + "</b><br>"; LogManager.addCommandsLogfileComment(log); + if ( ! installData.installedProductMinorSet() ) { + int productMinor = helper.getInstalledMinor(version); + installData.setInstalledProductMinor(productMinor); + installData.setInstalledProductMinorSet(true); + } + if (useLocalDatabase) { rpmCommand = "rpm" + " " + databaseString + " " + databasePath + " -q --queryformat %{RELEASE}\\n " + packageName; rpmCommandArray[5] = "%{RELEASE}\\n"; diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Installer/SolarisInstaller.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Installer/SolarisInstaller.java index d696f0f9ac54..2da5006e9022 100755 --- a/javainstaller2/src/JavaSetup/org/openoffice/setup/Installer/SolarisInstaller.java +++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Installer/SolarisInstaller.java @@ -81,8 +81,11 @@ public class SolarisInstaller extends Installer { if ( data.isInstallationMode()) { boolean makeRelocatableAdminFile = true; - helper.createAdminFile(makeRelocatableAdminFile); - helper.createAdminFile(! makeRelocatableAdminFile); + boolean removeDepends = true; + helper.createAdminFile(makeRelocatableAdminFile, removeDepends); + helper.createAdminFile(makeRelocatableAdminFile, ! removeDepends); + helper.createAdminFile(! makeRelocatableAdminFile, removeDepends); + helper.createAdminFile(! makeRelocatableAdminFile, ! removeDepends); } if ( data.isUserInstallation() ) { @@ -259,9 +262,17 @@ public class SolarisInstaller extends Installer { // is package relocatable or not? if ( packageData.isRelocatable() ) { - adminFileName = data.getAdminFileNameReloc(); + if ( packageData.ignoreDependsForUninstall() ) { // Force removal of older packages during installation + adminFileName = data.getAdminFileNameRelocNoDepends(); + } else { + adminFileName = data.getAdminFileNameReloc(); + } } else { - adminFileName = data.getAdminFileNameNoReloc(); + if ( packageData.ignoreDependsForUninstall() ) { // Force removal of older packages during installation + adminFileName = data.getAdminFileNameNoRelocNoDepends(); + } else { + adminFileName = data.getAdminFileNameNoReloc(); + } } String pkgCommand = ""; @@ -300,16 +311,20 @@ public class SolarisInstaller extends Installer { log = pkgCommand + "<br><b>Returns: " + returnValue + " Successful uninstallation</b><br>"; LogManager.addCommandsLogfileComment(log); } else { // an error occured during installation - log = pkgCommand + "<br><b>Returns: " + returnValue + " Error during uninstallation</b><br>"; - LogManager.addCommandsLogfileComment(log); - System.err.println("Error during uninstallation:"); - for (int i = 0; i < returnErrorVector.size(); i++) { - LogManager.addCommandsLogfileComment((String)returnErrorVector.get(i)); - System.err.println(returnErrorVector.get(i)); + if ( packageData.uninstallCanFail() ) { + log = pkgCommand + "<br><b>Returns: " + returnValue + " Problem during uninstallation. Can be ignored.</b><br>"; + LogManager.addCommandsLogfileComment(log); + } else { + log = pkgCommand + "<br><b>Returns: " + returnValue + " Error during uninstallation</b><br>"; + LogManager.addCommandsLogfileComment(log); + System.err.println("Error during uninstallation:"); + for (int i = 0; i < returnErrorVector.size(); i++) { + LogManager.addCommandsLogfileComment((String)returnErrorVector.get(i)); + System.err.println(returnErrorVector.get(i)); + } + data.setIsErrorInstallation(true); } - data.setIsErrorInstallation(true); } - } public boolean isPackageNameInstalledClassic(String packageName, InstallData installData) { @@ -402,7 +417,8 @@ public class SolarisInstaller extends Installer { for (int i = 0; i < returnVector.size(); i++) { String onePackage = (String)returnVector.get(i); int pos1 = onePackage.indexOf(" "); - map.put(onePackage.substring(0, pos1), value); + String key = onePackage.substring(0, pos1); + map.put(key, value); } } @@ -522,6 +538,12 @@ public class SolarisInstaller extends Installer { String installedPackageVersion = helper.getVersionString(returnVector); String newPackageVersion = packageData.getPkgVersion(); + if ( ! installData.installedProductMinorSet() ) { + int productMinor = helper.getInstalledMinor(installedPackageVersion); + installData.setInstalledProductMinor(productMinor); + installData.setInstalledProductMinorSet(true); + } + if (( installedPackageVersion != null ) && ( newPackageVersion != null )) { if ( checkIfInstalledIsOlder ) { firstPackageIsOlder = helper.comparePackageVersions(installedPackageVersion, newPackageVersion); diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/InstallerHelper/LinuxHelper.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/InstallerHelper/LinuxHelper.java index 88280b94fb1f..5ef4252808c1 100755 --- a/javainstaller2/src/JavaSetup/org/openoffice/setup/InstallerHelper/LinuxHelper.java +++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/InstallerHelper/LinuxHelper.java @@ -241,6 +241,23 @@ import java.util.Vector;public class LinuxHelper { return hashRpm; } + public int getInstalledMinor(String version) { + + int minor = 0; + int pos = version.indexOf("."); + if ( pos > -1 ) { + String reduced = version.substring(pos + 1, version.length()); + + pos = reduced.indexOf("."); + if ( pos > -1 ) { + reduced = reduced.substring(0, pos); + minor = Integer.parseInt(reduced); + } + } + + return minor; + } + private boolean compareTwoRpms(HashMap hash1, HashMap hash2) { boolean hash1IsOlder = false; diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/InstallerHelper/SolarisHelper.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/InstallerHelper/SolarisHelper.java index 61dc02ca97f4..7d582f0a03d2 100755 --- a/javainstaller2/src/JavaSetup/org/openoffice/setup/InstallerHelper/SolarisHelper.java +++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/InstallerHelper/SolarisHelper.java @@ -108,7 +108,7 @@ public class SolarisHelper { } } - private Vector getAdminFileContent(boolean relocatable) { + private Vector getAdminFileContent(boolean relocatable, boolean rdepends) { Vector adminFile = new Vector(); InstallData data = InstallData.getInstance(); @@ -151,6 +151,7 @@ public class SolarisHelper { // String rdependLine = "rdepend=nocheck"; String rdependLine = "rdepend=quit"; + if ( ! rdepends ) { rdependLine = "rdepend=nocheck"; } if ( data.isUserInstallation() ) { rdependLine = "rdepend=nocheck"; } adminFile.add(rdependLine); @@ -268,25 +269,41 @@ public class SolarisHelper { return databasePath; } - public void createAdminFile(boolean relocatable) { + public void createAdminFile(boolean relocatable, boolean rdepends) { InstallData data = InstallData.getInstance(); Vector removeFiles = data.getRemoveFiles(); String adminFileName = ""; if ( relocatable ) { - adminFileName = "adminFileReloc"; + if ( rdepends ) { + adminFileName = "adminFileReloc"; + } else { + adminFileName = "adminFileRelocNoDepends"; + } } else { - adminFileName = "adminFileNoReloc"; + if ( rdepends ) { + adminFileName = "adminFileNoReloc"; + } else { + adminFileName = "adminFileNoRelocNoDepends"; + } } - Vector fileContent = getAdminFileContent(relocatable); + Vector fileContent = getAdminFileContent(relocatable, rdepends); File adminFile = new File(data.getInstallDir(), adminFileName); String completeAdminFileName = adminFile.getPath(); if ( relocatable ) { - data.setAdminFileNameReloc(completeAdminFileName); + if ( rdepends ) { + data.setAdminFileNameReloc(completeAdminFileName); + } else { + data.setAdminFileNameRelocNoDepends(completeAdminFileName); + } } else { - data.setAdminFileNameNoReloc(completeAdminFileName); + if ( rdepends ) { + data.setAdminFileNameNoReloc(completeAdminFileName); + } else { + data.setAdminFileNameNoRelocNoDepends(completeAdminFileName); + } } if ( ! adminFile.exists() ) { @@ -331,6 +348,24 @@ public class SolarisHelper { return versionString; } + public int getInstalledMinor(String version) { + + int minor = 0; + + int pos = version.indexOf("."); + if ( pos > -1 ) { + String reduced = version.substring(pos + 1, version.length()); + + pos = reduced.indexOf("."); + if ( pos > -1 ) { + reduced = reduced.substring(0, pos); + minor = Integer.parseInt(reduced); + } + } + + return minor; + } + public boolean comparePackageVersions(String firstPackageVersion, String secondPackageVersion) { // Analyzing strings: version, 2.0.0,REV=106.2005.05.26 diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/SetupData/PackageDescription.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/SetupData/PackageDescription.java index 0c10c960aa0a..69aba3c19a93 100755 --- a/javainstaller2/src/JavaSetup/org/openoffice/setup/SetupData/PackageDescription.java +++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/SetupData/PackageDescription.java @@ -103,9 +103,12 @@ public class PackageDescription implements TreeNode { private boolean isApplicationPackage = false; private boolean isJavaPackage = false; private boolean installCanFail = false; + private boolean uninstallCanFail = false; + private boolean forceIntoUpdate = false; private boolean useForce = false; private boolean isNewInstalled = false; private boolean wasAlreadyInstalled = false; + private boolean ignoreDependsForUninstall = false; /* Saving the default selection state. This is necessary, if the user chooses * the custom installation type, makes changes, and then changes into @@ -118,6 +121,8 @@ public class PackageDescription implements TreeNode { private int customSelectionState = DONT_KNOW; // Saving settings for custom installation private int startSelectionState = DONT_KNOW; // Saving settings at start of installation + public PackageDescription() {} + /** * construct only with package information to wrap */ @@ -143,6 +148,10 @@ public class PackageDescription implements TreeNode { return dpyName; } + public void setName(String name) { + dpyName = name; + } + public String getDescription() { return dpyDescription; } @@ -163,6 +172,10 @@ public class PackageDescription implements TreeNode { return pkgOrder; } + public void setOrder(int order) { + pkgOrder = order; + } + // public int getAccumulatedSize() { // int size = getSize(); // @@ -215,6 +228,18 @@ public class PackageDescription implements TreeNode { return installCanFail; } + public boolean uninstallCanFail() { + return uninstallCanFail; + } + + public void setUninstallCanFail(boolean canFail) { + uninstallCanFail = canFail; + } + + public boolean forceIntoUpdate() { + return forceIntoUpdate; + } + public boolean useForce() { return useForce; } @@ -235,6 +260,14 @@ public class PackageDescription implements TreeNode { return wasAlreadyInstalled; } + public void setIgnoreDependsForUninstall(boolean ignore) { + ignoreDependsForUninstall = ignore; + } + + public boolean ignoreDependsForUninstall() { + return ignoreDependsForUninstall; + } + public boolean isDefault() { return isDefault; } @@ -247,10 +280,19 @@ public class PackageDescription implements TreeNode { return isRelocatable; } + public void setIsRelocatable(boolean relocatable) { + isRelocatable = relocatable; + } + public String getPackageName() { return pkgFileName; } + public void setPackageName(String name) { + pkgFileName = name; + } + + public String getFullPackageName() { return pkgFullName; } @@ -468,6 +510,12 @@ public class PackageDescription implements TreeNode { installCanFail = Parser.parseBoolean(installCanFailValue); } + subSection = section.getElement("forceintoupdate"); + if (subSection != null) { + String forceIntoUpdateValue = subSection.getValue(); + forceIntoUpdate = Parser.parseBoolean(forceIntoUpdateValue); + } + subSection = section.getElement("useforce"); if (subSection != null) { String useForceValue = subSection.getValue(); diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/SetupData/ProductDescription.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/SetupData/ProductDescription.java index 3aba24855f99..f4bc983162a2 100755 --- a/javainstaller2/src/JavaSetup/org/openoffice/setup/SetupData/ProductDescription.java +++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/SetupData/ProductDescription.java @@ -239,7 +239,17 @@ public class ProductDescription { installData.setDontUpdate(dontupdate); } - section = data.getElement("hideeula"); + /* check for the Product Minor of this installation set */ + section = data.getElement("productminor"); + if (section != null) { + String value = section.getValue(); + if (value != null) { + int intValue = Integer.parseInt(value); + installData.setProductMinor(intValue); + } + } + + section = data.getElement("hideeula"); if (section != null) { String value = section.getValue(); if ((value != null) && (! value.equals(""))) { diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/Dumper.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/Dumper.java index d72eb8d65489..da252f6d0a39 100755 --- a/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/Dumper.java +++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/Dumper.java @@ -179,7 +179,9 @@ public class Dumper { InstallData data = InstallData.getInstance(); System.err.println("PackagePath: " + data.getPackagePath()); System.err.println("AdminFileReloc: " + data.getAdminFileNameReloc()); + System.err.println("AdminFileRelocNoDepends: " + data.getAdminFileNameRelocNoDepends()); System.err.println("AdminFileNoReloc: " + data.getAdminFileNameNoReloc()); + System.err.println("AdminFileNoRelocNoDepends: " + data.getAdminFileNameNoRelocNoDepends()); System.err.println("DatabasePath: " + data.getDatabasePath()); System.err.println("InstallDir: " + data.getInstallDir()); System.err.println("Original privileges: " + data.getStoredInstallationPrivileges()); diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/InfoDir.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/InfoDir.java index cc1cc6a641db..55e80d52cd52 100755 --- a/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/InfoDir.java +++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/InfoDir.java @@ -158,6 +158,15 @@ public class InfoDir { sourceFile.delete(); } + if ( data.getAdminFileNameRelocNoDepends() != null ) { + File sourceFile = new File(data.getAdminFileNameRelocNoDepends()); + String fileName = sourceFile.getName(); + File destFile = new File(dir, fileName); + boolean success = SystemManager.copy(sourceFile.getPath(), destFile.getPath()); + data.setAdminFileNameRelocNoDepends(destFile.getPath()); + sourceFile.delete(); + } + if ( data.getAdminFileNameNoReloc() != null ) { File sourceFile = new File(data.getAdminFileNameNoReloc()); String fileName = sourceFile.getName(); @@ -167,6 +176,14 @@ public class InfoDir { sourceFile.delete(); } + if ( data.getAdminFileNameNoRelocNoDepends() != null ) { + File sourceFile = new File(data.getAdminFileNameNoRelocNoDepends()); + String fileName = sourceFile.getName(); + File destFile = new File(dir, fileName); + boolean success = SystemManager.copy(sourceFile.getPath(), destFile.getPath()); + data.setAdminFileNameNoRelocNoDepends(destFile.getPath()); + sourceFile.delete(); + } } static private void createInfoFile(File dir) { @@ -180,8 +197,12 @@ public class InfoDir { fileContent.add(line); line = "AdminFileReloc=" + data.getAdminFileNameReloc(); fileContent.add(line); + line = "AdminFileRelocNoDepends=" + data.getAdminFileNameRelocNoDepends(); + fileContent.add(line); line = "AdminFileNoReloc=" + data.getAdminFileNameNoReloc(); fileContent.add(line); + line = "AdminFileNoRelocNoDepends=" + data.getAdminFileNameNoRelocNoDepends(); + fileContent.add(line); line = "InstallationDir=" + data.getInstallDir(); fileContent.add(line); line = "DatabasePath=" + data.getDatabasePath(); @@ -207,10 +228,18 @@ public class InfoDir { SystemManager.deleteFile(new File(data.getAdminFileNameReloc())); } + if ( ! data.getAdminFileNameRelocNoDepends().equals("null") ) { + SystemManager.deleteFile(new File(data.getAdminFileNameRelocNoDepends())); + } + if ( ! data.getAdminFileNameNoReloc().equals("null") ) { SystemManager.deleteFile(new File(data.getAdminFileNameNoReloc())); } + if ( ! data.getAdminFileNameNoRelocNoDepends().equals("null") ) { + SystemManager.deleteFile(new File(data.getAdminFileNameNoRelocNoDepends())); + } + if ( ! data.getGetUidPath().equals("null") ) { SystemManager.deleteFile(new File(data.getGetUidPath())); } diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/InstallChangeCtrl.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/InstallChangeCtrl.java index 8cd96537e5da..2bd57123a6aa 100755 --- a/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/InstallChangeCtrl.java +++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/InstallChangeCtrl.java @@ -98,6 +98,13 @@ public class InstallChangeCtrl { data.setOlderVersionExists(true); // All installed packages will be updated -> determining which packages are installed System.err.println("An older product is installed"); + // But if this is a kind of Major Upgrade with different Minor and therefore different package names, + // it is necessary to remove the old product. + if ( data.getProductMinor() > data.getInstalledProductMinor() ) + { + data.setMajorUpgrade(true); + System.err.println("Major Upgrade"); + } } else if ( installer.isInstallSetPackageOlder(data.getUpdatePackage(), data) ) { data.setNewerVersionExists(true); System.err.println("A newer product is installed"); diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/ModuleCtrl.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/ModuleCtrl.java index e70fd63b58c8..354b64d78420 100755 --- a/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/ModuleCtrl.java +++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/ModuleCtrl.java @@ -180,10 +180,16 @@ public class ModuleCtrl { // System.err.println("Setting allChildrenHidden for module " + packageData.getName() ); } - // System.err.println("Setting " + packageData.getName() + " to " + packageData.getSelectionState() ); - packageData.setSelectionState(state); + // If older version exist, only modules without packages shall be updated, + // because all packages are already determined by querying the database. + if ( installdata.olderVersionExists() ) { + if ( packageData.getPackageName().equals("") ) { + packageData.setSelectionState(state); + } + } else { + packageData.setSelectionState(state); + } } - } static public void setHiddenModuleSettingsInstall(PackageDescription packageData) { @@ -409,6 +415,18 @@ public class ModuleCtrl { } } + static public void setForcedUpdateProductSettings(PackageDescription packageData) { + + if ( packageData.forceIntoUpdate() ) { + packageData.setSelectionState(PackageDescription.INSTALL); + } + + for (Enumeration e = packageData.children(); e.hasMoreElements(); ) { + PackageDescription child = (PackageDescription) e.nextElement(); + setForcedUpdateProductSettings(child); + } + } + static public void setShowInUserInstallOnlyFlags(PackageDescription packageData) { // This function is not needed during deinstallation, because a @@ -721,6 +739,50 @@ public class ModuleCtrl { } } else { packageData.setSelectionState(PackageDescription.DONT_INSTALL); + // Special handling for Major Upgrade + if ( data.isMajorUpgrade() ) { + String basis = "ooobasis3"; + if ( data.getOSType().equalsIgnoreCase("Linux") ) { basis = basis + "."; } + String search = basis + data.getProductMinor(); + String replacestring = basis + data.getInstalledProductMinor(); + int pos = packageData.getPackageName().indexOf(search); + if ( pos > -1 ) { + // Check if this package is installed with a lower product minor + // Creating new package for removal, very simple PackageDescription + PackageDescription localPackage = new PackageDescription(); + localPackage.setUninstallCanFail(true); + localPackage.setIsRelocatable(packageData.isRelocatable()); + String localName = packageData.getPackageName(); + localName = localName.replace(search, replacestring); + localPackage.setPackageName(localName); + + if ( ( packageData.getPkgRealName() != null ) && ( ! packageData.getPkgRealName().equals("") )) { + localName = packageData.getPkgRealName(); + localName = localName.replace(search, replacestring); + localPackage.setPkgRealName(localName); + } + + if (( packageData.getName() != null ) && ( ! packageData.getName().equals("") )) { + localName = packageData.getName(); + localName = localName.replace(search, replacestring); + localPackage.setName(localName); + } + + // saving also the order, needed for order of uninstallation + localPackage.setOrder(packageData.getOrder()); + + // If the old package is installed, the new package can be installed, too, + // and the old package can be marked for removal (with dependency check). + if ( installer.isPackageInstalled(localPackage, data) ) { + packageData.setSelectionState(PackageDescription.INSTALL); + + // Collecting all installed older packages for uninstallation + Vector oldPackages = data.getOldPackages(); + oldPackages.add(localPackage); + data.setOldPackages(oldPackages); + } + } + } } } @@ -841,6 +903,13 @@ public class ModuleCtrl { Dumper.logModuleStates(packageData, "ChooseDirectory: After setUpdateOlderProductSettings"); } + // Setting packages that are forced into update, because they did not exist in older version. + ModuleCtrl.setForcedUpdateProductSettings(packageData); + + if ( data.logModuleStates() ) { + Dumper.logModuleStates(packageData, "ChooseDirectory: After setForcedUpdateProductSettings"); + } + // Setting required root module packages (that are new in the update product). ModuleCtrl.setRequiredNewCoreModules(packageData, data); @@ -871,6 +940,13 @@ public class ModuleCtrl { } } + // Setting parent module settings. Only required for displaying correct module settings before starting installation. + ModuleCtrl.setParentDefaultModuleSettings(packageData); + + if ( data.logModuleStates() ) { + Dumper.logModuleStates(packageData, "ChooseDirectory: After setParentDefaultModuleSettings"); + } + // Collecting packages to install // This has to be done here, because "ChooseInstallationType" and "ChooseComponents" // are not called. @@ -903,7 +979,7 @@ public class ModuleCtrl { Dumper.logModuleStates(packageData, "ChooseDirectory: After disableNonExistingPackages"); } - // disable packages, that are not valid in user installation + // disable packages, that are not valid in user installation if ( data.isUserInstallation() ) { ModuleCtrl.setShowInUserInstallFlags(packageData); diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/PackageCollector.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/PackageCollector.java index 4c2ad128b57c..efa15c0212ae 100755 --- a/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/PackageCollector.java +++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/PackageCollector.java @@ -30,6 +30,7 @@ package org.openoffice.setup.Util; +import org.openoffice.setup.InstallData; import org.openoffice.setup.SetupData.PackageDescription; import java.util.Enumeration; import java.util.Vector; @@ -82,6 +83,62 @@ public class PackageCollector { } } + // Special handling for packages, that change their name, and therefore need to be uninstalled + + // static public void findOldPackages( InstallData installData ) { + // + // String basis = "ooobasis3"; + // if ( installData.getOSType().equalsIgnoreCase("Linux") ) { basis = basis + "."; } + // String search = basis + installData.getProductMinor(); + + // Vector allPackages = installData.getInstallPackages(); + // Vector oldPackages = new Vector(); + + // for (int i = 0; i < allPackages.size(); i++) { + // PackageDescription packageData = (PackageDescription) allPackages.get(i); + // int pos = packageData.getPackageName().indexOf(search); + + // if ( pos > -1 ) { + // String substring = packageData.getPackageName().substring(pos, pos + 1); + // for (int j = 0; j < installData.getProductMinor(); j++) { + // String replace = basis + j; + // // Creating new package for removal, very simple PackageDescription + // PackageDescription localPackage = new PackageDescription(); + // localPackage.setUninstallCanFail(true); + // localPackage.setIsRelocatable(packageData.isRelocatable()); + // String localName = packageData.getPackageName(); + // localName = localName.replace(search, replace); + // localPackage.setPackageName(localName); + + // if ( ( packageData.getPkgRealName() != null ) && ( ! packageData.getPkgRealName().equals("") )) { + // localName = packageData.getPkgRealName(); + // localName = localName.replace(search, replace); + // localPackage.setPkgRealName(localName); + // } + + // if (( packageData.getName() != null ) && ( ! packageData.getName().equals("") )) { + // localName = packageData.getName(); + // localName = localName.replace(search, replace); + // localPackage.setName(localName); + // } + + // oldPackages.add(localPackage); + // } + // } + // } + + // // reverse order for uninstallation + // int number = oldPackages.size(); + // for (int i = 0; i < number; i++) { + // if ( i > 0 ) { + // PackageDescription oldPackageData = (PackageDescription) oldPackages.remove(i); + // oldPackages.add(0,oldPackageData); + // } + // } + + // installData.setOldPackages(oldPackages); + // } + static public void sortPackages(Vector allPackages, Vector sortedPackages, String mode) { for (int i = 0; i < allPackages.size(); i++) { boolean integrated = false; |