Function block usage in Shell script to UnInstall Specific packages
I need to write a shell script to do the following. I'm installting software packages using an install script but, my installation fails because the machine has traces of old installations. So I need verify installed old packages (lslpp) and then uninstall the old packages (installp -u) and then continue to the install script.
Suppose my installation packages are
when I do a lsllp -l | grep 'ABC'
I'll get all the packages installed with ABC in the package name. If the reason code is 0 it means there are traces of previous installations. So before installing the new packages I need to unstall the old packages.
installp -u ABC.lic
installp -u ABC.xyz
installp -u ABC.123
installp -u ABC.rte
installp -u ABC.jrte
But my problem is not every machine will have all the above packages installed. Some machine might have only packages ABC.lic and ABC.xyz while other might have ABC.rte and ABC.jrte. or some machine might have only ABC.jrte
So I need to identify exactly what packages are installed and just uninstall only those packages. I cannot use installp -u *ABC* as that might uninstall packages related to antoher software package.
Instead of writing lengthy if else loops to find the installed software can I use an uninstall function in my script and pass the installed packages as variables.
Could anyone of you please suggest me how I can wrtie my function block and call it to unistall only specifc packages or please suggest me if there is better way to accomplish this task.
Anyhelp is greatly appreciated!
A few quick suggestions.
Firstly, I'd advise against using "lsllp -l | grep 'ABC'" just in case 'ABC' appears in a description rather than a fileset name somewhere. "lslpp -l '*ABC*'" avoids that.
Next you can get to the fileset names only by running:
|All times are GMT -5. The time now is 03:47 AM.|