LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-19-2008, 06:11 PM   #1
gmabrito
LQ Newbie
 
Registered: Mar 2008
Posts: 8

Rep: Reputation: 0
RPM package db file conflict


I am running a setup script as part of the installation of my RPM package (%post). The setup.sh script is a temporary script which I delete at the end of my %post section.

I would like to avoid including these installation files in the RPM database. I am new to building RPMs. I thought of using the %install and %clean sections, but was unsuccessful using su there. The spec snippet is below.

Preparing... ##################################################
file /appl/home/tuser/rpm/script/setup.sh from install of TIbEnvTibPrf-1.0-1 conflicts with file from package TIbAdmLdapCfg-1.0-1

%post
HOME=/appl/home/tuser/rpm
AUDITS=${HOME}/audits
FILES=${HOME}/files
SCRIPT=${HOME}/script
BIN=${HOME}/bin
LOG=${AUDITS}/rpm.log

echo "`date` INFO: installing package %{name} " >> ${LOG}

## install script
su - tuser -c "${SCRIPT}/setup.sh" >> ${AUDITS}/%{name}.log
if [ $? -ne 0 ]; then
echo "`date` ERROR: package %{name} installation failed" >> ${LOG}
else
echo "`date` INFO: package %{name} installed successfully" >> ${LOG}
fi

## remove your temp directories for future use
rm -fR ${HOME}/files
rm -fR ${HOME}/script
rm -fR ${HOME}/bin
 
Old 03-19-2008, 08:12 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by gmabrito View Post
I would like to avoid including these installation files in the RPM database.
Any compelling reasons why?


Quote:
Originally Posted by gmabrito View Post
I thought of using the %install and %clean sections, but was unsuccessful using su there.
Why is running under another user necessary?


Quote:
Originally Posted by gmabrito View Post
Preparing... ##################################################
file /appl/home/tuser/rpm/script/setup.sh from install of TIbEnvTibPrf-1.0-1 conflicts with file from package TIbAdmLdapCfg-1.0-1
Are you building RPMs as root account user? That isn't best practice.


Quote:
Originally Posted by gmabrito View Post
su - tuser -c "${SCRIPT}/setup.sh" >> ${AUDITS}/%{name}.log
What does the script do? Can't it be detected and run on first run of the service or application?


Quote:
Originally Posted by gmabrito View Post
echo "`date` ERROR: package %{name} installation failed" >> ${LOG}
Why should the success of installing the RPM depend on the successful run of the script?
 
Old 03-19-2008, 09:03 PM   #3
gmabrito
LQ Newbie
 
Registered: Mar 2008
Posts: 8

Original Poster
Rep: Reputation: 0
The RPM is contains a java based installation which will be run as the application user. The installation files are large and are no longer needed after installation. I cannot just install the application on a build server and make the RPM from that. The installation must run on the server. There is an installation manager file that is basically like a registry for the software suite (ugly).

I need to run the installation as the application user, not as root. That is the reason for the switch user.

I build the application as the application user, not as root on a build server.

The setup.sh script runs the installation binary passing it the silent install file also included in the RPM.

If the setup.sh script fails then the RPM should fail, so that we know installation was not a success.

Last edited by gmabrito; 03-19-2008 at 09:05 PM. Reason: clarification
 
Old 03-19-2008, 09:35 PM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
OK. I think the fundamental question here is: if you basically use RPM for temporary payload delivery and kicking off the actual install, then should you be using RPM in the first place? What's the added value?

Back to the problem of
Quote:
file /appl/home/tuser/rpm/script/setup.sh from install of TIbEnvTibPrf-1.0-1 conflicts with file from package TIbAdmLdapCfg-1.0-1
, why not rename setup.sh to %{name}_setup.sh (or use random value)? That way TIbEnvTibPrf_setup.sh and TIbAdmLdapCfg_setup.sh won't conflict. If that's not what you're looking for please post the .spec files and verbose install runs between BB code tags (for readability) or if it's too long tarball them up, U/L to some free hoster and post the D/L URI here.
 
Old 03-19-2008, 09:54 PM   #5
gmabrito
LQ Newbie
 
Registered: Mar 2008
Posts: 8

Original Poster
Rep: Reputation: 0
You are correct this is an unorthodox approach, and RPM is only a delivery method (couldn't find a good example of this, except when a RPM does a make on the server). RPMs are our standard for software deployment the tools for distribution and config management at our shop is very mature for RPM. The SAs prefer it to always be in an RPM and I am trying to take advantages of these features.

Sounds like the right approach to use %{name}_setup.sh and continue to use the %post section of the spec file.
 
Old 03-20-2008, 10:46 AM   #6
gmabrito
LQ Newbie
 
Registered: Mar 2008
Posts: 8

Original Poster
Rep: Reputation: 0
Continuing with this approach does pose a problem. The temp files used during installation are removed after installation. RPM has stored these files in the RPM DB, and these files are no longer on the system. What problem will this cause with a RPM DB being inaccurate?

This is why I was looking for a way to ignore some files from the RPM DB perspective or to a command to delete these files from the RPM DB along with the files on the file system.
 
Old 03-20-2008, 10:49 AM   #7
gmabrito
LQ Newbie
 
Registered: Mar 2008
Posts: 8

Original Poster
Rep: Reputation: 0
I was looking for something similar to the Solaris command removef. Does RPM have such options or language?

Thanks again,
-Greg
 
Old 03-20-2008, 01:01 PM   #8
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by gmabrito View Post
I was looking for something similar to the Solaris command removef. Does RPM have such options or language?
No installf or removef.


Quote:
Originally Posted by gmabrito View Post
What problem will this cause with a RPM DB being inaccurate?
Willfully neglecting standards should give you the same motivation to perform better as cattle get from prodding rods ;-p


Quote:
Originally Posted by gmabrito View Post
The temp files used during installation are removed after installation. RPM has stored these files in the RPM DB, and these files are no longer on the system.
How about packaging up your installation code as tarball and list that as the only %file and using a %post script to unpack it to a tempdir, install and remove the tempdir? This still violates the standard but it should get you going.
 
Old 03-20-2008, 02:19 PM   #9
gmabrito
LQ Newbie
 
Registered: Mar 2008
Posts: 8

Original Poster
Rep: Reputation: 0
moooooo...hey watch it!
 
Old 03-20-2008, 06:38 PM   #10
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
ROTFL! At least you haven't lost your sense of humour yet :-]
 
Old 03-22-2008, 07:03 AM   #11
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
I built a RPM with no %setup, no %install and no visible %files.
I used the %ghost tag to keep certain files out of the RPMDB.
The payload being in %post, it does what I want it to.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
RPM package File Instantly Linux - Newbie 2 06-30-2007 12:54 PM
Get rpm package file list and config informations tobiasw Linux - Newbie 1 10-22-2006 05:39 PM
RPM: How do you extract just one file from the package? Thetargos Fedora 4 07-17-2004 03:03 AM
How to add a file to an existing rpm package SharpyWarpy Linux - Software 3 06-20-2004 05:59 AM
RPM Package Conflict Error Wicksy Linux - General 5 09-09-2003 11:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:48 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
Open Source Consulting | Domain Registration