Commits

Anonymous committed 86f481f

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

Comments (0)

Files changed (17)

javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/InstallationOngoingCtrl.java

         Vector sortedPackages = new Vector();
         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();
             InstallData installData = InstallData.getInstance();
             InstallationOngoing panel = (InstallationOngoing)getPanel();
             Vector installPackages = installData.getInstallPackages();
+            Vector removePackages = installData.getOldPackages();
             private Vector installedPackages = new Vector();
 
             public void run() {
                     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);
                     
                     }                    
                 }
 
+                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!");

javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/UninstallationPrologueCtrl.java

         // 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"));        

javainstaller2/src/JavaSetup/org/openoffice/setup/InstallData.java

     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;
     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;
     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;
     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()
         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;
     }
         adminFileNameReloc = fileName;
     }
 
+    public String getAdminFileNameRelocNoDepends() {
+        return adminFileNameRelocNoDepends;
+    }
+
+    public void setAdminFileNameRelocNoDepends(String fileName) {
+        adminFileNameRelocNoDepends = fileName;
+    }
+
     public String getAdminFileNameNoReloc() {
         return adminFileNameNoReloc;
     }
     public void setAdminFileNameNoReloc(String fileName) {
         adminFileNameNoReloc = fileName;
     }
+
+    public String getAdminFileNameNoRelocNoDepends() {
+        return adminFileNameNoRelocNoDepends;
+    }
+
+    public void setAdminFileNameNoRelocNoDepends(String fileName) {
+        adminFileNameNoRelocNoDepends = fileName;
+    }
     
     public String getGetUidPath() {
         return getUidPath;
         olderVersionExists = exists;
     }
 
+    public boolean isMajorUpgrade() {
+    	return majorUpgrade;
+    }
+
+    public void setMajorUpgrade(boolean upgrade) {
+        majorUpgrade = upgrade;
+    }
+
     public boolean sameVersionExists() {
     	return sameVersionExists;
     }
         hideEula = value;
     }
 
+    public boolean installedProductMinorSet() {
+    	return installedProductMinorSet;
+    }
+
+    public void setInstalledProductMinorSet(boolean value) {
+        installedProductMinorSet = value;
+    }
+
     public boolean databaseQueried() {
     	return databaseQueried;
     }
         installPackages = packages;
     }
 
+    public Vector getOldPackages() {
+        return oldPackages;
+    }
+    
+    public void setOldPackages(Vector packages) {
+        oldPackages = packages;
+    }
+
     public Vector getSystemLanguages() {
         return systemLanguages;
     }

javainstaller2/src/JavaSetup/org/openoffice/setup/Installer/LinuxInstaller.java

                 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);
             }
         }
     }
                 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);
             }
         }
 
                 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";

javainstaller2/src/JavaSetup/org/openoffice/setup/Installer/SolarisInstaller.java

         
         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() ) {
 
         // 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 = "";
             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) {
             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);
             }
         }
 
 
             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 ) {

javainstaller2/src/JavaSetup/org/openoffice/setup/InstallerHelper/LinuxHelper.java

 
         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;

javainstaller2/src/JavaSetup/org/openoffice/setup/InstallerHelper/SolarisHelper.java

         }
     }
     
-    private Vector getAdminFileContent(boolean relocatable) {
+    private Vector getAdminFileContent(boolean relocatable, boolean rdepends) {
 
         Vector adminFile = new Vector();
         InstallData data = InstallData.getInstance();
 
         // String rdependLine = "rdepend=nocheck";
         String rdependLine = "rdepend=quit";
+        if ( ! rdepends ) { rdependLine = "rdepend=nocheck"; }
         if ( data.isUserInstallation() ) { rdependLine = "rdepend=nocheck"; }        
         adminFile.add(rdependLine);
 
         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() ) {
         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
 

javainstaller2/src/JavaSetup/org/openoffice/setup/SetupData/PackageDescription.java

     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 
     private int     typicalSelectionState = DONT_KNOW;  // Saving settings for typical installation
     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 
     public String getName() {
         return dpyName;
     }
+
+    public void setName(String name) {
+        dpyName = name;
+    }
     
     public String getDescription() {
         return dpyDescription;
         return pkgOrder;
     }
 
+    public void setOrder(int order) {
+        pkgOrder = order;
+    }
+
     // public int getAccumulatedSize() {
     //     int size = getSize();
     //
         return installCanFail;
     }
 
+    public boolean uninstallCanFail() {
+        return uninstallCanFail;
+    }
+
+    public void setUninstallCanFail(boolean canFail) {
+        uninstallCanFail = canFail;
+    }
+
+    public boolean forceIntoUpdate() {
+        return forceIntoUpdate;
+    }
+
     public boolean useForce() {
         return useForce;
     }
         return wasAlreadyInstalled;
     }
 
