summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/acquire.cc30
-rw-r--r--apt-pkg/acquire.h5
2 files changed, 21 insertions, 14 deletions
diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc
index f0a88a538..8119e4487 100644
--- a/apt-pkg/acquire.cc
+++ b/apt-pkg/acquire.cc
@@ -73,23 +73,27 @@ pkgAcquire::pkgAcquire(pkgAcquireStatus *Progress) : LockFD(-1), Queues(0), Wor
// ---------------------------------------------------------------------
/* Do everything needed to be a complete Acquire object and report the
success (or failure) back so the user knows that something is wrong… */
-bool pkgAcquire::Setup(pkgAcquireStatus *Progress, string const &Lock)
+bool pkgAcquire::Setup(pkgAcquireStatus *Progress, string const &Lock,
+ bool const createDirectories)
{
Log = Progress;
// check for existence and possibly create auxiliary directories
- string const listDir = _config->FindDir("Dir::State::lists");
- string const partialListDir = listDir + "partial/";
- string const archivesDir = _config->FindDir("Dir::Cache::Archives");
- string const partialArchivesDir = archivesDir + "partial/";
-
- if (CreateAPTDirectoryIfNeeded(_config->FindDir("Dir::State"), partialListDir) == false &&
- CreateAPTDirectoryIfNeeded(listDir, partialListDir) == false)
- return _error->Errno("Acquire", _("List directory %spartial is missing."), listDir.c_str());
-
- if (CreateAPTDirectoryIfNeeded(_config->FindDir("Dir::Cache"), partialArchivesDir) == false &&
- CreateAPTDirectoryIfNeeded(archivesDir, partialArchivesDir) == false)
- return _error->Errno("Acquire", _("Archives directory %spartial is missing."), archivesDir.c_str());
+ if (createDirectories == true)
+ {
+ string const listDir = _config->FindDir("Dir::State::lists");
+ string const partialListDir = listDir + "partial/";
+ string const archivesDir = _config->FindDir("Dir::Cache::Archives");
+ string const partialArchivesDir = archivesDir + "partial/";
+
+ if (CreateAPTDirectoryIfNeeded(_config->FindDir("Dir::State"), partialListDir) == false &&
+ CreateAPTDirectoryIfNeeded(listDir, partialListDir) == false)
+ return _error->Errno("Acquire", _("List directory %spartial is missing."), listDir.c_str());
+
+ if (CreateAPTDirectoryIfNeeded(_config->FindDir("Dir::Cache"), partialArchivesDir) == false &&
+ CreateAPTDirectoryIfNeeded(archivesDir, partialArchivesDir) == false)
+ return _error->Errno("Acquire", _("Archives directory %spartial is missing."), archivesDir.c_str());
+ }
if (Lock.empty() == true || _config->FindB("Debug::NoLocking", false) == true)
return true;
diff --git a/apt-pkg/acquire.h b/apt-pkg/acquire.h
index a92ecc24c..7bceb4323 100644
--- a/apt-pkg/acquire.h
+++ b/apt-pkg/acquire.h
@@ -352,8 +352,11 @@ class pkgAcquire
* \param Lock defines a lock file that should be acquired to ensure
* only one Acquire class is in action at the time or an empty string
* if no lock file should be used.
+ * \param createDirectories can be used to disable the creation of directories,
+ * e.g. if the fetcher is used with different directories later on
*/
- bool Setup(pkgAcquireStatus *Progress = NULL, std::string const &Lock = "");
+ bool Setup(pkgAcquireStatus *Progress = NULL, std::string const &Lock = "",
+ bool const createDirectories = true);
void SetLog(pkgAcquireStatus *Progress) { Log = Progress; }