Hi. I have a shell snippet that takes a list of packages I want to keep and uninstalls all the rest:
Code:
diff -u ~/my_packs_to_keep.lst ~/my_packs_all.lst | sed '1,3d;/cifs-utils\|samba-client/d;s/^+//;t;d' >~/my_packages-ec-stage-db-1-to-uninst.txt
while true; do
package-cleanup --leaves --all | xargs rpm -q --queryformat "%{NAME}.%{ARCH}\n" | LC_ALL=C sort >~/my_packages-ec-stage-db-1-leaves.txt
b=`LC_ALL=C join ~/my_packages-ec-stage-db-1-to-uninst.txt ~/my_packages-ec-stage-db-1-leaves.txt`
[ -z "$b" ] && break
yum erase $b || break
done
Today I noticed it cannot uninstall this trinity:
- gdm
- pulseaudio-gdm-hooks
- plymouth-gdm-hooks
because they depend on each other and from `package-cleanup` point of view, they're not leaves.
How to change my script? The most important thing is to not accidentally erase a package that needs to be kept.