Operating System - HP-UX
1855259 Members
6003 Online
104109 Solutions
New Discussion

Re: hp-ux sd swremove older version inside preinstall ?

 
Peter Jansen_1
Occasional Contributor

hp-ux sd swremove older version inside preinstall ?

I have a question regarding HP-UX SD scripting and .psf files.

How can I have swinstall automatically performing an swremove of an older version of the same product ? Can I just place the appropriate swremove command inside a preinstall script for the newer version ?

Thanks in advance for any help.

Peter Jansen, BIS, Basel, Switzerland
5 REPLIES 5
Stefan Farrelly
Honored Contributor

Re: hp-ux sd swremove older version inside preinstall ?

You can try it but I dont think its going to work. When swinstall or swremove is running it creates a lockfile to stop other swinstall or swremove sessions running.

I think you need a wrapper script around your swinstall which checks for the older version before running swinstall, then if found does an swremove of the old version then runs swinstall.

Im from Palmerston North, New Zealand, but somehow ended up in London...
Ramkumar Devanathan
Honored Contributor

Re: hp-ux sd swremove older version inside preinstall ?

Peter,

I havent tried this but i don't thnk this will work
bcos typically only one instance of the sw* products should run at a time. When started they create a lock which prevents other instances from coming up.

so swremove cannot be run when swinstall is running.

Why would you need to swremove? Unless you have new binaries with new names and that cause a problem after upgrade, you shouldn't need to swremove.

do this - if your upgrade is a full upgrade (unlike a patch) remove the entire directory structure, after stopping the processes.

Hope that helps.

- ramd.
HPE Software Rocks!
Dietmar Konermann
Honored Contributor

Re: hp-ux sd swremove older version inside preinstall ?

Hi Peter,

I think, the good way to do this would be a preinstall script, that removes the files explicitely and then calls the control_utils function "IPD_delete_ancestors".

Of course you would need to take care to maintain the "ancestor" tags carefully in your depots.

#! /sbin/sh
typeset -r UTILS="/usr/lbin/sw/control_utils"
if [[ ! -f $UTILS ]]
then
echo "ERROR: Cannot find $UTILS"
exit 1
fi
. $UTILS
exitval=$SUCCESS

#########################
# remove obsolete files/dirs
#
rm -rf ...


#########################
# remove ancestor filesets
#

IPD_delete_ancestors

exit $exitval


Best regards...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)
Peter Jansen_1
Occasional Contributor

Re: hp-ux sd swremove older version inside preinstall ?

So far, the wrapper script around an swremove followed by an swinstall seems the easiest approach, but has the disadvantage that it then isn't a regular swinstall anymore. I'd prefer a fully self-contained depot that can just be swinstalled "over" an existing older version.

The second suggestion to just not bother with an swremove and construct my .psf so that it can just be swinstalled over the older one is one that can certainly leave a working newer version in place, but I'm worried what will happen to the swinstall database (IPD), especially in the longer run.

The third suggestion mentions some concepts that seem very interesting, but that I am too unfamiliar with and know too little about. I have doubts that I'll not wreck the IPD.

Thanks to all the helpers so far !
Dietmar Konermann
Honored Contributor

Re: hp-ux sd swremove older version inside preinstall ?

If possible, you should really try to create clean software depot which behave as expected.

Have a look at:
http://docs.hp.com/hpux/pdf/B2355-90754.pdf

This doc explains lots of useful things around software packaging.

Best regards...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)