Base directory of the package


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Base directory of the package
# 1  
Old 10-13-2011
Base directory of the package

Hello, I have an RPM package for which I need to know the base directory /opt/appdir. But if the package is relocated, then it will be different. I need to get the value dynamically.

I tried to query the RPM with INSTPREFIXES but couldn't get the value. The only way I see is to do 'rpm -ql RPM Name' and grep for the script that I know
inside the package.
The package contains a script under /opt/appdir/ABCDInstaller/bin/ABCDInstaller.sh

from which I need to get the path '/opt/appdir'.

Can you help how I can get the path. Also, is there a better way to get the base directory of the package.

Thanks,
C H
# 2  
Old 10-13-2011
RPM doesn't really have a concept of "base directory" I think, since neither does UNIX. Files get put in various places based on their function. Whatever this is short-circuits that by dumping everything in /opt/ where it can do whatever it pleases.

You could use --list to list the files in the package, perhaps.

Or the rpm2targz utility may be useful, since you can just get straight filenames out of a tarball with tar -ztf filename.tar.gz and do what you want with the paths from there.
# 3  
Old 10-13-2011
The RPM package I am talking about is created in such a way that it is installed by default under /opt. It is relocatable to any other path using --relocate option. I need to get that value dynamically.

For that, part of my solution is to query for a script in the package and get the base directory.

From the below line,
/opt/appdir/ABCDInstaller/bin/ABCDInstaller.sh

I know the RPM package will install the directory ABCDInstaller. So I want to get the value before that which in this case is /opt/appdir.

Thanks,
Ravi
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Delete directory on date base

Hi, I have below directories Direct 2013-08-12 23123 Direct 2013-08-13 24121 Direct 2013-08-14 34513 Direct 2013-08-31 15435 ........... Direct 2013-09-12 53145 Direct 2013-09-30 65234 Direct 2013-09-30 89642 (11 Replies)
Discussion started by: learnbash
11 Replies

2. Shell Programming and Scripting

Massive Copy With Base Directory

I have a script that I am using to copy around 40-70k files to a NFS NAS. I have posted my code below in hopes that someone can help me figure out a faster way of achieving this. At the end of the script i need to have all the files in the list, copied over to the nas with source directory... (8 Replies)
Discussion started by: nitrobass24
8 Replies

3. Emergency UNIX and Linux Support

Problem when trying to remove a package using rpm command - error: package is not installed

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)
Discussion started by: g_p
4 Replies

4. UNIX for Dummies Questions & Answers

Can't install rpm package with --prefix in new path.Error: package is not relocatable

Hello, i have downloaded an rpm package "hadoop-0.20.205.0-1.amd64.rpm" in /usr/local/ directory. I'm trying to install the rpm package in a new path/location (/usr/local/hadoop-0.20.205), but i can't. I did: 1st try: Didn't work sudo rpm -i --prefix=/usr/local/hadoop-0.20.205... (1 Reply)
Discussion started by: g_p
1 Replies

5. UNIX for Advanced & Expert Users

How to find dependancies of .dstream package (Solaris) & .rpm package( linux)

Friends, Please let meknow, How we can find the dependancies of .dstream package & .rpm package before installation ? For AIX, We can use the inutoc . command to create the .toc file for the bff package, What about Solaris & Linux ? (0 Replies)
Discussion started by: yb4779
0 Replies

6. Solaris

Missing Base Directory

Hey all, I'm attempting to migrate a zone from one system to another, but I noticed that on the new system ssl BASEDIR was missing. I was wondering if creating the directory path for this would fix the issue when I migrate files over. SSL is installed on the new system but does not show a... (1 Reply)
Discussion started by: em23
1 Replies

7. UNIX for Dummies Questions & Answers

Find command to run only in the base directory

Hi. I'm trying to get my find command to only search in the directory i tell it to, but i don't want it to search in the sub directories as well... For example, i have a /data/files/ and /data/files/old I want to search for all .sav files within /data/files but i don't want it to drill... (4 Replies)
Discussion started by: Stephan
4 Replies

8. Linux

how to restore original package after uninstalling the upgraded package using rpm

have following package installed rpm -qa |grep ADMIN It will give the following package installed: ADMIN-4.0.0.1 Now I will upgrade the ADMIN package using the following command. rpm --upgrade ADMIN-4.1.0.1 It will upgrade the ADMIN packagge to ADMIN-4.1.0.1 Now I want that... (0 Replies)
Discussion started by: amitpansuria
0 Replies

9. UNIX for Dummies Questions & Answers

Howto install RPM package for non-Root user directory?

Dear expert, Suppose I have an application that comes in rpm format. Let's call it: my_downloaded_package.rpm How can I install it in my particular home directory (since I'm not a root user). Say the directory where I want to install above rpm package is: ~/.my_desired_location... (1 Reply)
Discussion started by: monkfan
1 Replies
Login or Register to Ask a Question