diff -r 7333d7932ef7 -r 8b7f4e561641 secureswitools/swisistools/source/interpretsislib/installer.cpp --- a/secureswitools/swisistools/source/interpretsislib/installer.cpp Tue Aug 31 15:21:33 2010 +0300 +++ b/secureswitools/swisistools/source/interpretsislib/installer.cpp Wed Sep 01 12:22:02 2010 +0100 @@ -21,7 +21,6 @@ #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK #include "dbhelper.h" -#include "dirparse.h" #ifndef __TOOLS2_LINUX__ #include #endif @@ -347,11 +346,6 @@ InstallableFiles installable; GetInstallableFiles(file, installable, *iExpressionEvaluator, aInstallSISFile.iTargetDrive); -#ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK - TBool iBackupFlag = false; - Backup(file, installable, iBackupFlag); -#endif - // Uninstall the same package (if found) prior to any installation UninstallPkg(file); @@ -359,33 +353,8 @@ InstallFiles(installable, iParamList.SystemDriveLetter()); -#ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK UpdateRegistry(file, installable, aInstallSISFile, aInstallSISFile.iSUFlag); -#else - try { - - UpdateRegistry(file, installable, aInstallSISFile, aInstallSISFile.iSUFlag); - } - catch (InterpretSisError& e) - { - RestoreAll(file, installable, iBackupFlag); - - LERROR(L"\t" << string2wstring(e.what())); - int result = e.GetErrorCode(); - return result; - } - catch (...) - {//Update Registry Failed. UnInstall the files. - - RestoreAll(file, installable, iBackupFlag); - return RSC_PARSING_ERROR; - } - - if(iBackupFlag) - RemoveBackup(file, installable); -#endif - if (aInstallSISFile.iGenerateStub) { CreateStubSisFile(aInstallSISFile, file); @@ -513,182 +482,6 @@ iRegistry.GenerateStubRegistry(); } -#ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK -// Backup all installed files for this Uid's packages and all the SisRegistry Entries -void Installer::Backup(const SisFile& aFile, InstallableFiles& aInstallable, TBool& aBackupFlag) -{ - TUint32 uid = aFile.GetPackageUid(); - TUint32 installType = aFile.GetInstallType(); - - // Check to see the SA is installed, else backup is not required. - if (iRegistry.IsInstalled(uid) && ((installType == CSISInfo::EInstInstallation) || (installType == CSISInfo::EInstPartialUpgrade))) - { - aBackupFlag = true; - int err = 0; - LINFO(L"Backup package \"" << aFile.GetPackageName() << L"\" prior to re-installation"); - - // Backup all installed files for this Uid's packages and all the SisRegistry Entries - iRegistry.BackupCtl(uid); - - //Backup SCR DB - std::string DbPath = iRegistry.GetDbPath(); - if (FileExists(string2wstring(DbPath))) - { - std::string BackupDb(DbPath); - BackupDb.append("_backup"); - - err=FileCopyA(DbPath.c_str(),BackupDb.c_str(),0); - if (err != 0) - LERROR(L"Failed to Backup Database scr.db "); - } - - // Backup all installed files for this Uid's packages and all the SisRegistry Entries - InstallableFiles::const_iterator filedesIter; - //Backup files - for(filedesIter = aInstallable.begin() ; filedesIter != aInstallable.end(); ++filedesIter) - { - std::wstring itargetLocalFile = (*filedesIter)->GetLocalTarget(); - if (FileExists(itargetLocalFile)) - { - std::wstring itargetBackupFile = (*filedesIter)->GetLocalTarget(); - std::wstring temp = itargetBackupFile.c_str(); - temp.append(L"_backup"); - itargetBackupFile = temp; - - - int pos =0; - #ifdef __LINUX__ - std::wstring sysBin = L"/sys/bin/"; - #else - std::wstring sysBin = L"\\sys\\bin\\"; - #endif - - if((pos = itargetBackupFile.find(sysBin, 0)) != std::wstring::npos) - { - BackupHashForFile(itargetLocalFile, iParamList.SystemDriveLetter(), iParamList.SystemDrivePath()); - } - - std::string iLocalFile = wstring2string(itargetLocalFile); - std::string iBackupFile = wstring2string(itargetBackupFile); - - err=FileCopyA(iLocalFile.c_str(),iBackupFile.c_str(),0); - if (err != 0) - LERROR(L"Failed to Backup installable file "); - } - } - } -} - -// Remove Backup of all installed files for this Uid's packages and all the SisRegistry Entries -void Installer::RemoveBackup(const SisFile& aFile, InstallableFiles& aInstallable) -{ - TUint32 uid = aFile.GetPackageUid(); - TUint32 installType = aFile.GetInstallType(); - - // Check to see the SA is installed, else backup is not required. - if (iRegistry.IsInstalled(uid) && ((installType == CSISInfo::EInstInstallation) || (installType == CSISInfo::EInstPartialUpgrade))) - { - LINFO(L"Remove Backup of package \"" << aFile.GetPackageName() << L"\" after re-installation success"); - // Remove all installed files for this Uid's packages and all the SisRegistry Entries - iRegistry.RemoveCtlBackup(uid); - - //Remove Backup SCR DB - std::string DbPath = iRegistry.GetDbPath(); - std::string BackupDb(DbPath); - BackupDb.append("_backup"); - std::wstring DbBackup = string2wstring(BackupDb); - - if (FileExists(DbBackup)) - RemoveFile(DbBackup); - - // Remove all installed files for this Uid's packages and all the SisRegistry Entries - InstallableFiles::const_iterator filedesIter; - std::wstring itargetLocalFile; - std::wstring itargetBackupFile; - - for(filedesIter = aInstallable.begin() ; filedesIter != aInstallable.end(); ++filedesIter) - { - itargetLocalFile = (*filedesIter)->GetLocalTarget(); - itargetBackupFile = (*filedesIter)->GetLocalTarget(); - std::wstring temp = itargetBackupFile.c_str(); - temp.append(L"_backup"); - itargetBackupFile = temp; - - if (FileExists(itargetBackupFile)) - { - RemoveFile(itargetBackupFile); - RemoveHashForFile(itargetBackupFile, iParamList.SystemDriveLetter(), iParamList.SystemDrivePath()); - } - } - } -} - -// Restore all installed files for this Uid's packages and all the SisRegistry Entries -void Installer::Restore(const SisFile& aFile, InstallableFiles& aInstallable, TBool& aBackupFlag) -{ - TUint32 uid = aFile.GetPackageUid(); - TUint32 installType = aFile.GetInstallType(); - - // Check to see the SA is installed, else backup is not required. - if((installType == CSISInfo::EInstInstallation) || (installType == CSISInfo::EInstPartialUpgrade)) - { - LINFO(L"Restoring Installed Package "); - - // Restore all .ctl file for this Uid's packages and all the SisRegistry Entries - iRegistry.RestoreCtl(uid, aBackupFlag); - - // Restore all installed files for this Uid's packages and all the SisRegistry Entries - InstallableFiles::const_iterator filedesIter; - for(filedesIter = aInstallable.begin() ; filedesIter != aInstallable.end(); ++filedesIter) - { - std::wstring itargetLocalFile = (*filedesIter)->GetLocalTarget(); - std::wstring itargetBackupFile = (*filedesIter)->GetLocalTarget(); - itargetBackupFile.append(L"_backup"); - if (FileExists(itargetBackupFile)) - { - int pos =0; - #ifdef __LINUX__ - std::wstring sysBin = L"/sys/bin/"; - #else - std::wstring sysBin = L"\\sys\\bin\\"; - #endif - - if((pos = itargetBackupFile.find(sysBin, 0)) != std::wstring::npos) - { - RestoreHashForFile(itargetLocalFile, iParamList.SystemDriveLetter(), iParamList.SystemDrivePath()); - } - - std::string iLocalFile = wstring2string(itargetLocalFile); - std::string iBackupFile = wstring2string(itargetBackupFile); - - int err = FileMoveA(iBackupFile.c_str(),iLocalFile.c_str()); - if (err != 0) - LERROR(L"Failed to Restore file "); - } - } - } -} - -void Installer::RestoreAll(const SisFile& aFile, InstallableFiles& aInstallable, TBool& aBackupFlag) -{ - InstallableFiles::const_iterator filedesIter; - std::wstring itargetLocalFile; - - for(filedesIter = aInstallable.begin() ; filedesIter != aInstallable.end(); ++filedesIter) - { - itargetLocalFile = (*filedesIter)->GetLocalTarget(); - - if (FileExists(itargetLocalFile)) - { - RemoveFile(itargetLocalFile); - RemoveHashForFile(itargetLocalFile, iParamList.SystemDriveLetter(), iParamList.SystemDrivePath()); - } - } - Restore(aFile, aInstallable, aBackupFlag); - FreeInstallableFiles(aInstallable); -} - -#endif struct CheckDependencyMet { @@ -1019,7 +812,7 @@ // hash file is always created on the system drive reghashdir[0] = iSystemDrive; - LINFO(L"\tCreating hash: " << reghashdir << basename); + LINFO(L"\tCreating hash: " << reghashdir << basename.c_str()); std::wstring hash = hashdir + basename; HANDLE hFile = MakeSISOpenFile(hash.c_str(), GENERIC_WRITE, CREATE_ALWAYS); if( INVALID_HANDLE_VALUE == hFile ) @@ -1544,7 +1337,6 @@ std::wostringstream os; os << target.c_str() << L" eclipses file from ROM" << std::endl; iProblemFiles.append(os.str()); - iError = ECLIPSING_VIOLATION; continue; }