skip installation by meeting a condition in pre section of Spec file in RPM packaging

Stuart D. Gathman stuart at bmsi.com
Thu Feb 17 17:55:59 UTC 2011


On Thu, 17 Feb 2011, Fawad Ali wrote:

>        I am new to rpm and to rpm packaging. I was asked to copy a
> war file from one location to another. through rpm. I packaged that.
> So what it does is like below.
> 1) Copy file to AUTODEPLOY folder in tomcat server
> 2) From the AUTODEPLOY folder the tomcat server picks up the war file
> and explodes it in WEBAPPS folder and removes the content from
> AUTODEPLOY.
> 
> Now if I want to REINSTALL, it should first check that whether WEBAPPS
> contains the exploded war file or not. If yes, then it should display
> that package is already installed and skip the installation, if the
> web apps does not contain the exploded war file then it should force
> the installation process.
> 
> Can anyone tell me how can I do that.

I do the following:

Install the exploded webapp to a fixed directory structure.  For instance,
our web tracking goes in /bms/webapp/webtrk with WEB-INF META-INF
subdirs and maybe an art subdir, etc.  (If Linux Standards Base ever
addresses the issue, it would probably belong in /usr/share/java-webapp
or /var/lib/java-webapp instead.)

Then add a symlink to your webapp container, for instance with JPP packaged
tomcat5, add /var/lib/tomcat5/webapp/webtrk -> /bms/webapp/webtrk

I also find it handy to symlink WEB-INF/classes -> /bms/java where the webapp
and additional RPMs drop class files for our local java packages (so that the
web app is composed of multiple versioned RPMs).  To enable this symlink,
the RPM needs to also install META-INF/context.xml with something like:

<?xml version="1.0" encoding="UTF-8"?>
<Context allowLinking="true">

    <!-- Default set of monitored resources -->
    <WatchedResource>WEB-INF/web.xml</WatchedResource>

    <!-- Uncomment this to disable session persistence across Tomcat restarts -->
    <!--
    <Manager pathname="" />
    -->

</Context>

-- 
	      Stuart D. Gathman <stuart at bmsi.com>
    Business Management Systems Inc.  Phone: 703 591-0911 Fax: 703 591-6154
"Confutatis maledictis, flammis acribus addictis" - background song for
a Microsoft sponsored "Where do you want to go from here?" commercial.


More information about the Rpm-list mailing list