'\" te
.\"  Copyright 1989 AT&T  Copyright (c) 2007, Sun Microsystems, Inc.  All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH PKGRM 1M "Oct 30, 2007"
.SH NAME
pkgrm \- remove a package from the system
.SH SYNOPSIS
.LP
.nf
\fBpkgrm\fR [\fB-nv\fR] [\fB-a\fR \fIadmin\fR] [ [\fB-A\fR | \fB-M\fR] \fB-R\fR \fIroot_path\fR]
     [\fB-V\fR \fIfs_file\fR]
     [pkginst... | \fB-Y\fR \fIcategory\fR[,\fIcategory\fR\&.\|.\|.]]
.fi

.LP
.nf
\fBpkgrm\fR \fB-s\fR \fIspool\fR
     [pkginst... | \fB-Y\fR \fIcategory\fR[,\fIcategory\fR\&.\|.\|.]]
.fi

.SH DESCRIPTION
.sp
.LP
\fBpkgrm\fR will remove a previously installed or partially installed package
from the system. A check is made to determine if any other packages depend on
the one being removed. If a dependency exists, the action taken is defined in
the \fBadmin\fR file.
.sp
.LP
The default state for the command is in interactive mode, meaning that prompt
messages are given during processing to allow the administrator to confirm the
actions being taken. Non-interactive mode can be requested with the \fB-n\fR
option.
.sp
.LP
The \fB-s\fR option can be used to specify the directory from which spooled
packages should be removed.
.sp
.LP
Certain unbundled and third-party packages are no longer entirely compatible
with the latest version of \fBpkgrm\fR. These packages require user interaction
throughout the removal and not just at the very beginning.
.sp
.LP
To remove these older packages (released prior to Solaris 2.4), set the
following environment variable:\fBNONABI_SCRIPTS=TRUE\fR \fBpkgrm\fR permits
keyboard interaction throughout the removal as long as this environment
variable is set.
.SH OPTIONS
.sp
.LP
The following options are supported:
.sp
.ne 2
.na
\fB\fB-a\fR \fIadmin\fR\fR
.ad
.sp .6
.RS 4n
Use the installation administration file, \fBadmin\fR, in place of the default
\fBadmin\fR file. \fBpkgrm\fR first looks in the current working directory for
the administration file. If the specified administration file is not in the
current working directory, \fBpkgrm\fR looks in the
\fB/var/sadm/install/admin\fR directory for the administration file.
.RE

.sp
.ne 2
.na
\fB\fB-A\fR\fR
.ad
.sp .6
.RS 4n
Remove the package files from the client's file system, absolutely. If a file
is shared with other packages, the default behavior is to not remove the file
from the client's file system.
.RE

.sp
.ne 2
.na
\fB\fB-M\fR\fR
.ad
.sp .6
.RS 4n
Instruct \fBpkgrm\fR not to use the \fB$\fR\fIroot_path\fR\fB/etc/vfstab\fR
file for determining the client's mount points. This option assumes the mount
points are correct on the server and it behaves consistently with Solaris 2.5
and earlier releases.
.RE

.sp
.ne 2
.na
\fB\fB-n\fR\fR
.ad
.sp .6
.RS 4n
Non-interactive mode. If there is a need for interaction, the command will
exit.
.sp
Use of this option requires that at least one package instance be named upon
invocation of the command. Certain conditions must exist for a package to be
removed non-interactively or a non-restrictive \fBadmin\fR file needs to be
used.
.RE

.sp
.ne 2
.na
\fB\fB-R\fR \fIroot_path\fR\fR
.ad
.sp .6
.RS 4n
Defines the full path name of a directory to use as the \fIroot_path\fR. All
files, including package system information files, are relocated to a directory
tree starting in the specified \fIroot_path\fR.
.LP
Note -
.sp
.RS 2
The root file system of any non-global zones must not be referenced with the
\fB-R\fR option. Doing so might damage the global zone's file system, might
compromise the security of the global zone, and might damage the non-global
zone's file system. See \fBzones\fR(5).
.RE
.RE

.sp
.ne 2
.na
\fB\fB-s\fR \fIspool\fR\fR
.ad
.sp .6
.RS 4n
Remove the specified package(s) from the directory \fIspool\fR. The default
directory for spooled packages is \fB/var/sadm/pkg\fR.
.RE

