main.c revision 382f00c9f2bd34208f10bb7d2be96bc6696eb8c4
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson * CDDL HEADER START
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * The contents of this file are subject to the terms of the
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * Common Development and Distribution License (the "License").
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * You may not use this file except in compliance with the License.
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson * or http://www.opensolaris.org/os/licensing.
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson * See the License for the specific language governing permissions
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson * and limitations under the License.
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson * When distributing Covered Code, include this CDDL HEADER in each
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson * If applicable, add the following below this CDDL HEADER, with the
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson * fields enclosed by brackets "[]" replaced with your own identifying
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson * information: Portions Copyright [yyyy] [name of copyright owner]
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson * CDDL HEADER END
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson * Use is subject to license terms.
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson/* All Rights Reserved */
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson#define MSG_MANMOUNT "Assuming mounts were provided."
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson"The package name specified on the command line\n" \
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson"exceeds the maximum package name length: a package name may contain a\n" \
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson"maximum of <%d> characters; however, the package name specified on\n" \
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson"the command line contains <%d> characters, which exceeds the maximum\n" \
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson"package name length by <%d> characters. Please specify a package name\n" \
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson"that contains no more than <%d> characters."
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson#define ERR_DB_GET "unable to retrieve entries from the database."
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson#define ERR_DB_PUT "unable to update the package database."
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson#define ERR_ROOT_SET "Could not set install root from the environment."
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson#define ERR_ROOT_CMD "Command line install root contends with environment."
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson#define ERR_CLASSLONG "classname argument too long"
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson#define ERR_CLASSCHAR "bad character in classname"
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson#define ERR_INVAL "package instance <%s> is invalid"
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson#define ERR_NOTINST "package instance <%s> is not installed"
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson#define ERR_MERG "unable to merge contents file"
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson#define ERR_SORT "unable to sort contents file"
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson#define ERR_I_FAIL "installf did not complete successfully"
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson#define ERR_R_FAIL "removef did not complete successfully"
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson#define ERR_NOTROOT "You must be \"root\" for %s to execute properly."
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson "\t%s [[-M|-A] -R host_path] [-V ...] pkginst path " \
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson "[path ...]\n" \
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson "\t%s [[-M|-A] -R host_path] [-V ...] pkginst path\n"
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson "\t%s [[-M] -R host_path] [-V ...] [-c class] <pkginst> " \
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson "\t%s [[-M] -R host_path] [-V ...] [-c class] <pkginst> " \
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson "<path> <specs>\n" \
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson "\t where <specs> may be defined as:\n" \
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson "\t\tf <mode> <owner> <group>\n" \
c73d8c1b72ddc3330cfc21e2070dffabca324bf7Mark Andrews "\t\tv <mode> <owner> <group>\n" \
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson "\t\te <mode> <owner> <group>\n" \
c73d8c1b72ddc3330cfc21e2070dffabca324bf7Mark Andrews "\t\td <mode> <owner> <group>\n" \
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson "\t\tx <mode> <owner> <group>\n" \
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson "\t\tp <mode> <owner> <group>\n" \
473ca0bf8c73e5fc3132df074b2d4e14be5eaa1eAndreas Gustafsson "\t\tc <major> <minor> <mode> <owner> <group>\n" \
char *pkginst;
char *uniTmp;
char *abi_sym_ptr;
char *ulim;
char *script;
int eptnum;
int nosetuid;
int nocnflct;
int warnflag = 0;
/* libadm/pkgparam.c */
extern void set_limit(void);
char *tp;
char *prog;
char *pt;
char *temp_cl_basedir;
int dbchg;
int err;
int fflag = 0;
if (getuid() != 0) {
set_limit();
clr_ulimit();
map_client = 0;
fflag++;
map_client = 0;
pkgrmremote++;
usage();
usage();
if (is_an_inst_root()) {
int fsys_value;
usage();
if (n > PKGSIZ) {
PKGSIZ);
usage();
if (INSTALF)
if (fflag) {
usage();
usage();
if (REMOVEF) {
if (classname) {
usage();
if (fflag) {
if (INSTALF) {
if (dbchg < 0) {
if (dbchg) {
== RESULT_WRN) {
warnflag++;
} else if (n == RESULT_ERR) {
relslock();
for (n = 0; extlist[n]; n++) {
get_basedir(),
sizeof (outbuf),
} else if (is_an_inst_root()) {
for (n = 0; extlist[n]; n++) {
quit(int n)
if (REMOVEF) {
exit(n);
usage(void)
if (REMOVEF) {