2001-07-10 14:25:50 +00:00
|
|
|
#!/bin/bash
|
2001-09-04 13:27:31 +00:00
|
|
|
# rpm-check.sh
|
2001-07-10 14:25:50 +00:00
|
|
|
|
2006-12-20 21:11:55 +00:00
|
|
|
# Queries an rpm file for description, listing,
|
|
|
|
#+ and whether it can be installed.
|
|
|
|
# Saves output to a file.
|
2001-07-10 14:25:50 +00:00
|
|
|
#
|
2006-12-20 21:11:55 +00:00
|
|
|
# This script illustrates using a code block.
|
2001-07-10 14:25:50 +00:00
|
|
|
|
2001-10-15 14:21:41 +00:00
|
|
|
SUCCESS=0
|
2001-09-04 13:27:31 +00:00
|
|
|
E_NOARGS=65
|
2001-07-10 14:25:50 +00:00
|
|
|
|
|
|
|
if [ -z "$1" ]
|
|
|
|
then
|
|
|
|
echo "Usage: `basename $0` rpm-file"
|
2001-09-04 13:27:31 +00:00
|
|
|
exit $E_NOARGS
|
2001-07-10 14:25:50 +00:00
|
|
|
fi
|
|
|
|
|
2006-12-20 21:11:55 +00:00
|
|
|
{ # Begin code block.
|
2001-07-10 14:25:50 +00:00
|
|
|
echo
|
|
|
|
echo "Archive Description:"
|
2001-09-04 13:27:31 +00:00
|
|
|
rpm -qpi $1 # Query description.
|
2001-07-10 14:25:50 +00:00
|
|
|
echo
|
|
|
|
echo "Archive Listing:"
|
2001-09-04 13:27:31 +00:00
|
|
|
rpm -qpl $1 # Query listing.
|
2001-07-10 14:25:50 +00:00
|
|
|
echo
|
2001-09-04 13:27:31 +00:00
|
|
|
rpm -i --test $1 # Query whether rpm file can be installed.
|
2001-10-15 14:21:41 +00:00
|
|
|
if [ "$?" -eq $SUCCESS ]
|
2001-07-10 14:25:50 +00:00
|
|
|
then
|
|
|
|
echo "$1 can be installed."
|
|
|
|
else
|
|
|
|
echo "$1 cannot be installed."
|
|
|
|
fi
|
2006-12-20 21:11:55 +00:00
|
|
|
echo # End code block.
|
2001-09-04 13:27:31 +00:00
|
|
|
} > "$1.test" # Redirects output of everything in block to file.
|
2001-07-10 14:25:50 +00:00
|
|
|
|
|
|
|
echo "Results of rpm test in file $1.test"
|
|
|
|
|
|
|
|
# See rpm man page for explanation of options.
|
|
|
|
|
|
|
|
exit 0
|