1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
|
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
package org.openoffice.setup.Installer;
import java.io.File;
import org.openoffice.setup.InstallData;
import org.openoffice.setup.InstallerHelper.LinuxHelper;
import org.openoffice.setup.ResourceManager;
import org.openoffice.setup.SetupData.PackageDescription;
import org.openoffice.setup.SetupData.ProductDescription;
import org.openoffice.setup.SetupData.SetupDataProvider;
import org.openoffice.setup.Util.ExecuteProcess;
import org.openoffice.setup.Util.Informer;
import org.openoffice.setup.Util.LogManager;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Vector;
public class LinuxInstaller extends Installer {
LinuxHelper helper = new LinuxHelper();
public LinuxInstaller() {
super();
}
public void preInstall(PackageDescription packageData) {
InstallData installData = InstallData.getInstance();
// Collecting package names
helper.getLinuxPackageNamesFromRpmquery(packageData, installData);
helper.getLinuxFileInfo(packageData);
// Dumper.dumpAllRpmInfo(packageData);
}
public void postInstall(PackageDescription packageData) {
InstallData data = InstallData.getInstance();
if ( ! data.isAbortedInstallation() ) {
data.setStillRunning(true);
// Collecting information about installed packages
// Creating a list containing pairs of package names and rpm file names
// that has to be used during uninstallation.
helper.createPackageNameFileAtPostinstall(data, packageData);
helper.saveModulesLogFile(data);
data.setStillRunning(false);
}
}
public void preUninstall(PackageDescription packageData) {
// Collecting information about installed packages
HashMap packageNames = helper.readPackageNamesFile();
helper.setFullPackageNameAtUninstall(packageData, packageNames);
helper.getLinuxFileInfo(packageData);
// Dumper.dumpAllRpmInfo(packageData);
}
public void defineDatabasePath() {
InstallData data = InstallData.getInstance();
String oldDatabasePath = data.getDatabasePath();
data.setDatabasePath(null);
// Determining the database path (only for user installation).
// Important if a user installation is done into an existing
// user installation -> this methode can only be called after
// determination of installation directory.
if ( data.isUserInstallation() ) {
String databasePath = helper.getLinuxDatabasePath(data); // the file does not need to exist!
data.setDatabasePath(databasePath);
// If this is a new path to the database, then this database was
// not analyzed before (when going back in installation wizard)
if ( ! databasePath.equals(oldDatabasePath) ) {
data.setDatabaseAnalyzed(false);
data.setDatabaseQueried(false);
}
}
}
public String getChangeInstallDir(PackageDescription packageData) {
String installDir = null;
InstallData installData = InstallData.getInstance();
String packageName = packageData.getPkgRealName();
if ( packageName != null ) {
String rpmCommand = "rpm -q --queryformat %{INSTALLPREFIX} " + packageName;
String[] rpmCommandArray = new String[5];
rpmCommandArray[0] = "rpm";
rpmCommandArray[1] = "-q";
rpmCommandArray[2] = "--queryformat";
rpmCommandArray[3] = "%{INSTALLPREFIX}";
rpmCommandArray[4] = packageName;
Vector returnVector = new Vector();
Vector returnErrorVector = new Vector();
int returnValue = ExecuteProcess.executeProcessReturnVector(rpmCommandArray, returnVector, returnErrorVector);
String returnString = (String) returnVector.get(0);
returnString = returnString.replaceAll("//","/");
String log = rpmCommand + "<br><b>Returns: " + returnString + "</b><br>";
LogManager.addCommandsLogfileComment(log);
installDir = returnString;
}
return installDir;
}
public void installPackage(PackageDescription packageData) {
// get ProductDescription for logging mechanism
ProductDescription productData = SetupDataProvider.getProductDescription();
InstallData data = InstallData.getInstance();
// String log = "<br><b>Package: " + packageData.getName() + "</b>";
// LogManager.addCommandsLogfileComment(log);
String log = "";
// setting installDir
String installDir = data.getInstallDir();
String packagePath = data.getPackagePath();
if (( packageData.getPkgSubdir() != null ) && ( ! packageData.getPkgSubdir().equals("") )) {
File completePackageFile = new File(packagePath, packageData.getPkgSubdir());
packagePath = completePackageFile.getPath();
}
String packageName = packageData.getPackageName();
if (( packageName.equals("")) || ( packageName == null )) {
log = "<b>No package name specified. Nothing to do</b>";
LogManager.addCommandsLogfileComment(log);
} else {
log = "<b>Package Name: " + packageName + "</b>";
LogManager.addCommandsLogfileComment(log);
File completePackage = new File(packagePath, packageName);
packageName = completePackage.getPath();
packageName = "\"" + packageName + "\""; // Quoting is necessary, if the path the the packages contains white spaces.
if ( completePackage.exists() ) {
String relocations = helper.getRelocationString(packageData, packageName);
if ( relocations != null ) {
// Problem: If Prefix = "/" the packages are not relocatable with RPM version 3.x .
// Therefore Prefix has to be "/opt" in spec file, although packages shall not be
// relocatable (except for installations with root privileges). So /opt has to be
// listed left and right of equal sign: --relocate /opt=<installDir>/opt
// -> /opt has to be added to the installDir
File localInstallDir = new File(installDir, relocations); // "/" -> "/opt"
String localInstallDirString = localInstallDir.getPath();
// Fixing problem with installation directory and RPM version 3.x
String fixedInstallDir = helper.fixInstallationDirectory(localInstallDirString);
relocations = relocations + "=" + fixedInstallDir;
// relocations: "/opt/staroffice8=" + fixedInstallDir;
}
// Some packages have to be installed with parameter "--force", if the link "/usr/bin/soffice"
// already exists. These pacakges return true with methode "useForce()".
boolean useForce = false;
if ( packageData.useForce() ) {
File sofficeLink = new File("/usr/bin/soffice");
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() ) {
nodepsString = "--nodeps";
if ( data.useForceDebian() ) {
forceDebianString = "--force-debian";
}
}
String databasePath = null;
String databaseString = "";
boolean useLocalDatabase = false;
if ( data.isUserInstallation() ) {
databasePath = data.getDatabasePath();
if ( databasePath == null ) {
databasePath = helper.getLinuxDatabasePath(data);
data.setDatabasePath(databasePath);
}
}
if (( databasePath != null ) && (! databasePath.equalsIgnoreCase("null"))) {
databaseString = "--dbpath";
useLocalDatabase = true;
}
// Defining a Vector that contains the full rpm command. Then the string array can be
// created dynamically.
Vector rpmVector = new Vector();
rpmVector.add("rpm");
rpmVector.add("--upgrade");
rpmVector.add("--ignoresize");
if ( useForce ) {
rpmVector.add("--force");
}
if ( ! forceDebianString.equals("") ) {
rpmVector.add(forceDebianString);
}
if ( ! nodepsString.equals("") ) {
rpmVector.add(nodepsString);
}
rpmVector.add("-vh");
if ( relocations != null ) {
rpmVector.add("--relocate");
rpmVector.add(relocations);
}
if ( useLocalDatabase ) {
rpmVector.add(databaseString);
rpmVector.add(databasePath);
}
rpmVector.add(packageName);
// Creating String and StringArray for rpm command
int capacity = rpmVector.size();
String rpmCommand = "";
String[] rpmCommandArray = new String[capacity];
for (int i = 0; i < rpmVector.size(); i++) {
rpmCommandArray[i] = (String)rpmVector.get(i);
rpmCommand = rpmCommand + " " + (String)rpmVector.get(i);
}
rpmCommand = rpmCommand.trim();
// Staring rpm process
Vector returnVector = new Vector();
Vector returnErrorVector = new Vector();
// int returnValue = SystemManager.executeProcessReturnVector(rpmCommand, returnVector, returnErrorVector);
int returnValue = ExecuteProcess.executeProcessReturnVector(rpmCommandArray, returnVector, returnErrorVector);
if ( returnValue == 0 ) {
log = rpmCommand + "<br><b>Returns: " + returnValue + " Successful installation</b><br>";
LogManager.addCommandsLogfileComment(log);
} else { // an error occured during installation
if ( packageData.installCanFail() ) {
log = rpmCommand + "<br><b>Returns: " + returnValue + " Problem during installation. Can be ignored.</b><br>";
LogManager.addCommandsLogfileComment(log);
} else {
log = rpmCommand + "<br><b>Returns: " + returnValue + " Error during installation</b><br>";
LogManager.addCommandsLogfileComment(log);
for (int i = 0; i < returnErrorVector.size(); i++) {
LogManager.addCommandsLogfileComment((String)returnErrorVector.get(i));
}
data.setIsErrorInstallation(true);
}
}
// saving installation state at package
packageData.setIsNewInstalled(true);
} else {
log = "<b>Error: Did not find package " + packageName + "</b><br>";
System.err.println(log);
String message = ResourceManager.getString("String_File_Not_Found") + ": " + packageName;
String title = ResourceManager.getString("String_Error");
Informer.showErrorMessage(message, title);
LogManager.addCommandsLogfileComment(log);
data.setIsErrorInstallation(true);
}
}
}
public void uninstallPackage(PackageDescription packageData) {
// get ProductDescription for logging mechanism
ProductDescription productData = SetupDataProvider.getProductDescription();
InstallData data = InstallData.getInstance();
String log = "";
// String log = "<br><b>Package: " + packageData.getName() + "</b>";
// LogManager.addCommandsLogfileComment(log);
String rpmPackageName = packageData.getPackageName();
if (( rpmPackageName.equals("")) || ( rpmPackageName == null )) {
log = "<b>No package name specified. Nothing to do</b>";
LogManager.addCommandsLogfileComment(log);
} else {
log = "<b>Package Name: " + rpmPackageName + "</b>";
LogManager.addCommandsLogfileComment(log);
String packageName = packageData.getPkgRealName();
String databasePath = data.getDatabasePath();
String databaseString = "";
boolean useLocalDatabase = false;
if (( databasePath != null ) && (! databasePath.equalsIgnoreCase("null"))) {
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() ) {
nodepsString = "--nodeps";
if ( data.useForceDebian() ) {
forceDebianString = "--force-debian";
}
}
// Defining a Vector that contains the full rpm command. Then the string array can be
// created dynamically.
Vector rpmVector = new Vector();
rpmVector.add("rpm");
if ( ! forceDebianString.equals("") ) {
rpmVector.add(forceDebianString);
}
if ( ! nodepsString.equals("") ) {
rpmVector.add(nodepsString);
}
rpmVector.add("-ev");
if ( useLocalDatabase ) {
rpmVector.add(databaseString);
rpmVector.add(databasePath);
}
rpmVector.add(packageName);
// Creating String and StringArray for rpm command
int capacity = rpmVector.size();
String rpmCommand = "";
String[] rpmCommandArray = new String[capacity];
for (int i = 0; i < rpmVector.size(); i++) {
rpmCommandArray[i] = (String)rpmVector.get(i);
rpmCommand = rpmCommand + " " + (String)rpmVector.get(i);
}
rpmCommand = rpmCommand.trim();
// Starting rpm process
Vector returnVector = new Vector();
Vector returnErrorVector = new Vector();
int returnValue = ExecuteProcess.executeProcessReturnVector(rpmCommandArray, returnVector, returnErrorVector);
if ( returnValue == 0 ) {
log = rpmCommand + "<br><b>Returns: " + returnValue + " Successful uninstallation</b><br>";
LogManager.addCommandsLogfileComment(log);
} else { // an error occured during installation
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);
}
}
}
}
public boolean isPackageInstalledClassic(PackageDescription packageData, InstallData installData) {
boolean isInstalled = false;
boolean doCheck = false;
// only checking existing packages (and always at uninstallation)
if ( (packageData.pkgExists()) || (installData.isUninstallationMode()) ) {
doCheck = true;
}
String rpmPackageName = packageData.getPackageName();
if ( rpmPackageName.equals("") ) {
rpmPackageName = null;
}
if (( rpmPackageName != null ) && ( doCheck )) {
String databaseString = "";
String databasePath = null;
String packageName = packageData.getPkgRealName();
Vector allPackages = null;
boolean useLocalDatabase = false;
if (installData.isUserInstallation()) {
databasePath = installData.getDatabasePath();
}
if (( databasePath != null ) && (! databasePath.equals("null"))) {
databaseString = "--dbpath";
useLocalDatabase = true;
}
if (packageName != null) {
String rpmCommand;
String[] rpmCommandArray;
if (useLocalDatabase) {
rpmCommand = "rpm" + " " + databaseString + " " + databasePath + " --query " + packageName;
rpmCommandArray = new String[5];
rpmCommandArray[0] = "rpm";
rpmCommandArray[1] = databaseString;
rpmCommandArray[2] = databasePath;
rpmCommandArray[3] = "--query";
rpmCommandArray[4] = packageName;
} else {
rpmCommand = "rpm" + " --query " + packageName;
rpmCommandArray = new String[3];
rpmCommandArray[0] = "rpm";
rpmCommandArray[1] = "--query";
rpmCommandArray[2] = packageName;
}
int returnValue = ExecuteProcess.executeProcessReturnValue(rpmCommandArray);
if ( returnValue == 0 ) {
isInstalled = true;
packageData.setWasAlreadyInstalled(true); // needed for logging
String log = rpmCommand + "<br><b>Returns: " + returnValue + " Package is installed" + "</b><br>";
LogManager.addCommandsLogfileComment(log);
} else {
String log = rpmCommand + "<br><b>Returns: " + returnValue + " Package is not installed" + "</b><br>";
LogManager.addCommandsLogfileComment(log);
}
}
}
return isInstalled;
}
private void queryAllDatabase(InstallData installData) {
String databaseString = "";
String databasePath = null;
HashMap map = new HashMap();;
boolean useLocalDatabase = false;
if (installData.isUserInstallation()) {
databasePath = installData.getDatabasePath();
}
if (( databasePath != null ) && (! databasePath.equals("null"))) {
databaseString = "--dbpath";
useLocalDatabase = true;
}
String rpmCommand;
String[] rpmCommandArray;
if (useLocalDatabase) {
rpmCommand = "rpm" + " " + databaseString + " " + databasePath + " --query" + " -a";
rpmCommandArray = new String[5];
rpmCommandArray[0] = "rpm";
rpmCommandArray[1] = databaseString;
rpmCommandArray[2] = databasePath;
rpmCommandArray[3] = "--query";
rpmCommandArray[4] = "-a";
} else {
rpmCommand = "rpm" + " --query" + " -a";
rpmCommandArray = new String[3];
rpmCommandArray[0] = "rpm";
rpmCommandArray[1] = "--query";
rpmCommandArray[2] = "-a";
}
Vector returnVector = new Vector();
Vector returnErrorVector = new Vector();
int returnValue = ExecuteProcess.executeProcessReturnVector(rpmCommandArray, returnVector, returnErrorVector);
String log = rpmCommand + "<br><b>Returns: " + returnValue + "</b><br>";
LogManager.addCommandsLogfileComment(log);
String value = "1";
if ( ! returnVector.isEmpty()) {
for (int i = 0; i < returnVector.size(); i++) {
String onePackage = (String)returnVector.get(i);
int pos1 = onePackage.lastIndexOf("-");
int pos2 = onePackage.substring(0, pos1).lastIndexOf("-");
String key = onePackage.substring(0, pos2);
map.put(key, value);
}
}
installData.setDatabaseQueried(true);
installData.setDatabaseMap(map);
}
public boolean isPackageInstalled(PackageDescription packageData, InstallData installData) {
boolean isInstalled = false;
boolean doCheck = false;
// only checking existing packages (and always at uninstallation)
if ( (packageData.pkgExists()) || (installData.isUninstallationMode()) ) {
doCheck = true;
}
String rpmPackageName = packageData.getPackageName();
if ( rpmPackageName.equals("") ) {
rpmPackageName = null;
}
if (( rpmPackageName != null ) && ( doCheck )) {
String packageName = packageData.getPkgRealName();
if (packageName != null) {
HashMap map = null;
if ( ! installData.databaseQueried() ) {
queryAllDatabase(installData);
}
map = installData.getDatabaseMap();
if ( map.containsKey(packageName)) {
isInstalled = true;
}
} else {
System.err.println("Error: No packageName defined for package: " + packageData.getPackageName());
}
}
return isInstalled;
}
public boolean isInstallSetPackageOlder(PackageDescription packageData, InstallData installData) {
boolean installSetPackageIsOlder = false;
boolean checkIfInstalledIsOlder = false;
installSetPackageIsOlder = findOlderPackage(packageData, installData, checkIfInstalledIsOlder);
return installSetPackageIsOlder;
}
public boolean isInstalledPackageOlder(PackageDescription packageData, InstallData installData) {
boolean installedPackageIsOlder = false;
boolean checkIfInstalledIsOlder = true;
installedPackageIsOlder = findOlderPackage(packageData, installData, checkIfInstalledIsOlder);
return installedPackageIsOlder;
}
private boolean findOlderPackage(PackageDescription packageData, InstallData installData, boolean checkIfInstalledIsOlder) {
// The information about the new package is stored in packageData (the version and the release).
// This information can be stored in xpd files. If it is not stored in xpd files, it is determined
// during installation process by querying the rpm file. This process costs much time and should
// therefore be done by the process, that creates the xpd files. On the other hand this requires,
// that the xpd files contain the correct information.
boolean isOlder = false;
// get the version of the installed package
String rpmPackageName = packageData.getPackageName();
String log;
if ( rpmPackageName.equals("")) {
rpmPackageName = null;
}
if ( rpmPackageName != null ) {
String databaseString = "";
String databasePath = null;
String packageName = packageData.getPkgRealName();
Vector allPackages = null;
boolean useLocalDatabase = false;
if (installData.isUserInstallation()) {
databasePath = installData.getDatabasePath();
}
if (( databasePath != null ) && (! databasePath.equals("null"))) {
databaseString = "--dbpath";
useLocalDatabase = true;
}
if (packageName != null) {
// Collect information about the installed package by querying the database.
// Instead of rpm file name, the real package name has to be used.
String rpmCommand;
String[] rpmCommandArray;
if (useLocalDatabase) {
rpmCommand = "rpm" + " " + databaseString + " " + databasePath + " -q --queryformat %{VERSION}\\n " + packageName;
rpmCommandArray = new String[7];
rpmCommandArray[0] = "rpm";
rpmCommandArray[1] = databaseString;
rpmCommandArray[2] = databasePath;
rpmCommandArray[3] = "-q";
rpmCommandArray[4] = "--queryformat";
rpmCommandArray[5] = "%{VERSION}\\n";
rpmCommandArray[6] = packageName;
} else {
rpmCommand = "rpm" + " -q --queryformat %{VERSION}\\n " + packageName;
rpmCommandArray = new String[5];
rpmCommandArray[0] = "rpm";
rpmCommandArray[1] = "-q";
rpmCommandArray[2] = "--queryformat";
rpmCommandArray[3] = "%{VERSION}\\n";
rpmCommandArray[4] = packageName;
}
Vector versionVector = new Vector();
Vector returnErrorVector = new Vector();
int returnValue = ExecuteProcess.executeProcessReturnVector(rpmCommandArray, versionVector, returnErrorVector);
String version = (String) versionVector.lastElement();
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";
} else {
rpmCommand = "rpm" + " -q --queryformat %{RELEASE}\\n " + packageName;
rpmCommandArray[3] = "%{RELEASE}\\n";
}
Vector releaseVector = new Vector();
returnValue = ExecuteProcess.executeProcessReturnVector(rpmCommandArray, releaseVector, returnErrorVector);
String release = (String) releaseVector.lastElement();
log = rpmCommand + "<br><b>Returns: " + release + "</b><br>";
LogManager.addCommandsLogfileComment(log);
isOlder = helper.compareVersionAndRelease(version, release, packageData, checkIfInstalledIsOlder);
if ( checkIfInstalledIsOlder ) {
if ( isOlder ) {
LogManager.addCommandsLogfileComment("<b>-> Installed package is older</b><br>");
} else {
LogManager.addCommandsLogfileComment("<b>-> Installed package is not older</b><br>");
}
} else {
if ( isOlder ) {
LogManager.addCommandsLogfileComment("<b>-> Package in installation set is older</b><br>");
} else {
LogManager.addCommandsLogfileComment("<b>-> Package in installation set is not older</b><br>");
}
}
} else {
System.err.println("Error: No packageName defined for package: " + rpmPackageName);
}
}
return isOlder;
}
}
|