Eu usei este script Python para analisar o arquivo de log de todos os pacotes que foram instalados como dependências de xinit e ubuntu-desktop :
REMOVETHESE='xinit','ubuntu-desktop'
#Return an input string with everything parenthesized removed.
def removeParenthesized(inp):
while "(" in inp:
opening=inp.find("(")-1
ending=inp.find(")")+1
inp=inp[:opening]+inp[ending:]
return inp
#Load the log file
with open("/var/log/apt/history.log","r") as logfile:
log=logfile.read()
#Separate each log entry.
entries=log.split("\n\n")
#Dict pairs the name of an installed package with the full log entry for that installation
entries={e.split("\n")[1].split(" ")[-1] : "\n".join(e.split("\n")[2:-2])[8:] for e in entries if e.split("\n")[1].split(" ")[2]=="install"}
#Entries of packages to remove
toRemove=[entries[rt] for rt in REMOVETHESE]
#To be removed
removals=[]
for entry in toRemove:
#Remove the parenthesized information
entry = removeParenthesized(entry)
#Split entries by comma, removing the initial space
packages = [e[1:] for e in entry.split(',')]
#Remove the info after the colon
packages=[p.split(':')[0] for p in packages]
#Add dependencies for this package to list
removals.extend(packages)
#Print all dependencies
print ' '.join(removals)
Em seguida, colei a saída no final de um apt-get autoremove . A saída me deixou muito feliz:
