Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
The path to making CentOS 6.5 slimmer ;)
for package in $(rpm -qa --queryformat "%{NAME}\n" | sort -u); do
req=$(rpm -q --queryformat "%{NAME}\n" --whatrequires "$package")
if echo "$req" | grep -q "no package requires"; then
echo "$req"
else
printf "package: $package is required by:\n"
for required in $(rpm -q --queryformat "%{NAME}\n" --whatrequires $package | sort -u); do
printf "\t%s\n" "$required"
done
fi
done 2>&1 > installed-requirements
@bhundven

This comment has been minimized.

Copy link
Owner Author

@bhundven bhundven commented May 20, 2014

Gives you nice output in a file like so:

no package requires fipscheck
package: fipscheck-lib is required by:
        fipscheck
package: fontconfig is required by:
        libXft
package: fprintd is required by:
        fprintd-pam
no package requires fprintd-pam
package: freetype is required by:
        fontconfig
        pango
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment