LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-06-2009, 09:19 AM   #1
dsollen
Member
 
Registered: Jun 2009
Posts: 56

Rep: Reputation: 15
build an RPM that requires JAVA_HOME to be set before insall?


Thanks to the great help I've gotten here I've managed to create a working RPM that does a bit of system configuration despite having little working knowledge of linux before starting. My RPM appeared to be working for awhile now but as a final test I installed it on a completely fresh install of RedHat enterprise edition 5.2 (after installing prereq rpms). It seems I'm running into a problem that the IMQ program(ie java message queues) will not boot correctly when I do this because it doesn’t know where to find the JRE.

I want to make sure that when my rpm is run the program actually works afterwards, and it won't work without IMQ. I was thinking I would have the RPM modify the IMQ configuration file to provide a -javahome argument when it boots up. I don't think I can set the configuration file to say '-javahome $JAVA_HOME' because the JAVA_HOME environmental variable won't be set until later in the boot up process after IMQ has attempted, and failed, to boot.

so I had thought the rpm could set whatever the value of JAVA_HOME is at the time the rpm is installed as the home for IMQ. So my questions are...

1) how can I require that JAVA_HOME is set prior to running my RPM, and have the RPM not install if JAVA_HOME isn't set
2) is there a good way to have rpm be able to undo the change I made to the configuration file if it is erased? Should I save a version of the old configuration file before I make the changes somewhere to be used?
3) is this the best way to do things, or is there a simpler method?
 
Old 11-07-2009, 07:27 AM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
Put the test in the '%pre' section and exit on failure ( you may need to create a %pre section)

Code:
%pre
if [ $1 = 1 ]; then
  if [ -z $JAVA_HOME ]; then
  echo "JAVA_HOME is not set, exiting..."
  exit 1
  fi
fi
cheers

Last edited by kbp; 11-07-2009 at 07:29 AM.
 
Old 11-07-2009, 04:02 PM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599
Quote:
Originally Posted by dsollen View Post
how can I require that JAVA_HOME is set prior to running my RPM, and have the RPM not install if JAVA_HOME isn't set
How about having the package that sets JAVA_HOME as a dependency? (As shown in http://www.linuxquestions.org/questi...96#post3728396 post #9: 'rpm -qf /etc/java/java.conf' yields "jpackage-utils".) That's the compliant way of doing things and you don't need to fidget with all sorts of easily breakable workarounds, patches, config changes etc.
 
  


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
JAVA_HOME seems to be getting set somewhere other than /etc/profile Neztec Linux - Newbie 8 10-22-2009 06:42 AM
unable to set JAVA_HOME mahi Linux - Newbie 2 11-17-2008 02:04 AM
How to set JAVA_HOME for Tomcat Technomot1 Linux - Newbie 2 11-26-2007 03:50 AM
How to set JAVA_HOME in catalina.sh rajaniyer123 Linux - Software 1 10-06-2007 04:34 AM
kernel-source-2.6.5-7.src.rpm requires kernel-dummy to build!? fizzdandantilus SUSE / openSUSE 5 12-02-2004 12:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:10 PM.

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