Hi all im hoping someone can help, i want to check if a rpm package is installed, if it is then display one text if not then another text, below is what i have got so far, im am very much a noob at this, as you can probably can see so if possible make it simple, and a big thankyou if you can help me please.
Quote:
#!/bin/bash
if [ $($rpm -qa flash-plugin) != "flash-plugin.i386 0:9.0.115.0-release" ] ; then
zenity --error \
--text="notgot"
else
zenity --error \
--text="got"
fi
If its any help, a list of installed rpms is kept in /var/log/rpmpkgs
so i suppose its possible to check that instead of a rpm command but i havent a clue how to do that any help would be most grateful.
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 2,288
Thanks Given: 430
Thanked 480 Times in 395 Posts
Hi.
Regrettably, rpm does not return an exit status as do most commands (more correctly it seems to always return zero). This might be because it's too complex to simply decide "yes" or "no".
So one solution is to look at the output. We can do a compare very similar to the way you did, but checking for a string match, rather than strict equality, which can cause problems because of whitespace, among other things.
Here's an example:
Producing a success:
And a failure:
You can look a the output from rpm on file t1. Both forms of the "if" seemed to work for me, and you can look through man bash or a tutorial to see the details on the "if" ... cheers, drl
i would like to package up an rpm from pre-installed files, say i have a program called "widget" installed under "/opt/widget"
/opt/widget/bin/*
/opt/widget/lib/*
/opt/widget/etc/*
/opt/widget/log/*
and i want to create an rpm from those already installed files, what would the spec file... (2 Replies)
Hello,
i have installed a package by using the command
sudo rpm -i filepackage.rpm
package filepackage is already installed
when i try to remove it, i get an error saying "is not installed":
sudo rpm -e filepackage.rpm
error: package filepackage is not installed
How can... (4 Replies)
Hey there,
i run 1: on my server (RHEL 6) and getting response that the libodbc is not installed. If i use yum for installation, it tells me, there is no package like this ( 2: ). Since in the description of Definiens is mentioned that the Run-time dependency is unixODBC (libodbc.so.1), I assume... (2 Replies)
How to make RPM not write to RPM database if RPM fails to deploy?
IE I create an rpm spec file that contains the following
if
then
exit 1
fi
My rpm will fail at deployment, but if I do rpm -qa , I can see the rpm in the rpm db (3 Replies)
Hi,
I have a query in linux and please find the details of it
I have a command in linux and i want to know which rpm has provided that command.
ie: if we take ifconfig command ,i want to know what is the rpm package used to get that command.
Regards
Arun.Kakarla (3 Replies)
Hi All,
I want to check if the perl DBI package is already installed my AIX unix machine. is there any command to check this? Please help.
Thanks,
Am (2 Replies)
Hi,
i'm designing a unix script and i want to know if there is a shell command or a way to see if perl is installed in the system.
thanks in advance! (5 Replies)
Hey,
I've a problem installing a package. rpm -ivh brings the errors:
libjvm.so is needed by
libverify.so is needed by
But I have installed the Java SDK like requested and the files are on the disk. But I have no idea how to find out, why rpm cann't find them.
I have also... (2 Replies)