private Vector installedPackages = new Vector();
public void run() {
boolean ignoreMajorUpgrade = false;
LogManager.setCommandsHeaderLine("Installation");
Installer installer = InstallerFactory.getInstance();
String titleText = ResourceManager.getString("String_InstallationOngoing1");
panel.setTitle(titleText);
for (int i = 0; i < installPackages.size(); i++) {
PackageDescription packageData = (PackageDescription) installPackages.get(i);
int progress = java.lang.Math.round((100*(i+1))/installPackages.size());
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.isAbortedInstallation() ) || ( installData.isErrorInstallation() )) {
ignoreMajorUpgrade = true;
break;
}
}
if (( installData.isMajorUpgrade() ) && ( ! ignoreMajorUpgrade )) {
for (int i = 0; i < removePackages.size(); i++) {
PackageDescription packageData = (PackageDescription) removePackages.get(i);
installer.uninstallPackage(packageData);
}
}
if (( installData.isAbortedInstallation() ) || ( installData.isErrorInstallation() )) {
// undoing the installation
if ( installData.isAbortedInstallation() ) {
LogManager.setCommandsHeaderLine("Installation aborted!");
titleText = ResourceManager.getString("String_UninstallationOngoing1");
} else {
LogManager.setCommandsHeaderLine("Error during installation!");
titleText = ResourceManager.getString("String_UninstallationOngoing1");
}
panel.setTitle(titleText);
panel.setStopButtonEnabled(false);
LogManager.setCommandsHeaderLine("Uninstallation");
// Inverting the package order for uninstallation
Collections.reverse(installedPackages);
for (int i = 0; i < installedPackages.size(); i++) {
PackageDescription packageData = (PackageDescription) installedPackages.get(i);
int progress = java.lang.Math.round(100/installedPackages.size()) * (i+1);
panel.setProgressValue(progress);
panel.setProgressText(packageData.getPackageName());
if ( i == 0 ) {
installData.setIsFirstPackage(true);
} else {
installData.setIsFirstPackage(false);
}
installer.uninstallPackage(packageData);
}
// removing already created helper files (admin files)
Vector removeFiles = installData.getRemoveFiles();
for (int i = 0; i < removeFiles.size(); i++) {
File removeFile = new File((String)removeFiles.get(i));
SystemManager.deleteFile(removeFile);
}
}
installer.postInstallationOngoing();
String next = getNext();
getSetupFrame().setCurrentPanel(next, false, true);
}
};