summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Schier <nicolas@fjasle.eu>2020-02-27 05:04:54 +0100
committerNicolas Schier <nicolas@fjasle.eu>2020-06-08 12:18:33 +0200
commitc19a3276fe7ecfc132e95b0277e9e68ff364dd92 (patch)
treeeb4b99eaa2790626969cc7623fda9e7acdbf6c14
parent83b239c7285ac7450e305643b29596396abc0b3f (diff)
Support marking all newly installed packages as automatically installed
Add option '--mark-auto' to 'apt install' that marks all newly installed packages as automatically installed. Signed-off-by: Nicolas Schier <nicolas@fjasle.eu>
-rw-r--r--apt-pkg/depcache.cc3
-rw-r--r--apt-private/private-cmndline.cc1
-rw-r--r--doc/apt-get.8.xml10
-rw-r--r--doc/examples/configure-index1
4 files changed, 14 insertions, 1 deletions
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index 2eac1ba41..f90a41e22 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -1156,6 +1156,7 @@ struct CompareProviders /*{{{*/
/*}}}*/
bool pkgDepCache::MarkInstall_StateChange(pkgCache::PkgIterator const &Pkg, bool AutoInst, bool FromUser) /*{{{*/
{
+ bool AlwaysMarkAsAuto = _config->FindB("APT::Get::Mark-Auto", false) == true;
auto &P = (*this)[Pkg];
if (P.Protect() && P.InstallVer == P.CandidateVer)
return true;
@@ -1171,7 +1172,7 @@ bool pkgDepCache::MarkInstall_StateChange(pkgCache::PkgIterator const &Pkg, bool
P.Mode = pkgDepCache::ModeInstall;
P.InstallVer = P.CandidateVer;
- if(FromUser)
+ if(FromUser && !AlwaysMarkAsAuto)
{
// Set it to manual if it's a new install or already installed,
// but only if its not marked by the autoremover (aptitude depend on this behavior)
diff --git a/apt-private/private-cmndline.cc b/apt-private/private-cmndline.cc
index 478cb95f1..bcafe785b 100644
--- a/apt-private/private-cmndline.cc
+++ b/apt-private/private-cmndline.cc
@@ -276,6 +276,7 @@ static bool addArgumentsAPTGet(std::vector<CommandLine::Args> &Args, char const
addArg(0,"force-yes","APT::Get::force-yes",0);
addArg(0,"print-uris","APT::Get::Print-URIs",0);
addArg(0,"trivial-only","APT::Get::Trivial-Only",0);
+ addArg(0,"mark-auto","APT::Get::Mark-Auto",0);
addArg(0,"remove","APT::Get::Remove",0);
addArg(0,"only-source","APT::Get::Only-Source",0);
addArg(0,"allow-unauthenticated","APT::Get::AllowUnauthenticated",0);
diff --git a/doc/apt-get.8.xml b/doc/apt-get.8.xml
index e603ec5bb..a7b786dfe 100644
--- a/doc/apt-get.8.xml
+++ b/doc/apt-get.8.xml
@@ -545,6 +545,16 @@
Configuration Item: <literal>APT::Get::Trivial-Only</literal>.</para></listitem>
</varlistentry>
+ <varlistentry><term><option>--mark-auto</option></term>
+ <listitem><para>
+ After successful installation, mark all freshly installed packages as
+ automatically installed, which will cause each of the packages to be
+ removed when no more manually installed packages depend on this package.
+ This is equally to running <command>apt-mark auto</command> for all
+ installed packages.
+ Configuration Item: <literal>APT::Get::Mark-Auto</literal>.</para></listitem>
+ </varlistentry>
+
<varlistentry><term><option>--no-remove</option></term>
<listitem><para>If any packages are to be removed apt-get immediately aborts without
prompting.
diff --git a/doc/examples/configure-index b/doc/examples/configure-index
index 47715a9e1..9e02f0b13 100644
--- a/doc/examples/configure-index
+++ b/doc/examples/configure-index
@@ -73,6 +73,7 @@ APT
Assume-Yes "<BOOL>"; // not as dangerous, but use with care still
Assume-No "<BOOL>";
Trivial-Only "<BOOL>";
+ Mark-Auto "<BOOL>";
Remove "<BOOL>";
AllowUnauthenticated "<BOOL>"; // skip security