From: Michael Vogt <michael.vogt@ubuntu.com>
Date: Fri, 24 Jun 2005 09:58:47 +0000 (+0000)
Subject: * write the state file after a successfull commit from the pkgManager
X-Git-Tag: 0.7.24ubuntu1~254^2~25
X-Git-Url: https://git.saurik.com/apt.git/commitdiff_plain/d36ab88eb8a5e490e4a817b87f20cb3f890e0da1

* write the state file after a successfull commit from the pkgManager
---

diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc
index a08ccd602..a97c94fdf 100644
--- a/apt-pkg/packagemanager.cc
+++ b/apt-pkg/packagemanager.cc
@@ -637,6 +637,11 @@ pkgPackageManager::OrderResult pkgPackageManager::DoInstall()
    if (Res != Failed)
       if (Go() == false)
 	 return Failed;
+
+   // if all was fine update the state file
+   if(Res == Completed)
+      Cache.writeStateFile(NULL);
+
    return Res;
 }
 									/*}}}*/
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index bc8cd1ae5..f1496c9e2 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -994,9 +994,6 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true,
 	 return _error->Error(_("Aborting install."));
       }
 
-      // -- we do it here because there is no libapt::Commit() :/
-      Cache->writeStateFile(NULL);
-       	 
       _system->UnLock();
       pkgPackageManager::OrderResult Res = PM->DoInstall();
       if (Res == pkgPackageManager::Failed || _error->PendingError() == true)