Skip to content

Instantly share code, notes, and snippets.

@meeuw
Created December 17, 2013 14:59
Show Gist options
  • Save meeuw/8006207 to your computer and use it in GitHub Desktop.
Save meeuw/8006207 to your computer and use it in GitHub Desktop.
Use this script to find all "leaves" you've installed on your yum/rpm system. Add these "leaves" to PACKAGES="" and remove what you aren't using anymore. Then re-run the script until all unwanted packages are removed.
#!/bin/bash
PACKAGES=""
LEAVES="$(package-cleanup --leaves --all --qf='%{NAME}')"
ERASE=$(grep -vxf <(echo "$PACKAGES") <(echo "$LEAVES"))
if [ "$ERASE" ]; then
yum erase $ERASE
else
diff -udr <(echo "$LEAVES") <(echo "$PACKAGES")
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment