Removing Solaris Packages Non-Interactively

From Peter Pap's Technowiki
Jump to: navigation, search

So you've installed a bunch of packages that you no longer want and you want to remove them all without having to type yes to everything. 'pkgrm' by default uses an admin file to tell it how to respond to different situations during install and removal of a package. This file is /var/sadm/install/admin/default. You can use a copy of this file to alter the behaviour of 'pkgrm' so that it doesn't ask you about every package you want to remove. To do this, you need to do the following:

1. Copy /var/sadm/install/admin/default to your local directory

 cp /var/sadm/install/admin/default .

2. Edit your new copy of the default file and change

 action=ask

to

 action=nocheck

3. When you perform the package removal operation, give 'pkgrm' the following parameters:

 pkgrm -n -a /path_to_edited_default_file/default pkgname1 pkgname2 pkgname3.....

where

 -n means non-interactive
 -a file_name means use an alternate admin file.

It should now remove all the packages you specify without annoying you for interaction :-)

To find out more about the admin file and it's possible variables and values, look at man -s 4 admin