Solved

Need help in checking an rpm and install or uninstall it

Posted on 2016-08-06
3
57 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

757 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

21 Experts available now in Live!

Get 1:1 Help Now