equal
deleted
inserted
replaced
126 if ((currStr->find(L".SIS",0) != std::wstring::npos) |
126 if ((currStr->find(L".SIS",0) != std::wstring::npos) |
127 || (currStr->find(L".sis",0) != std::wstring::npos)) |
127 || (currStr->find(L".sis",0) != std::wstring::npos)) |
128 { |
128 { |
129 InstallSISFile sisFileName(shortName + KDirectorySeparator + *currStr, |
129 InstallSISFile sisFileName(shortName + KDirectorySeparator + *currStr, |
130 curr->iTargetDrive, curr->iGenerateStub, |
130 curr->iTargetDrive, curr->iGenerateStub, |
131 curr->iNonRemovable, curr->iNotRegister, curr->iSUFlag); |
131 curr->iNonRemovable, curr->iReadOnly, curr->iNotRegister, curr->iSUFlag); |
132 |
132 |
133 sisFiles.push_back(sisFileName); |
133 sisFiles.push_back(sisFileName); |
134 } |
134 } |
135 } |
135 } |
136 |
136 |
141 } |
141 } |
142 else if ((shortName.find(L".SIS",0) != std::wstring::npos) |
142 else if ((shortName.find(L".SIS",0) != std::wstring::npos) |
143 || (shortName.find(L".sis",0) != std::wstring::npos)) |
143 || (shortName.find(L".sis",0) != std::wstring::npos)) |
144 { |
144 { |
145 InstallSISFile sisFileName(shortName, curr->iTargetDrive, curr->iGenerateStub, |
145 InstallSISFile sisFileName(shortName, curr->iTargetDrive, curr->iGenerateStub, |
146 curr->iNonRemovable, curr->iNotRegister, curr->iSUFlag); |
146 curr->iNonRemovable, curr->iReadOnly, curr->iNotRegister, curr->iSUFlag); |
147 |
147 |
148 sisFiles.push_back(sisFileName); |
148 sisFiles.push_back(sisFileName); |
149 } |
149 } |
150 else |
150 else |
151 { |
151 { |
273 if (!DependenciesOk(file)) |
273 if (!DependenciesOk(file)) |
274 { |
274 { |
275 return MISSING_DEPENDENCY; |
275 return MISSING_DEPENDENCY; |
276 } |
276 } |
277 |
277 |
278 if (!IsValidUpgrade(file, aInstallSISFile.iSUFlag)) |
278 if (!IsValidUpgrade(file, aInstallSISFile.iSUFlag, aInstallSISFile.iNonRemovable)) |
279 { |
279 { |
280 return INVALID_UPGRADE; |
280 return INVALID_UPGRADE; |
281 } |
281 } |
282 |
282 |
283 InstallableFiles installable; |
283 InstallableFiles installable; |
480 |
480 |
481 return iMissing[aFile.GetPackageName()].size() == 0; |
481 return iMissing[aFile.GetPackageName()].size() == 0; |
482 } |
482 } |
483 |
483 |
484 |
484 |
485 bool Installer::IsValidUpgrade(const SisFile& aFile, bool aSUFlag) |
485 bool Installer::IsValidUpgrade(const SisFile& aFile, bool aSUFlag, bool aNonRemovable) |
486 { |
486 { |
487 TUint32 pkg = aFile.GetPackageUid(); |
487 TUint32 pkg = aFile.GetPackageUid(); |
488 TUint32 installFlags = aFile.GetInstallFlags(); |
488 TUint32 installFlags = aFile.GetInstallFlags(); |
|
489 |
|
490 if(aNonRemovable) |
|
491 { |
|
492 TUint8 iFlag = 0; |
|
493 iFlag |= CSISInfo::EInstFlagNonRemovable; |
|
494 aFile.AddInstallFlags(iFlag); |
|
495 installFlags = aFile.GetInstallFlags(); |
|
496 } |
|
497 |
489 bool RUFlag = ((installFlags & CSISInfo::EInstFlagROMUpgrade) && CSISInfo::EInstFlagROMUpgrade); |
498 bool RUFlag = ((installFlags & CSISInfo::EInstFlagROMUpgrade) && CSISInfo::EInstFlagROMUpgrade); |
490 |
499 |
491 if(iParamList.RegistryVersionExists()) |
500 if(iParamList.RegistryVersionExists()) |
492 { |
501 { |
493 int regMajor = iParamList.RegistryMajorVersion(); |
502 int regMajor = iParamList.RegistryMajorVersion(); |
508 |
517 |
509 TUint32 installType = aFile.GetInstallType(); |
518 TUint32 installType = aFile.GetInstallType(); |
510 |
519 |
511 if (iRegistry.IsInstalled(pkg)) |
520 if (iRegistry.IsInstalled(pkg)) |
512 { |
521 { |
513 ValidateRegistry(aFile,pkg,installFlags,RUFlag); |
522 ValidateRegistry(aFile,pkg,installFlags,RUFlag,aNonRemovable); |
514 } |
523 } |
515 else if (installType == CSISInfo::EInstAugmentation || installType == CSISInfo::EInstPartialUpgrade) |
524 else if (installType == CSISInfo::EInstAugmentation || installType == CSISInfo::EInstPartialUpgrade) |
516 { |
525 { |
517 // Installing SP and PU without the base package |
526 // Installing SP and PU without the base package |
518 std::stringstream err; |
527 std::stringstream err; |
523 } |
532 } |
524 |
533 |
525 return true; |
534 return true; |
526 } |
535 } |
527 |
536 |
528 void Installer::ValidateRegistry(const SisFile& aFile, TUint32 aPckgUid, TUint32 aInstallFlags, bool aRUFlag) |
537 void Installer::ValidateRegistry(const SisFile& aFile, TUint32 aPckgUid, TUint32 aInstallFlags, bool aRUFlag, bool aNonRemovable) |
529 { |
538 { |
530 bool isSisNonRemovable = aInstallFlags & CSISInfo::EInstFlagNonRemovable; |
539 bool isSisNonRemovable = aInstallFlags & CSISInfo::EInstFlagNonRemovable; |
531 bool isBaseRemovable = false; |
540 bool isBaseRemovable = false; |
532 bool inRom = false; |
541 bool inRom = false; |
533 bool isPreInstalled = false; |
542 bool isPreInstalled = false; |
587 |
596 |
588 // Partial Upgrade can only be installed to a base package of the same install flag type. |
597 // Partial Upgrade can only be installed to a base package of the same install flag type. |
589 // The only exception is a ROM stub which is upgradable and non-removable by definition. |
598 // The only exception is a ROM stub which is upgradable and non-removable by definition. |
590 if ((isBaseRemovable == isSisNonRemovable) && !inRom ) |
599 if ((isBaseRemovable == isSisNonRemovable) && !inRom ) |
591 { |
600 { |
592 std::stringstream err; |
601 if(!aNonRemovable) |
593 err << "Cannot install PU (0x" << std::hex << aPckgUid << ") to a base package with a different removable flag type"; |
602 { |
594 |
603 std::stringstream err; |
595 throw InterpretSisError(err.str(), INVALID_UPGRADE); |
604 err << "Cannot install PU (0x" << std::hex << aPckgUid << ") to a base package with a different removable flag type"; |
|
605 |
|
606 throw InterpretSisError(err.str(), INVALID_UPGRADE); |
|
607 } |
596 } |
608 } |
597 } |
609 } |
598 else if (installType == CSISInfo::EInstPreInstalledApp) |
610 else if (installType == CSISInfo::EInstPreInstalledApp) |
599 { |
611 { |
600 std::stringstream err; |
612 std::stringstream err; |
1550 |
1562 |
1551 LINFO(L"\tCreating stub: " << ctrlDrive); |
1563 LINFO(L"\tCreating stub: " << ctrlDrive); |
1552 |
1564 |
1553 aSis.MakeSISStub(ctrl); |
1565 aSis.MakeSISStub(ctrl); |
1554 // If the NR flag is set, change the file attribute to RO |
1566 // If the NR flag is set, change the file attribute to RO |
1555 if (aInstallSISFile.iNonRemovable) |
1567 if (aInstallSISFile.iReadOnly) |
1556 { |
1568 { |
1557 _wchmod(ctrl.c_str(),_S_IREAD); |
1569 _wchmod(ctrl.c_str(),_S_IREAD); |
1558 } |
1570 } |
1559 } |
1571 } |