|
1 /* |
|
2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #pragma warning (disable: 4786) |
|
20 |
|
21 #include <iostream> |
|
22 #include <memory> |
|
23 |
|
24 #include "interpretsis.h" |
|
25 #include "uninstaller.h" |
|
26 #include "parameterlist.h" |
|
27 |
|
28 CInterpretSIS::CInterpretSIS(TParamPtr aParamList): |
|
29 iParamList(aParamList) |
|
30 { |
|
31 ConstructL(); |
|
32 } |
|
33 |
|
34 CInterpretSIS::~CInterpretSIS() |
|
35 { |
|
36 delete iInstaller; |
|
37 delete iSisRegistry; |
|
38 delete iConfigManager; |
|
39 } |
|
40 |
|
41 void CInterpretSIS::ConstructL() |
|
42 { |
|
43 iParamList->ValidateParam(); |
|
44 iRomManager = TRomManagerPtr(RomManager::New(*iParamList)); |
|
45 iConfigManager = new ConfigManager(*iParamList); |
|
46 iSisRegistry = new SisRegistry( *iParamList, *iRomManager, *iConfigManager); |
|
47 |
|
48 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
|
49 // Validate the mutual exclusion of reg file version and origin verification status specification. |
|
50 // This is done here because reg file can be specified via the file (z:\system\data\sisregistry_*.*.txt) |
|
51 // during SisRegistry object creation. |
|
52 if (iParamList->RegistryVersionExists() && !(iParamList->OriginVerificationStatus())) |
|
53 { |
|
54 // Both reg file version(either via -k or via file) and -f options are mutually exclusive |
|
55 throw CParameterList::EParamRegVersionOriginVerificationExclusive; |
|
56 } |
|
57 #endif |
|
58 |
|
59 iInstaller = new Installer(*iSisRegistry, *iParamList, *iRomManager, *iConfigManager); |
|
60 |
|
61 // And ensure that any language code specified via the command line |
|
62 // overrides a value in the config file. |
|
63 if (iParamList->IsFlagSet(CParameterList::EFlagsLanguageWasSet)) |
|
64 { |
|
65 iConfigManager->SetValue( KVariableLanguage, iParamList->Language()); |
|
66 } |
|
67 } |
|
68 |
|
69 int CInterpretSIS::Install() |
|
70 { |
|
71 int retValue = 0; |
|
72 if (iParamList->FileNames().empty()) |
|
73 { |
|
74 return retValue; |
|
75 } |
|
76 |
|
77 // There is at least one sis file to be installed |
|
78 const CParameterList::SISFileList& files = iParamList->FileNames(); |
|
79 |
|
80 // Install the sis files |
|
81 retValue = iInstaller->Install(files); |
|
82 |
|
83 if (!iInstaller->GetMissing().empty()) |
|
84 { |
|
85 const Installer::MissingDeps& missing = iInstaller->GetMissing(); |
|
86 |
|
87 for (Installer::MissingDeps::const_iterator dependenciesIt = missing.begin(); |
|
88 dependenciesIt != missing.end(); |
|
89 ++dependenciesIt) |
|
90 { |
|
91 if (!dependenciesIt->second.empty()) |
|
92 { |
|
93 LERROR(L"Package " << dependenciesIt->first << L" requires:"); |
|
94 for (std::vector<SisRegistryDependency>::const_iterator dependantsIt = dependenciesIt->second.begin(); |
|
95 dependantsIt != dependenciesIt->second.end() ; |
|
96 ++dependantsIt) |
|
97 { |
|
98 LERROR(L"\t" << *dependantsIt); |
|
99 } |
|
100 } |
|
101 } |
|
102 } |
|
103 return retValue; |
|
104 } |
|
105 |
|
106 void CInterpretSIS::Uninstall() |
|
107 { |
|
108 // Check if uninstallation is required or not |
|
109 if (!iParamList->PkgUidsToRemove().empty()) |
|
110 { |
|
111 // Uninstall the sis files |
|
112 Uninstaller uninstall = Uninstaller(*iSisRegistry, *iParamList); |
|
113 uninstall.Uninstall(); |
|
114 } |
|
115 } |
|
116 |
|
117 // End of File |