Guardando il file cmdline/apt-get.ccdal tarball di origine su http://packages.ubuntu.com/source/maverick/apt , posso vedere che --auto-removeè un argomento che abilita l' APT::Get::AutomaticRemoveimpostazione.
I comandi autoremoveed removeentrambi chiama la funzione DoInstall.
Anche il comando "autoremove" imposta APT::Get::AutomaticRemovee quindi fa la stessa cosa di --auto-remove.
Osservando la DoAutomaticRemovefunzione, è chiaramente visibile che abilitando l' APT::Get::AutomaticRemoveimpostazione ( --auto-removee facendo autoremoveciò) si verifica il loop Apt attraverso tutti i pacchetti installati e contrassegna i pacchetti non utilizzati per l'eliminazione.
Da 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);
Da 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;
}
Dalla funzione 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);
}
}
Non posso dire se è previsto o no, potresti riempire un bug / fare una domanda su launchpad.net .
Al momento, non è possibile escludere i pacchetti dalla cancellazione entro apt-get autoremove. Se si desidera conservare i pacchetti, eseguire apt-get -s autoremove, copiare i pacchetti dall'elenco e rimuovere i pacchetti dall'elenco che si desidera conservare. Infine, rimuovi quei pacchetti: sudo apt-get purge [packages-to-be-removed](l'eliminazione rimuove anche i file di configurazione, se presenti)