+    public void setIgnoreDependsForUninstall(boolean ignore) {
+        ignoreDependsForUninstall = ignore;
+    }
+
+    public boolean ignoreDependsForUninstall() {
+        return ignoreDependsForUninstall;
+    }
+
     public boolean isDefault() {
         return isDefault;
     }
     public boolean isRelocatable() {
         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;
     }
                 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();

javainstaller2/src/JavaSetup/org/openoffice/setup/SetupData/ProductDescription.java

                 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(""))) {

javainstaller2/src/JavaSetup/org/openoffice/setup/Util/Dumper.java

         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());        

javainstaller2/src/JavaSetup/org/openoffice/setup/Util/InfoDir.java

             data.setAdminFileNameReloc(destFile.getPath());
             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());
             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) {
         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();
             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()));            
         }

javainstaller2/src/JavaSetup/org/openoffice/setup/Util/InstallChangeCtrl.java

                     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");

javainstaller2/src/JavaSetup/org/openoffice/setup/Util/ModuleCtrl.java

                 // 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) {
         }
     }
 
+    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
                     }
                 }
             } else {
-                packageData.setSelectionState(PackageDescription.DONT_INSTALL);                  
+                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);
+                        }                    
+                    }
+                }
             }
         }
                     
                 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);
 
                     Dumper.logModuleStates(packageData, "ChooseDirectory: After setShowInUserInstallOnlyFlags");
                 }            	
             }
+
+            // 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"
                 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);
  

javainstaller2/src/JavaSetup/org/openoffice/setup/Util/PackageCollector.java

 
 package org.openoffice.setup.Util;
 
+import org.openoffice.setup.InstallData;
 import org.openoffice.setup.SetupData.PackageDescription;
 import java.util.Enumeration;
 import java.util.Vector;
         }   
     }
 
+    // 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;

scp2/source/ooo/module_hidden_ooo.scp

 	Name = "gid_Module_Root_Userland";
 	Description = "gid_Module_Root_Userland";
 	Subdir = "userland";
-    Styles = (HIDDEN_ROOT,USERLANDMODULE,USERINSTALLONLY,NOTRELOCATABLE,XPD_ONLY);
+    Styles = (HIDDEN_ROOT,USERLANDMODULE,USERINSTALLONLY,NOTRELOCATABLE,XPD_ONLY,INSTALLCANFAIL);
     PackageName = "${USERLANDPACKAGENAME}";
 End
 #endif

scp2/source/writer/module_writer.scp

     Default = YES;
     InstallOrder = "1980";
     PackageInfo = "packinfo_office.txt";
+    Styles = (FORCEINTOUPDATE);
     Files = (gid_File_Oxt_Writer2latex);
 End
 

solenv/bin/modules/installer/xpdinstaller.pm

 }
 
 ###################################################
+# Asking module, if installation can fail 
+# scp style: INSTALLCANFAIL
+###################################################
+
+sub get_forceintoupdate_value
+{
+	my ( $module ) = @_;
+
+	my $value = "false";
+
+	my $styles = "";
+	if ( $module->{'Styles'} ) { $styles = $module->{'Styles'}; } 
+	if ( $styles =~ /\bFORCEINTOUPDATE\b/ ) { $value = "true"; }
+	
+	return $value;
+}
+
+###################################################
 # Substituting all occurences of "\uUXYZ" by 
 # "&#xUXYZ;", because the use xml saxparser does
 # not know anything about this encoding. Therfore
 }
 
 ###################################################
+# Setting the minor of the product version
+# Required to check for Major Upgrades. 
+###################################################
+
+sub set_minor_tag
+{
+	my ($allvariables, $indent) = @_;
+
+	my $productminor = 0;
+	if ( $allvariables->{"PACKAGEVERSION"} )
+	{
+		if ( $allvariables->{"PACKAGEVERSION"} =~ /^\s*\d+\.(\d+)/ ) { $productminor = $1; }
+	}
+	my $tag = $indent . "<productminor>" . $productminor . "</productminor>" . "\n"; 
+
+	return $tag;
+}
+
+###################################################
 # Setting the update behaviour 
 ###################################################
 
 	$tag = set_productdir_tag($allvariables, $singleindent);
 	push(@xpdfile, $tag);
 
+	$tag = set_minor_tag($allvariables, $singleindent);
+	push(@xpdfile, $tag);
+
 	$tag = set_update_tag($allvariables, $singleindent);
 	push(@xpdfile, $tag);
 
 	$line = get_tag_line($doubleindent, "installcanfail", $value);
 	push(@xpdfile, $line);
 
+	$value = get_forceintoupdate_value($module);
+	$line = get_tag_line($doubleindent, "forceintoupdate", $value);
+	push(@xpdfile, $line);
+
 	$value = get_useforce_value($module);
 	$line = get_tag_line($doubleindent, "useforce", $value);
 	push(@xpdfile, $line);