summaryrefslogtreecommitdiff
path: root/apt-private/acqprogress.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2017-05-28 17:44:11 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2017-06-28 19:18:47 +0200
commit24b5bc4e41ed527799a9fa01dec9c29294d0a3f2 (patch)
tree868ec0ba429d4df96b09a45c2f782c7c49786db3 /apt-private/acqprogress.cc
parentca8da1bf83ecc90ba882520b79c1cda03ee7485d (diff)
ask for releaseinfo change interactively in apt
If we have a user sitting around we can let 'apt' ask the user for a confirmation rather than print errors at the end and require the user to figure out which commandline flags are needed to confirm the changes non-interactively.
Diffstat (limited to 'apt-private/acqprogress.cc')
-rw-r--r--apt-private/acqprogress.cc22
1 files changed, 21 insertions, 1 deletions
diff --git a/apt-private/acqprogress.cc b/apt-private/acqprogress.cc
index e4bfbd4e5..1f053cb9f 100644
--- a/apt-private/acqprogress.cc
+++ b/apt-private/acqprogress.cc
@@ -17,6 +17,7 @@
#include <apt-pkg/error.h>
#include <apt-private/acqprogress.h>
+#include <apt-private/private-output.h>
#include <string.h>
#include <stdio.h>
@@ -32,7 +33,7 @@
// ---------------------------------------------------------------------
/* */
AcqTextStatus::AcqTextStatus(std::ostream &out, unsigned int &ScreenWidth,unsigned int const Quiet) :
- pkgAcquireStatus(), out(out), ScreenWidth(ScreenWidth), LastLineLength(0), ID(0), Quiet(Quiet)
+ pkgAcquireStatus2(), out(out), ScreenWidth(ScreenWidth), LastLineLength(0), ID(0), Quiet(Quiet)
{
// testcases use it to disable pulses without disabling other user messages
if (Quiet == 0 && _config->FindB("quiet::NoUpdate", false) == true)
@@ -330,6 +331,25 @@ bool AcqTextStatus::MediaChange(std::string Media, std::string Drive)
return bStatus;
}
/*}}}*/
+bool AcqTextStatus::ReleaseInfoChanges(metaIndex const * const L, metaIndex const * const N, std::vector<ReleaseInfoChange> &&Changes)/*{{{*/
+{
+ if (Quiet >= 2 || isatty(STDOUT_FILENO) != 1 || isatty(STDIN_FILENO) != 1 ||
+ _config->FindB("APT::Get::Update::InteractiveReleaseInfoChanges", false) == false)
+ return pkgAcquireStatus2::ReleaseInfoChanges(nullptr, nullptr, std::move(Changes));
+
+ _error->PushToStack();
+ auto const confirmed = pkgAcquireStatus2::ReleaseInfoChanges(L, N, std::move(Changes));
+ if (confirmed == true)
+ {
+ _error->MergeWithStack();
+ return true;
+ }
+ clearLastLine();
+ _error->DumpErrors(out, GlobalError::NOTICE, false);
+ _error->RevertToStack();
+ return YnPrompt(_("Do you want to accept these changes and continue updating from this repository?"), false, false, out, out);
+}
+ /*}}}*/
void AcqTextStatus::clearLastLine() { /*{{{*/
if (Quiet > 0 || LastLineLength == 0)
return;