#! /bin/sh

# Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
#  
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#  
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#  
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

while test "$1"; do
    case "$1" in
	--help)		echo $"Usage: rpmdev-md5 <package>"; exit 0;;
	--version)	echo $"rpmdev-md5 0.4"; exit 0;;
	--)		shift; break;;
	*)		break
    esac
    shift
done

test "$1" || {
    echo $"No package specified; use '--help' for more information"
    exit 1
}


unset CDPATH
tmp=`mktemp -d /var/tmp/fedmd5.XXXXXX`
trap "rm -rf $tmp" EXIT

rpm2cpio - <"$1" | ( cd $tmp; cpio -i --quiet )

cd -- `dirname -- "$1"`
md5sum -- `basename -- "$1"`

cd $tmp
md5sum *
