LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-21-2008, 12:58 PM   #1
yshashidhar
LQ Newbie
 
Registered: Oct 2008
Posts: 3

Rep: Reputation: 0
checking for particular RPM installed r not before installing other RPM


Hello

I am going to create one RPM, which intern needs to check whether particular RPM is installed or not. If not I would like to some kind of message to do this.
I have used SPEC files, but don't have much idea on that..

Can any one help me out hw to do this?

Thanks in advance
 
Old 10-21-2008, 01:18 PM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Debian Jessie, Linux Mint 17
Posts: 7,751

Rep: Reputation: 272Reputation: 272Reputation: 272
Quote:
Originally Posted by yshashidhar View Post
Hello

I am going to create one RPM, which intern needs to check whether particular RPM is installed or not.
You use the requires statement in your rpm spec file to tell rpm what dependencies your rpm has.

------------------
Steve Stites
 
Old 10-21-2008, 02:45 PM   #3
arizonagroovejet
Senior Member
 
Registered: Jun 2005
Location: England
Distribution: openSUSE, Fedora, CentOS
Posts: 1,078

Rep: Reputation: 195Reputation: 195
What jailbait said but here's an example and a spec file for a package which requires that the ntfs-3g package is installed.

Code:
Summary:        Makes NTFS volumes mount with ntfs-3g
Name:           ntfs_readwrite
Version:        1.0
Release:        1
License:        none
Source:         %{_sourcedir}/%{name}.tar.gz
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-build
Group:          System/Base
Vendor:         Me
Requires:	ntfs-3g
 
Old 10-22-2008, 09:11 AM   #4
yshashidhar
LQ Newbie
 
Registered: Oct 2008
Posts: 3

Original Poster
Rep: Reputation: 0
First of all Thanks for your prompt reply...
Well... This sounds good to me..

For example, if I want to check whether particular command is working or not (say, xxxx). If this works I assume the RPM is installed. Else i will give some kind message to user like RPM failed to install due to dependencies.

Is there any way to do this?

Thanks in Advance
 
Old 10-22-2008, 09:21 AM   #5
arizonagroovejet
Senior Member
 
Registered: Jun 2005
Location: England
Distribution: openSUSE, Fedora, CentOS
Posts: 1,078

Rep: Reputation: 195Reputation: 195
Just specify the other rpms that need to be installed as demonstrated in the example spec file I posted. That's all you need to do. You don't need to worry about creating warning messages.

In the example spec file I posted the rpm I'm building requires that the ntfs-3g rpm be installed. If someone tries to install my rpm and the ntfs-3g rpm is not installed then whatever tool they are using to install my rpm (rpm, yum, yast2, or other) will either automatically install the ntfs-3g rpm as well as my rpm, or tell the user that they need to install the netfs-3g rpm themselves and then try installing my rpm again.
 
Old 10-24-2008, 04:12 AM   #6
yshashidhar
LQ Newbie
 
Registered: Oct 2008
Posts: 3

Original Poster
Rep: Reputation: 0
Thanks Once again...

Now i will try to elaborate my problem
1. I have one RPM (say abc.rpm), I want to give some role like before installing abc.rpm they have to make sure that "abcmodify" command is working in their machine or not.
2. this command sits in abcmodify.rpm file. If the user install this rpm in his machine he can able to run "abcmodify" command in his machine
3. But we are not sure "abcmodify" sits only in particular RPM, it may come with various rpms. Right?
4. What my spec should do is, before allowing him to install my RPM I want to check whether "abcmodify" command is working or not. If this command exists in his machine I alllow him to install my RPM.

I hope you understand now.
I want to check particular command is running or not through SPEC file

Please help me... I am running under pressure....
 
Old 10-24-2008, 07:52 AM   #7
arizonagroovejet
Senior Member
 
Registered: Jun 2005
Location: England
Distribution: openSUSE, Fedora, CentOS
Posts: 1,078

Rep: Reputation: 195Reputation: 195
Quote:
Originally Posted by yshashidhar View Post
4. What my spec should do is, before allowing him to install my RPM I want to check whether "abcmodify" command is working or not. If this command exists in his machine I alllow him to install my RPM.
This still isn't as clear as it could be. First you say you to test is the abcmodify command is working or not, then in the same sentence you say that you only want to check whether the command exists. Those are two different checks. Which do you need to test, just the existence or that the command exists and 'works'?

Either way I'm not sure how you do this, if you even can. All I can think if that you could put something in a pre-install script. Though whether you can make a pre-install script abort the installation of an rpm I don't know.
 
Old 10-24-2008, 01:57 PM   #8
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Debian Jessie, Linux Mint 17
Posts: 7,751

Rep: Reputation: 272Reputation: 272Reputation: 272
Quote:
Originally Posted by yshashidhar View Post

3. But we are not sure "abcmodify" sits only in particular RPM, it may come with various rpms. Right?
No. abcmodify would only come in a single rpm. It will not be duplicated in several rpms under several names.

---------------------
Steve Stites
 
Old 10-24-2008, 02:06 PM   #9
arizonagroovejet
Senior Member
 
Registered: Jun 2005
Location: England
Distribution: openSUSE, Fedora, CentOS
Posts: 1,078

Rep: Reputation: 195Reputation: 195
Quote:
Originally Posted by jailbait View Post
No. abcmodify would only come in a single rpm. It will not be duplicated in several rpms under several names.
I was going to say that. It is a perfectly reasonable assumption and if one assumes it to be true, then what the OP wants to achieve is as simple as you originally suggested: Just use the Requires line in the spec file.

However... I didn't say it because I think thought that it is theoretically possible that the abcmodify could be provided by more than one package. I think... Though in practice you are really as close to certainly correct that there would be only one package that would provide it as makes no odds really. If there were to be more than one package that provided the abcmodify command that would obviously be problomatic if they were to both be installed at the same time. (If they actually be installed at the time. Maybe rpm would one say hang on, this file already exists and belongs to something else and refuse to install the second rpm. I forget.)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
installed apache from source, didn't remove rpm, updated rpm causes problems leftPeg Linux - Newbie 5 06-06-2007 10:20 PM
rpm -ivh says installed rpm -e says not installed ??? skog Fedora 3 12-22-2004 04:52 PM
rpm -q not shows installed rpm mla Linux - Software 4 10-31-2004 03:49 PM
Installing from source -- dependencies installed via RPM kimchee411 Linux - Newbie 2 10-19-2004 03:40 AM
checking dependancy of rpm without installation mayankjohri Linux - Newbie 2 08-01-2002 11:08 AM


All times are GMT -5. The time now is 08:15 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration