Installer: don't replace system/settings.
* Instead of removing "system" in the target completely, only replace all of its subfolders. * The downside of the current solution is that extra files, and directories in "system" will not be removed. Improvements welcome.
This commit is contained in:
@@ -1,8 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2008-2009, Stephan Aßmus <[email protected]>
|
* Copyright 2008-2009, Stephan Aßmus <[email protected]>
|
||||||
* All rights reserved. Distributed under the terms of the MIT License.
|
* Copyright 2014, Axel Dörfler, [email protected]
|
||||||
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "CopyEngine.h"
|
#include "CopyEngine.h"
|
||||||
|
|
||||||
#include <new>
|
#include <new>
|
||||||
|
|||||||
@@ -132,19 +132,22 @@ public:
|
|||||||
virtual bool ShouldClobberFolder(const BEntry& entry, const char* path,
|
virtual bool ShouldClobberFolder(const BEntry& entry, const char* path,
|
||||||
const struct stat& statInfo, int32 level) const
|
const struct stat& statInfo, int32 level) const
|
||||||
{
|
{
|
||||||
if (level == 1 && S_ISDIR(statInfo.st_mode)) {
|
if (level == 2 && S_ISDIR(statInfo.st_mode)
|
||||||
if (strcmp("system", path) == 0) {
|
&& strncmp("system/", path, 7) == 0
|
||||||
printf("clobbering '%s'.\n", path);
|
&& strcmp("system/settings", path) != 0) {
|
||||||
return true;
|
// Replace everything in "system" besides "settings"
|
||||||
}
|
printf("clobbering '%s'.\n", path);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::set<std::string> fIgnorePaths;
|
typedef std::set<std::string> StringSet;
|
||||||
std::set<std::string> fPackageFSRootPaths;
|
|
||||||
dev_t fSourceDevice;
|
StringSet fIgnorePaths;
|
||||||
|
StringSet fPackageFSRootPaths;
|
||||||
|
dev_t fSourceDevice;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -455,10 +458,11 @@ WorkerThread::_PerformInstall(partition_id sourcePartitionID,
|
|||||||
if (entries != 0) {
|
if (entries != 0) {
|
||||||
BAlert* alert = new BAlert("", B_TRANSLATE("The target volume is not "
|
BAlert* alert = new BAlert("", B_TRANSLATE("The target volume is not "
|
||||||
"empty. Are you sure you want to install anyway?\n\nNote: The "
|
"empty. Are you sure you want to install anyway?\n\nNote: The "
|
||||||
"'system' folder will be a clean copy from the source volume, all "
|
"'system' folder will be a clean copy from the source volume but "
|
||||||
"other folders will be merged, whereas files and links that exist "
|
"will retain its settings folder, all other folders will be "
|
||||||
"on both the source and target volume will be overwritten with "
|
"merged, whereas files and links that exist on both the source "
|
||||||
"the source volume version."),
|
"and target volume will be overwritten with the source volume "
|
||||||
|
"version."),
|
||||||
B_TRANSLATE("Install anyway"), B_TRANSLATE("Cancel"), 0,
|
B_TRANSLATE("Install anyway"), B_TRANSLATE("Cancel"), 0,
|
||||||
B_WIDTH_AS_USUAL, B_STOP_ALERT);
|
B_WIDTH_AS_USUAL, B_STOP_ALERT);
|
||||||
alert->SetShortcut(1, B_ESCAPE);
|
alert->SetShortcut(1, B_ESCAPE);
|
||||||
|
|||||||
Reference in New Issue
Block a user