Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RPM command in script

Status
Not open for further replies.

Squadcar7

IS-IT--Management
Mar 27, 2002
25
US
Well, I'm working on a script that should prove very helpful to the world...(angels sing in the background)...
...Anyway, one part of the script checks to see if the a certain rpm is installed, namely, the kernel source rpm. Is there a command to do this that will return something to catch in the script? Is this even the right forum to put this in?
 
Here a script i use very often with RedHat and Mandrake to list all the RPM in the CD in a file that i give as argument.

you can execute this script like this:
#./listrpm /mnt/cdrom/RedHat/RPMS/ /tmp/cd1_packages.txt

If a day you want a library xxx.so.6 do this:
#vi +/xxx.so.6 /tmp/cd1_packages.txt

And you have the RPM that you must install

If you can add some good stuff to that script please post it to this forum so it will be helpful for all ;-)
---------------------------

#!/bin/bash
if [ "$2" = "" ]; then
echo &quot;Syntaxe listrpm <RPMS_path> <output_file>&quot;
exit 0
fi

path_cd=$1
file=$2

rm -f $file
touch $file
for i in $(ls $path_cd) ; do
echo &quot;***************************************************&quot; >> $file
echo &quot;*** $i ****&quot; >> $file
echo &quot;***************************************************&quot; >> $file
rpm -qpl $path_cd/$i >> $file
done

---------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top