Remove unwanted packages

I got a system which was installed with SUNWCXall cluster installed on it and i want remove unwanted software like GMNOME, Java Desktop System, Staroffice and numerous other softwares .. i want to do an automated removal of these packages where its uninstalled by itself ..from the is there any easiest way to do that ?

Something like the following might do the trick:

for PKGSTR in `pkginfo | egrep "gnome|staroffice|jde"; do
  echo PKGSTR = ${PKGSTR}
  PKGNAME=`echo ${PKGSTR} | awk '{ print $1 }'`
  echo PKGNAME = ${PKGNAME}
  pkgrm -n ${PKGNAME}
done

I strongly suggest you run the above with the pkgrm line hashed out or not present and confirm the package list is what you want to remove, I am also doing this from memory as I do not have a Solaris system to hand (must get round to building one at home in VirtualBox at least!), i have assume that the pkginfo output starts with the package's name. pkgrm -n runs it in non-interactive mode, you can create and specify your own admin file to cause pkgrm to remove packages no matter what (break dependencies, etc) non-interactively, you may want to do this as it can be a real pain trying to determine the correct order to remove all the packages for a particular susb-system when you know you simply want to remove all of them! I have also taken a guess with "jde" being mentioned for the Java Desktop Environment so you may need to adjust that, you will need to be careful you do not remove Java (JRE or JDK) itself unless that is to be removed also...

"Automated" removal can be dangerous, if you are not careful.
Even in windows env, you will need to manually choose the program that you want to remove and it does continue after several confirmations right?

yes i know it can be dangerous ... but i do not have time to remove the package one by one .. and secondly the solution give above will ask for user input everytime .. i was looking for some thing totally automated .. like expect provide the user input after it greps some thing and then provide desired in put yes or no :slight_smile:

The first suggestion I'd make is to do a fresh install. That will prevent a lot of grief.

Now, what do you mean by "automated"? You still have to tell the shell which packages need to be removed. Stuff like Gnome, StarOffice, they are defined in clusters. Star Office is installed from SUNWCstaroffice, Gnome/JDS is SUNWCgna11* (there are 2 or three). So, you could get a list of the packages in the cluster you want to remove, and pass it to a pkgrm loop. If you have a test box somewhere, you may even try and see if pkgrm would remove the cluster (never tride it before, but now I'm curious).