diff options
author | Julian Andres Klode <jak@debian.org> | 2021-11-17 17:07:37 +0000 |
---|---|---|
committer | Julian Andres Klode <jak@debian.org> | 2021-11-17 17:07:37 +0000 |
commit | 68a6dffed6ad5e5dc4ac01319b31843951d0eb21 (patch) | |
tree | 2e3a04a8cd517ef29f079e765251b619a8d090e8 | |
parent | 1a2f6293565d1d371f136c8049723a665556d59c (diff) | |
parent | 21cc694f55de7caede8dcef3831236b6ca855cd7 (diff) |
Merge branch 'pu/no-prompt-essential-removal' into 'main'
Require argument to remove essential packages, do not prompt
See merge request apt-team/apt!199
-rw-r--r-- | apt-private/private-install.cc | 14 | ||||
-rw-r--r-- | apt-private/private-output.cc | 18 | ||||
-rw-r--r-- | apt-private/private-output.h | 1 |
3 files changed, 1 insertions, 32 deletions
diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc index 2420865cb..aaf98539a 100644 --- a/apt-private/private-install.cc +++ b/apt-private/private-install.cc @@ -304,19 +304,7 @@ bool InstallPackages(CacheFile &Cache, APT::PackageVector &HeldBackPackages, boo if (_config->FindB("APT::Get::Trivial-Only",false) == true) return _error->Error(_("Trivial Only specified but this is not a trivial operation.")); - // TRANSLATOR: This string needs to be typed by the user as a confirmation, so be - // careful with hard to type or special characters (like non-breaking spaces) - const char *Prompt = _("Yes, do as I say!"); - std::string question; - strprintf(question, - _("You are about to do something potentially harmful.\n" - "To continue type in the phrase '%s'\n" - " ?] "),Prompt); - if (AnalPrompt(question, Prompt) == false) - { - c2out << _("Abort.") << std::endl; - exit(1); - } + return _error->Error(_("Removing essential system-critical packages is not permitted. This might break the system.")); } else { diff --git a/apt-private/private-output.cc b/apt-private/private-output.cc index daa6c6aed..04cb148ba 100644 --- a/apt-private/private-output.cc +++ b/apt-private/private-output.cc @@ -745,24 +745,6 @@ bool YnPrompt(char const * const Question, bool const Default) return YnPrompt(Question, Default, true, c1out, c2out); } /*}}}*/ -// AnalPrompt - Annoying Yes No Prompt. /*{{{*/ -// --------------------------------------------------------------------- -/* Returns true on a Yes.*/ -bool AnalPrompt(std::string const &Question, const char *Text) -{ - if (_config->FindI("quiet",0) > 0) - _error->DumpErrors(c2out); - else - _error->DumpErrors(c2out, GlobalError::DEBUG); - c2out << Question << std::flush; - - char Buf[1024]; - std::cin.getline(Buf,sizeof(Buf)); - if (strcmp(Buf,Text) == 0) - return true; - return false; -} - /*}}}*/ std::string PrettyFullName(pkgCache::PkgIterator const &Pkg) { diff --git a/apt-private/private-output.h b/apt-private/private-output.h index 0e06bf072..d6f25e1ec 100644 --- a/apt-private/private-output.h +++ b/apt-private/private-output.h @@ -104,7 +104,6 @@ void Stats(std::ostream &out, pkgDepCache &Dep, APT::PackageVector const &HeldBa // prompting APT_PUBLIC bool YnPrompt(char const *const Question, bool Default = true); bool YnPrompt(char const * const Question, bool const Default, bool const ShowGlobalErrors, std::ostream &c1o, std::ostream &c2o); -bool AnalPrompt(std::string const &Question, const char *Text); APT_PUBLIC std::string PrettyFullName(pkgCache::PkgIterator const &Pkg); std::string CandidateVersion(pkgCacheFile * const Cache, pkgCache::PkgIterator const &Pkg); |