Solved

Need help in checking an rpm and install or uninstall it

Posted on 2016-08-06
3
67 Views
Last Modified: 2016-09-09
Hi all ,

I am able to check the rpm of it installed or not and send the report but I would like to add option that if rpm present of not then I can install or uninstall it as per need.

Thanks to help !
0
Comment
Question by:The Rock
  • 2
3 Comments
 
LVL 19

Accepted Solution

by:
simon3270 earned 500 total points
ID: 41745978
You could have something like:
# $rpmname is name of rpm to manage
if rpm -qa | grep -q $rpmname; then
  echo "rpm $rpmname is installed"
  echo "Do you want to uninstall it?"
  read ans
  if [ "$ans" = "y" ] || [ "$ans" = "Y" ]; then
    rpm -e $rpmname
  fi
else
  # repeat above but offer to install rpm
fi

Open in new window

This assumes that the response is "y" or "Y" for "yes", and anything else means "no".
0
 

Author Comment

by:The Rock
ID: 41746109
Thank you Simon - will try this week as I am on leave for few days .
0
 

Author Closing Comment

by:The Rock
ID: 41791091
Thanks Simon it works as I wnated.

Thank you!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The purpose of this article is to demonstrate how we can use conditional statements using Python.
Utilizing an array to gracefully append to a list of EmailAddresses
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now