#!/bin/sh

[ -n "$COMFORT_DIR" ] || COMFORT_DIR=/usr/share/comfort
. "$COMFORT_DIR/functions"

# ======================================================================

USAGE=
LONG_OPTS='devel'
DESCRIPTION="
Lists possibly obsolete libraries (lib* RPMs) installed in system that
nobody requires."

# Parse command line
. "$COMFORT_DIR/getopt"
[ "$#" -le 1 ] || show_usage 'Too many arguments'

# ======================================================================

if [ "$1" == '--devel' ]; then
	for LIB in `rpm -qa | grep ^lib`; do
		rpm --test -e $LIB 2>/dev/null && echo $LIB | grep devel
	done
else
	for LIB in `rpm -qa | grep ^lib`; do
		rpm --test -e $LIB 2>/dev/null && echo $LIB | grep -v devel
	done
fi
