5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * CDDL HEADER START
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * The contents of this file are subject to the terms of the
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Common Development and Distribution License (the "License").
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * You may not use this file except in compliance with the License.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * or http://www.opensolaris.org/os/licensing.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * See the License for the specific language governing permissions
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * and limitations under the License.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * When distributing Covered Code, include this CDDL HEADER in each
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * If applicable, add the following below this CDDL HEADER, with the
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * fields enclosed by brackets "[]" replaced with your own identifying
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * information: Portions Copyright [yyyy] [name of copyright owner]
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * CDDL HEADER END
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Use is subject to license terms.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland/* All Rights Reserved */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland#define ERR_PKGINFO "unable to access pkginfo file <%s>"
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland#define ERR_PKGMAP "unable to access pkgmap file <%s>"
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland#define ERR_NOPARAM "%s parameter is not defined in <%s>"
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland#define ERR_PKGBAD "PKG parameter is invalid <%s>"
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland#define ERR_PKGMTCH "PKG parameter <%s> does not match instance <%s>"
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * This function confirms the presence of pkgmap and pkginfo and verifies
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * that the mandatory parameters are available in the environment.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterlandpkgenv(char *pkginst, char *p_pkginfo, char *p_pkgmap)
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland if ((fp = fopen(p_pkginfo, "r")) == NULL) {
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * verify that required parameters are now present in
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * the environment
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland progerr(gettext(ERR_NOPARAM), "PKG", path);
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland if (pkgnmchk(pkgabrv, NULL, 0) || strchr(pkgabrv, '.')) {
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland (void) snprintf(pkgwild, sizeof (pkgwild), "%s.*", pkgabrv);
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland progerr(gettext(ERR_NOPARAM), "NAME", path);
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland progerr(gettext(ERR_NOPARAM), "ARCH", path);
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland if ((pkgvers = getenv("VERSION")) == NULL) {
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland progerr(gettext(ERR_NOPARAM), "VERSION", path);
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland progerr(gettext(ERR_NOPARAM), "CATEGORY", path);
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * verify consistency between PKG parameter and pkginst that
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * was determined from the directory structure
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland (void) snprintf(param, sizeof (param), "%s.*", pkgabrv);