#!/bin/bash
. get_root
set -v
(
dpkg --get-selections | awk '$2 == "install" { print $1 }' | xa apt-mark auto
dpkg --get-selections | awk '$2 == "install" { print $1 }' | grep -e 'task-*' -e 'ucm-*' -e 'deps-*' | xa apt-mark manual
# dpkg-query -W --showformat='${Package}\t${Priority}\n' | grep -e "required$" -e "important$" -e "standard$" | cut -f1 | xa apt-mark manual
cp keepers keepers.old/keepers.`hostname`.`dttm`.bak
> keepers
# apt-mark manual mfc9335cdwcupswrapper mfc9335cdwlpr
debfoster $(
	dpkg --get-selections | awk '$2 == "install" { print $1 }' |
	grep -e '^task-' -e '^ucm-' -e '^deps-'
)
# apt-get autoremove
< keepers grep -v -e 'ucm-' -e 'task-' -e 'deps-' | tee new-packages.log
) | tee debian-cleanup.log
