Make the Installer ignore /var at it's new location. The old location is also
still checked, in case one uses the Installer to copy an old installation. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35173 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -13,6 +13,7 @@
|
|||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
|
|
||||||
#include <Directory.h>
|
#include <Directory.h>
|
||||||
|
#include <FindDirectory.h>
|
||||||
#include <fs_attr.h>
|
#include <fs_attr.h>
|
||||||
#include <NodeInfo.h>
|
#include <NodeInfo.h>
|
||||||
#include <Path.h>
|
#include <Path.h>
|
||||||
@@ -62,6 +63,11 @@ CopyEngine::CopyEngine(ProgressReporter* reporter)
|
|||||||
rl.rlim_cur = 512;
|
rl.rlim_cur = 512;
|
||||||
rl.rlim_max = RLIM_SAVED_MAX;
|
rl.rlim_max = RLIM_SAVED_MAX;
|
||||||
setrlimit(RLIMIT_NOFILE, &rl);
|
setrlimit(RLIMIT_NOFILE, &rl);
|
||||||
|
|
||||||
|
// init BEntry pointing to /var
|
||||||
|
BPath path;
|
||||||
|
if (find_directory(B_COMMON_VAR_DIRECTORY, &path) == B_OK)
|
||||||
|
fVarDirectory.SetTo(path.Path());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -231,7 +237,7 @@ CopyEngine::_CollectCopyInfo(const char* _source, int32& level,
|
|||||||
if (ret < B_OK)
|
if (ret < B_OK)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (!_ShouldCopyEntry(name, statInfo, level))
|
if (!_ShouldCopyEntry(entry, name, statInfo, level))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (S_ISDIR(statInfo.st_mode)) {
|
if (S_ISDIR(statInfo.st_mode)) {
|
||||||
@@ -302,7 +308,7 @@ CopyEngine::_CopyFolder(const char* _source, const char* _destination,
|
|||||||
struct stat statInfo;
|
struct stat statInfo;
|
||||||
entry.GetStat(&statInfo);
|
entry.GetStat(&statInfo);
|
||||||
|
|
||||||
if (!_ShouldCopyEntry(name, statInfo, level))
|
if (!_ShouldCopyEntry(entry, name, statInfo, level))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
fItemsCopied++;
|
fItemsCopied++;
|
||||||
@@ -490,11 +496,12 @@ CopyEngine::_UpdateProgress()
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CopyEngine::_ShouldCopyEntry(const char* name, const struct stat& statInfo,
|
CopyEngine::_ShouldCopyEntry(const BEntry& entry, const char* name,
|
||||||
int32 level) const
|
const struct stat& statInfo, int32 level) const
|
||||||
{
|
{
|
||||||
if (level == 1 && S_ISDIR(statInfo.st_mode)) {
|
if (level == 1 && S_ISDIR(statInfo.st_mode)) {
|
||||||
if (strcmp(VAR_DIRECTORY, name) == 0) {
|
if (strcmp(VAR_DIRECTORY, name) == 0) {
|
||||||
|
// old location of /boot/var
|
||||||
printf("ignoring '%s'.\n", name);
|
printf("ignoring '%s'.\n", name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -517,6 +524,11 @@ CopyEngine::_ShouldCopyEntry(const char* name, const struct stat& statInfo,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (fVarDirectory == entry) {
|
||||||
|
// current location of var
|
||||||
|
printf("ignoring '%s'.\n", name);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,8 @@ private:
|
|||||||
const char* destination,
|
const char* destination,
|
||||||
int32& level, sem_id cancelSemaphore);
|
int32& level, sem_id cancelSemaphore);
|
||||||
|
|
||||||
bool _ShouldCopyEntry(const char* name,
|
bool _ShouldCopyEntry(const BEntry& entry,
|
||||||
|
const char* name,
|
||||||
const struct stat& statInfo,
|
const struct stat& statInfo,
|
||||||
int32 level) const;
|
int32 level) const;
|
||||||
|
|
||||||
@@ -106,6 +107,9 @@ private:
|
|||||||
const char* fCurrentItem;
|
const char* fCurrentItem;
|
||||||
|
|
||||||
ProgressReporter* fProgressReporter;
|
ProgressReporter* fProgressReporter;
|
||||||
|
|
||||||
|
// TODO: Should be made into a list of BEntris to be ignored, perhaps.
|
||||||
|
BEntry fVarDirectory;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user