.sp
.ne 2
.na
\fB\fB-v\fR\fR
.ad
.sp .6
.RS 4n
Trace all of the scripts that get executed by \fBpkgrm\fR, located in the
\fIpkginst\fR\fB/install\fR directory. This option is used for debugging the
procedural and non-procedural scripts.
.RE

.sp
.ne 2
.na
\fB\fB-V\fR \fIfs_file\fR\fR
.ad
.sp .6
.RS 4n
Specify an alternative \fIfs_file\fR to map the client's file systems. Used in
situations where the \fB$\fR\fIroot_path\fR\fB/etc/vfstab\fR file is
non-existent or unreliable.
.RE

.sp
.ne 2
.na
\fB\fB-Y\fR \fIcategory\fR\fR
.ad
.sp .6
.RS 4n
Remove packages based on the value of the \fBCATEGORY\fR parameter stored in
the installed or spooled package's \fBpkginfo\fR(4) file. No package with the
\fBCATEGORY\fR value of \fBsystem\fR can removed from the file system with this
option.
.RE

.SH OPERANDS
.sp
.LP
The following operand is supported:
.sp
.ne 2
.na
\fB\fIpkginst\fR\fR
.ad
.sp .6
.RS 4n
Specifies the package to be removed. The format \fIpkginst\fR\fB\&.*\fR can be
used to remove all instances of a package.
.sp
The asterisk character (\fB*\fR) is a special character to some shells and may
need to be escaped. In the C-Shell, "\fB*\fR" must be surrounded by single
quotes (\fB\&'\fR) or preceded by a backslash (\e).
.RE

.SH EXAMPLES
.LP
\fBExample 1 \fRRemoving All Instances of \fBSUNWjunk\fR from \fBclient1\fR
.sp
.LP
The following example removes all instances of \fBSUNWjunk\fR from
\fBclient1\fR:

.sp
.in +2
.nf
example% pkgrm \fB-R\fR /export/root/client1 SUNWjunk*
.fi
.in -2
.sp

.sp
.LP
Note the caveat on the use of the \fB-R\fR option in the description of that
option, above.

.SH EXIT STATUS
.sp
.LP
The following exit values are returned:
.sp
.ne 2
.na
\fB\fB0\fR\fR
.ad
.sp .6
.RS 4n
Successful completion.
.RE

.sp
.ne 2
.na
\fB\fB1\fR\fR
.ad
.sp .6
.RS 4n
Fatal error.
.RE

.sp
.ne 2
.na
\fB\fB2\fR\fR
.ad
.sp .6
.RS 4n
Warning.
.RE

.sp
.ne 2
.na
\fB\fB3\fR\fR
.ad
.sp .6
.RS 4n
Interruption.
.RE

.sp
.ne 2
.na
\fB\fB4\fR\fR
.ad
.sp .6
.RS 4n
Administration.
.RE

.sp
.ne 2
.na
\fB\fB10\fR\fR
.ad
.sp .6
.RS 4n
Reboot after removal of all packages.
.RE

.sp
.ne 2
.na
\fB\fB20\fR\fR
.ad
.sp .6
.RS 4n
Reboot after removal of this package.
.RE

.SH SEE ALSO
.sp
.LP
\fBpkginfo\fR(1), \fBpkgmk\fR(1), \fBpkgparam\fR(1), \fBpkgproto\fR(1),
\fBpkgtrans\fR(1), \fBinstallf\fR(1M), \fBpkgadd\fR(1M), \fBpkgask\fR(1M),
\fBpkgchk\fR(1M), \fBremovef\fR(1M), \fBadmin\fR(4), \fBpkginfo\fR(4),
\fBattributes\fR(5), \fBlargefile\fR(5)
.sp
.LP
\fI\fR
.SH NOTES
.sp
.LP
Package commands are \fBlargefile\fR(5)-aware. They handle files larger than 2
GB in the same way they handle smaller files. In their current implementations,
\fBpkgadd\fR(1M), \fBpkgtrans\fR(1) and other package commands can process a
datastream of  up to 4 GB.