diff options
author | David Kalnischkies <kalnischkies@gmail.com> | 2010-04-13 10:18:19 +0200 |
---|---|---|
committer | David Kalnischkies <kalnischkies@gmail.com> | 2010-04-13 10:18:19 +0200 |
commit | 9c2c9c24f7027a0299e545e55c38ac4c557359a5 (patch) | |
tree | a1512b8bb7d4d38abc7a0cad6267fff1ca2eb9ed /apt-pkg | |
parent | 3d5a34b22a83eb4bf9b1407e13240b8e2a333d5f (diff) |
create the partial dirs also automatic if only Dir::Cache::archives or
Dir::Cache::lists was set
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/acquire.cc | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index d83d80fac..832eaa02c 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -69,9 +69,18 @@ bool pkgAcquire::Setup(pkgAcquireStatus *Progress, string const &Lock) Log = Progress; // check for existence and possibly create auxiliary directories - if (CheckDirectory(_config->FindDir("Dir::State"), _config->FindDir("Dir::State::lists") + "partial/") == false || - CheckDirectory(_config->FindDir("Dir::Cache"), _config->FindDir("Dir::Cache::Archives") + "partial/") == false) - return false; + 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 (CheckDirectory(_config->FindDir("Dir::State"), partialListDir) == false && + CheckDirectory(listDir, partialListDir) == false) + return _error->Errno("Acquire", _("List directory %spartial is missing."), listDir.c_str()); + + if (CheckDirectory(_config->FindDir("Dir::Cache"), partialArchivesDir) == false && + CheckDirectory(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; @@ -94,7 +103,7 @@ bool pkgAcquire::CheckDirectory(string const &Parent, string const &Path) const return true; size_t const len = Parent.size(); - if (len > 5 && Parent.find("/apt/", len - 6, 5) != len - 5) + if (len > 5 && Parent.find("/apt/", len - 6, 5) == len - 5) { if (CreateDirectory(Parent.substr(0,len-5), Path) == true) return true; @@ -102,7 +111,7 @@ bool pkgAcquire::CheckDirectory(string const &Parent, string const &Path) const else if (CreateDirectory(Parent, Path) == true) return true; - return _error->Errno("Acquire", _("Directory %s can't be created."), Path.c_str()); + return false; } /*}}}*/ // Acquire::~pkgAcquire - Destructor /*{{{*/ |