Installer: Restrict entry filter to files from the BFS volume

We generally want to skip the contents of the packagefs volumes (save
for the shine-through directories). That makes Installer usable again.
In what direction we want to develop it (e.g. integrate some PM support,
so that a subset of packages can be selected) needs further discussion.
This commit is contained in:
Ingo Weinhold
2013-06-02 19:11:39 +02:00
parent f4953ba541
commit 6c36ad168e
3 changed files with 23 additions and 3 deletions
-1
View File
@@ -9,4 +9,3 @@
const char* const kPackagesDirectoryPath = "_packages_";
const char* const kSourcesDirectoryPath = "_sources_";
const char* const kSwapFilePath = "common/var/swap";
-1
View File
@@ -16,7 +16,6 @@ static const uint32 MSG_WRITE_BOOT_SECTOR = 'iWBS';
extern const char* const kPackagesDirectoryPath;
extern const char* const kSourcesDirectoryPath;
extern const char* const kSwapFilePath;
#endif // INSTALLER_DEFS_H
+23 -1
View File
@@ -86,6 +86,9 @@ private:
class WorkerThread::EntryFilter : public CopyEngine::EntryFilter {
public:
EntryFilter(const char* sourceDirectory)
:
fIgnorePaths(),
fSourceDevice(-1)
{
try {
fIgnorePaths.insert(kPackagesDirectoryPath);
@@ -93,10 +96,18 @@ public:
fIgnorePaths.insert("rr_moved");
fIgnorePaths.insert("boot.catalog");
fIgnorePaths.insert("haiku-boot-floppy.image");
fIgnorePaths.insert(kSwapFilePath);
fIgnorePaths.insert("common/var/swap");
fIgnorePaths.insert("common/var/shared_memory");
fPackageFSRootPaths.insert("system");
fPackageFSRootPaths.insert("common");
fPackageFSRootPaths.insert("home/config");
} catch (std::bad_alloc&) {
}
struct stat st;
if (stat(sourceDirectory, &st) == 0)
fSourceDevice = st.st_dev;
}
virtual bool ShouldCopyEntry(const BEntry& entry, const char* path,
@@ -106,6 +117,15 @@ public:
printf("ignoring '%s'.\n", path);
return false;
}
if (statInfo.st_dev != fSourceDevice) {
// Allow that only for the root of the packagefs mounts, since
// those contain directories that shine through from the
// underlying volume.
if (fPackageFSRootPaths.find(path) == fPackageFSRootPaths.end())
return false;
}
return true;
}
@@ -123,6 +143,8 @@ public:
private:
std::set<std::string> fIgnorePaths;
std::set<std::string> fPackageFSRootPaths;
dev_t fSourceDevice;
};