Examinando o arquivo cmdline/apt-get.cc do tarball de origem no link , vejo que --auto-remove é um argumento que ativa a configuração APT::Get::AutomaticRemove .
Os comandos autoremove e remove chamam a função DoInstall .
O comando "autoremove" também define APT::Get::AutomaticRemove e faz, portanto, a mesma coisa que --auto-remove .
Examinando a função DoAutomaticRemove , é claramente visível que ativar a configuração APT::Get::AutomaticRemove ( --auto-remove e autoremove faz isso) faz com que o Apt execute um loop através de todos os pacotes instalados e marque os pacotes não utilizados.
De main() :
CommandLine::Args Args[] = {
// ... stripped to save space
{0,"auto-remove","APT::Get::AutomaticRemove",0},
// ...
}
CommandLine::Dispatch Cmds[] = { // ...
{"remove",&DoInstall},
{"purge",&DoInstall},
{"autoremove",&DoInstall},
// ...
}
// ...
// Parse the command line and initialize the package library
CommandLine CmdL(Args,_config);
De DoInstall() :
unsigned short fallback = MOD_INSTALL;
if (strcasecmp(CmdL.FileList[0],"remove") == 0)
fallback = MOD_REMOVE;
else if (strcasecmp(CmdL.FileList[0], "purge") == 0)
{
_config->Set("APT::Get::Purge", true);
fallback = MOD_REMOVE;
}
else if (strcasecmp(CmdL.FileList[0], "autoremove") == 0)
{
_config->Set("APT::Get::AutomaticRemove", "true");
fallback = MOD_REMOVE;
}
Da função DoAutomaticRemove :
bool doAutoRemove = _config->FindB("APT::Get::AutomaticRemove", false);
// ...
// look over the cache to see what can be removed
for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); ! Pkg.end(); ++Pkg) {
if (doAutoRemove) {
if(Pkg.CurrentVer() != 0 &&
Pkg->CurrentState != pkgCache::State::ConfigFiles)
Cache->MarkDelete(Pkg, purgePkgs);
else
Cache->MarkKeep(Pkg, false, false);
}
}
Eu não posso falar se é intencional ou não, você pode preencher um bug / ask uma pergunta em launchpad.net .
No momento, não é possível excluir pacotes da exclusão por apt-get autoremove . Se você quiser manter os pacotes, execute apt-get -s autoremove , copie os pacotes da lista e remova os pacotes da lista que deseja manter. Por fim, remova os pacotes: sudo apt-get purge [packages-to-be-removed] (remoção remove os arquivos de configuração também, se houver)