diff -aur apt.orig/apt-pkg/algorithms.cc apt/apt-pkg/algorithms.cc
--- apt.orig/apt-pkg/algorithms.cc 2012-06-17 11:00:29.000000000 +0200
+++ apt/apt-pkg/algorithms.cc 2012-06-17 13:40:05.000000000 +0200
@@ -1497,6 +1497,14 @@
if (Fetcher.Setup(&Stat, _config->FindDir("Dir::State::Lists")) == false)
return false;
+ // Run scripts
+ RunScripts("APT::Update::Pre-Invoke");
+
+ // Refresh source lists, Pre-Invoke might change content
+ if (_config->FindB("APT::Update::List-Refresh",false) == true)
+ if (List.ReadMainList() == false)
+ return false;
+
// Populate it with the source selection
if (List.GetIndexes(&Fetcher) == false)
return false;
@@ -1509,14 +1517,13 @@
/* This is a simple wrapper to update the cache with a provided acquire
* If you only need control over Status and the used SourcesList use
* ListUpdate method instead.
+ * If you are calling AcquireUpdate directly you should call
+ * APT::Update::Pre-Invoke sripts on your own and reload source lists
+ * if needed.
*/
bool AcquireUpdate(pkgAcquire &Fetcher, int const PulseInterval,
bool const RunUpdateScripts, bool const ListCleanup)
{
- // Run scripts
- if (RunUpdateScripts == true)
- RunScripts("APT::Update::Pre-Invoke");
-
pkgAcquire::RunResult res;
if(PulseInterval > 0)
res = Fetcher.Run(PulseInterval);
diff -aur apt.orig/doc/apt.conf.5.xml apt/doc/apt.conf.5.xml
--- apt.orig/doc/apt.conf.5.xml 2012-06-17 01:35:56.000000000 +0200
+++ apt/doc/apt.conf.5.xml 2012-06-17 13:41:03.000000000 +0200
@@ -243,6 +243,10 @@
+
+ Thig group is used in update phase. See UPDATE group below.
+
+
APT uses since version 0.7.26 a resizable memory mapped cache file to store the available
information. Cache-Start acts as a hint of the size the cache will grow to,
@@ -557,6 +561,46 @@
+
+ The Update Group
+ The Update group of options controls the
+ update phase.
+
+
+
+
+ This is a list of shell commands to run before/after the package index files
+ are synchronized from their sources. This must be specified in list notation.
+ The commands are invoked in order using /bin/sh.
+
+
+
+
+
+
+ This is a list of shell commands to run after the package index files
+ are successfully synchronized from their sources. This must be specified in list notation.
+ The commands are invoked in order using /bin/sh.
+ This is run immediatelly before Post-Invoke.
+
+
+
+
+
+
+ If you modify &sources.list; in Pre-Invoke, you should set this boolean value to true.
+ If set to true, then &sources.list; are re-read after Pre-Invoke scripts are run.
+ Default is set to false.
+ Note, that it is not recommended to modify directly main &sources.list, but rather
+ your own file in /etc/apt/sources.list.d directory.
+ This is run immediatelly before Post-Invoke.
+
+
+
+
+
+
+
DirectoriesThe Dir::State section has directories that pertain to local