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
6e1ae2a33c618c4c2b14aec7d2f21743ddea5837Gary Pennington * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland/* All Rights Reserved */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * libinstzones includes
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * consolidation pkg command library includes
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * local pkg command library includes
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * pkginstall local includes
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * The variable below indicates that fix_attributes() will be inadequate
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * because a replacement was permitted.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterlandstatic int domerg(struct cfextra **extlist, int part, int nparts,
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterlandstatic void endofclass(struct cfextra **extlist, int myclass,
62224350e5355e6834f7deb9d8a7d062a50cb7c2Casper H.S. Dik int ckflag, PKGserver server, VFP_T **a_cfTmpVfp);
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterlandstatic int fix_attributes(struct cfextra **, int);
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterlandstatic boolean_t parametricpath(char *path, char **relocpath);
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland/* Used to keep track of the entries in extlist that are regular files. */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterlandstatic struct reg_files *regfiles_head = NULL;
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * This is the function that actually installs one volume (usually that's
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * all there is). Upon entry, the extlist is entirely correct:
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * 1. It contains only those files which are to be installed
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * from all volumes.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * 2. The mode bits in the ainfo structure for each file are set
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * correctly in accordance with administrative defaults.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * 3. mstat.setuid/setgid reflect what the status *was* before
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * pkgdbmerg() processed compliance.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterlandinstvol(struct cfextra **extlist, char *srcinst, int part,
62224350e5355e6834f7deb9d8a7d062a50cb7c2Casper H.S. Dik int nparts, PKGserver pkgserver, VFP_T **a_cfTmpVfp,
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland int entryidx; /* array of current package objects */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland int pass; /* pass count through the for loop. */
6e1ae2a33c618c4c2b14aec7d2f21743ddea5837Gary Pennington * r_updated is an optional parameter that can be passed in
6e1ae2a33c618c4c2b14aec7d2f21743ddea5837Gary Pennington * by the caller if the caller wants to know if any objects are
6e1ae2a33c618c4c2b14aec7d2f21743ddea5837Gary Pennington * updated. Do not initialize r_updated; the call to instvol
6e1ae2a33c618c4c2b14aec7d2f21743ddea5837Gary Pennington * could be cumulative and any previous update indication must not
6e1ae2a33c618c4c2b14aec7d2f21743ddea5837Gary Pennington * be disturbed - this flag is only set, it must never be reset.
6e1ae2a33c618c4c2b14aec7d2f21743ddea5837Gary Pennington * This flag is a "char *" pointer so that the object that was
6e1ae2a33c618c4c2b14aec7d2f21743ddea5837Gary Pennington * updated can be displayed in debugging output.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * For each class in this volume, install those files.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * NOTE : This loop index may be decremented by code below forcing a
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * second trip through for the same class. This happens only when a
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * class is split between an archive and the tree. Examples would be
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * old WOS packages and the occasional class containing dynamic
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * libraries which require special treatment.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland for (classidx = 0; classidx < nc; classidx++) {
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* Now what do we pass to the class action script */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* first file to install */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * If there's an install class action script and no
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * list file has been created yet, create that file
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * and provide the pointer in listfp.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* create list file */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland if ((listfp = fopen(listfile, "w")) == NULL) {
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * The following function goes through the package
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * object list returning the array index of the next
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * regular file. If it encounters a directory,
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * symlink, named pipe or device, it just creates it.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland entryidx = domerg(extlist, (pass++ ? 0 : part), nparts,
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* Evaluate the return code */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Set ept to the first entry in extlist
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * which is guaranteed to exist so
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * later checks against ept->ftype are
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * not compared to NULL.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland break; /* no more entries to process */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * If not installing from a partially spooled package
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * (the "save/pspool" area), and the file contents can
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * be changed (type is 'e' or 'v'), and the class is not
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * "none": copy the file from the package (in pristine
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * state with no actions performed) into the appropriate
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * location in the packages destination "save/pspool"
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland ((ept->ftype == 'e') || (ept->ftype == 'v')) &&
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland if (absolutepath(ext->map_path) == B_TRUE &&
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland n = snprintf(scrpt_dst, PATH_MAX, "%s/%s/%s",
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* copy, preserve source file mode */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland if (cppath(MODE_SRC, srcp, scrpt_dst, 0644)) {
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * If this isn't writeable anyway, it's not going
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * into the list file. Only count it if it's going
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * into the list file.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * If source verification is OK for this class, make
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * sure the source we're passing to the class action
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * script is useable.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * If there's a class action script for this class,
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * just collect names in a temporary file
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * that will be used as the stdin when the
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * class action script is invoked.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Note which entries in extlist are regular
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * files to be installed via the class action
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * A warning message about unwritable targets
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * in a class may be appropriate here.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * If not installing from a partially spooled package
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * (the "save/pspool" area), and the file contents can
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * be changed (type is 'e' or 'v') and the class
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * identifier is not "none": copy the file from the
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * package (in pristine state with no actions performed)
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * into the appropriate location in the packages
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * destination "save/pspool" area.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland ((ept->ftype == 'e') || (ept->ftype == 'v') &&
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland if (absolutepath(ext->map_path) == B_TRUE &&
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland n = snprintf(scrpt_dst, PATH_MAX, "%s/%s/%s",
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* copy, preserve source file mode */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland if (cppath(MODE_SRC, srcp, scrpt_dst, 0644)) {
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * There are several tests here to determine
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * how we're going to deal with objects
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * intended for remote read-only filesystems.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * We don't use is_served() because this may be
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * a server. We're actually interested in if
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * it's *really* remote and *really* not
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland n = is_remote_fs(ept->path, &(ext->fsys_value));
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland if ((n != 0) &&
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Don't change the file, we can't write
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * to it anyway.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * If it's currently mounted, we can
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * at least test it for existence.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland if (is_mounted(ept->path, &(ext->fsys_value))) {
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* If not, we're just stuck. */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* echo output destination name */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * if no source then no need to copy/verify
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * If doing a partial installation (creating a
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * non-global zone), extra steps need to be taken:
6e1ae2a33c618c4c2b14aec7d2f21743ddea5837Gary Pennington * If the file is not type 'e' and not type 'v' and
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * the class is "none": then the file must already
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * exist (as a result of the initial non-global zone
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * installation which caused all non-e/v files to be
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * copied from the global zone to the non-global
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * zone). If this is the case, verify that the file
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * exists and has the correct attributes.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * if not type 'e|v' and class 'none', then the
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * file must already exist.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland "none") == 0)) {
6e1ae2a33c618c4c2b14aec7d2f21743ddea5837Gary Pennington /* is file changed? */
6e1ae2a33c618c4c2b14aec7d2f21743ddea5837Gary Pennington /* not - ok - warn */
6e1ae2a33c618c4c2b14aec7d2f21743ddea5837Gary Pennington if (n != 0) {
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* output warning message */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Copy from source media to target path and fix file
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * mode and permission now in case installation halted.
6e1ae2a33c618c4c2b14aec7d2f21743ddea5837Gary Pennington * If the filesystem is read-only don't attempt
6e1ae2a33c618c4c2b14aec7d2f21743ddea5837Gary Pennington * to copy a file. Just check that the content
6e1ae2a33c618c4c2b14aec7d2f21743ddea5837Gary Pennington * and attributes of the file are correct.
6e1ae2a33c618c4c2b14aec7d2f21743ddea5837Gary Pennington * Normally this doesn't happen, because files,
6e1ae2a33c618c4c2b14aec7d2f21743ddea5837Gary Pennington * which don't change, are not returned by
6e1ae2a33c618c4c2b14aec7d2f21743ddea5837Gary Pennington if (n != 0) {
6e1ae2a33c618c4c2b14aec7d2f21743ddea5837Gary Pennington * everything checks here
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* NOTE: a package object was updated */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * We have now completed processing of all pathnames
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * associated with this volume and class.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Execute appropriate class action script
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * with list of source/destination pathnames
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * as the input to the script.
6e1ae2a33c618c4c2b14aec7d2f21743ddea5837Gary Pennington /* nothing updated */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland echoDebug(DBG_INSTVOL_CAS_INFO, is_partial_inst(),
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * installing in non-global zone, and no object
6e1ae2a33c618c4c2b14aec7d2f21743ddea5837Gary Pennington * has been updated (installed/verified):
6e1ae2a33c618c4c2b14aec7d2f21743ddea5837Gary Pennington * do not run the class action script.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* run the class action script */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* Use ULIMIT if supplied. */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland set_ulimit(cl_iscript(classidx), ERR_CASFAIL);
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * end of class detected.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Since there are no more volumes which
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * contain pathnames associated with
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * this class, execute class action
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * script with the ENDOFCLASS argument;
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * we do this even if none of the path
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * names associated with this class and
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * volume needed installation to
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * guarantee the class action script is
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * executed at least once during package
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * installation.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* execute class action script */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Ensure the mod times on disk match those
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * in the pkgmap. In this case, call cverify
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * with checksumming disabled, since the only
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * action that needs to be done is to verify
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * that the attributes are correct.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland if (eocflag && (!is_partial_inst() || (is_partial_inst() &&
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland if (cl_dvfy(classidx) == QKVERIFY && !repl_permitted) {
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * The quick verify just fixes everything.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * If it returns 0, all is well. If it
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * returns 1, then the class installation
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * was incomplete and we retry on the
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * stuff that failed in the conventional
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * way (without a CAS). this is primarily
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * to accomodate old archives such as are
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * found in pre-2.5 WOS; but, it is also
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * used when a critical dynamic library
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * is not archived with its class.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Reset the CAS pointer. If the
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * function returns 0 then there
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * was no script there in the first
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * place and we'll just have to
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * call this a miss.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Decrement classidx for
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Finalize merge. This checks to make sure
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * file attributes are correct and any links
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * specified are created.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Instead of creating links back to the GZ files the logic is
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * to let zdo recreate the files from the GZ then invoke pkgadd to
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * install the editable files and skip over any 'f'type files.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * The commented out block is to create the links which should be
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * removed once the current code is tested to be correct.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Go through extlist creating links for 'f'type files
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * if we're in a global zone. Note that this code lies
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * here instead of in the main loop to support CAF packages.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * In a CAF package the files are installed by the i.none script
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * and don't exist until all files are done being processed, thus
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * the additional loop through extlist.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * output appropriate completion message
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* updating database only (hollow package) */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland echo(MSG_DBUPD_N_N_LZ, part, nparts, a_zoneName);
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland } else if (tcount == 0) {
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* updating package (non-hollow package) */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland echo(MSG_INST_N_N_LZ, part, nparts, a_zoneName);
6e1ae2a33c618c4c2b14aec7d2f21743ddea5837Gary Pennington * if any package objects were updated (not otherwise already in
6e1ae2a33c618c4c2b14aec7d2f21743ddea5837Gary Pennington * existence), set the updated flag as appropriate
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland echoDebug(DBG_INSTVOL_OBJ_UPDATED, updated);
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Name: domerg
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Description: For the specified class, review each entry and return the array
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * index number of the next regular file to process. Hard links are
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * skipped (they are created in endofclass() and directories,
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * symlinks, pipes and devices are created here, as well as any
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * file that already exists and has the correct attributes.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Arguments: struct cfextra **extlist - [RO, *RW]
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * - Pointer to list of cfextra structures representing
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * the pkgmap of the package to be installed
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * int part - [RO, *RO]
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * - the part of the package currently being processed;
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * packages begin with part "1" and proceed for the
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * number (nparts) that comprise the package (volume).
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * int nparts - [RO, *RO]
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * - the number of parts the package is divided into
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * int myclass - [RO, *RO]
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * - index into class array of the current class
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * char **srcp - [RW, *RW]
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * - pointer to pointer to string representing the source
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * path for the next package to process - if this
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * function returns != DMRG_DONE then this pointer is
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * set to a pointer to a string representing the source
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * path for the next object from the package to process
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * char **dstp - [RW, *RW]
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * - pointer to pointer to string representing the target
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * path for the next package to process - if this
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * function returns != DMRG_DONE then this pointer is
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * set to a pointer to a string representing the target
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * path for the next object from the package to process
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * char **r_updated - [RO, *RW]
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * - pointer to pointer to string - set if the last path
6e1ae2a33c618c4c2b14aec7d2f21743ddea5837Gary Pennington * returned exists or does not need updating. This is
6e1ae2a33c618c4c2b14aec7d2f21743ddea5837Gary Pennington * always set when a path to be installed exists and
6e1ae2a33c618c4c2b14aec7d2f21743ddea5837Gary Pennington * has the correct contents.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Returns: int
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * != DMRG_DONE - index into extlist of the next path to
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * be processed - that needs to be installed/copied
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * == DMRG_DONE - all entries processed
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterlanddomerg(struct cfextra **extlist, int part, int nparts,
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland struct mergstat *mstat = (struct mergstat *)NULL;
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* reset returned path pointers */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* set to start or continue based on which part being processed */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * This goes through the pkgmap entries one by one testing them
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * for inclusion in the package database as well as for validity
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * against existing files.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* if this isn't the class of current interest, skip it */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* if the class is invalid, announce it & exit */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland (ept->path && *ept->path) ? ept->path : "unknown");
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland (ept->path && *ept->path) ? ept->path : "unknown");
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland getenv("CLASSES") ? getenv("CLASSES") : "Not Set");
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Next check to see if we are going to try to delete a
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * populated directory in some distressing way.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland } else { /* Replace is OK. */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Remove this directory, so it won't
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * interfere with creation of the new object.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * If it didn't work, there's nothing
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * we can do. To continue would
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * likely corrupt the filesystem
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * which is unacceptable.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* adjust the max volume number appropriately */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* if this part goes into another volume, skip it */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * If it's a conflicting file and it's not supposed to be
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * installed, note it and skip.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland if (nocnflct && mstat->shared && ept->ftype != 'e') {
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * If we want to set uid or gid but user says no, note it.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Remember that the actual mode bits in the structure have
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * already been adjusted and the mstat flag is telling us
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * about the original mode.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland if (nosetuid && (mstat->setuid || mstat->setgid)) {
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland msg_ugid = 1; /* don't repeat attribute message. */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* links treated as object "update/skip" */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland continue; /* defer to final proc */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland case 's': /* for symlink, verify without fix first */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* links treated as object "update/skip" */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* Do this only for default verify */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* these NOT treated as object "update/skip" */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * If we can't get to it for legitimate reasons,
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * don't try to verify it.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* not treated as object "update/skip" */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* all files treated as object "update/skip" */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Both contchg and shared flags have to be taken into
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * account. contchg is set if the file is already present
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * in the package database, if it does not exist or if it
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * exists and is modified.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * The shared flag is set when 'e' or 'v' file is not
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * present in the package database, exists and is not
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * modified. It also has to be checked here.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Shared flag is also set when file is present in package
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * database and owned by more than one package, but for
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * this case contchg has already been set.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland ((ept->ftype == 'e') || (ept->ftype == 'v')))) {
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland if ((ept->ftype == 'f') || (ept->ftype == 'e') ||
d676c6678e0d7d3d3a700014d359b227edba0042phaniram rampura krishnamurthy - Sun Microsystems - Bangalore India /* Done only for C style */
d676c6678e0d7d3d3a700014d359b227edba0042phaniram rampura krishnamurthy - Sun Microsystems - Bangalore India char *tmp_ptr;
d676c6678e0d7d3d3a700014d359b227edba0042phaniram rampura krishnamurthy - Sun Microsystems - Bangalore India tmp_ptr = extlist[i]->map_path;
d676c6678e0d7d3d3a700014d359b227edba0042phaniram rampura krishnamurthy - Sun Microsystems - Bangalore India if (ept->ftype != 'f') {
d676c6678e0d7d3d3a700014d359b227edba0042phaniram rampura krishnamurthy - Sun Microsystems - Bangalore India /*
d676c6678e0d7d3d3a700014d359b227edba0042phaniram rampura krishnamurthy - Sun Microsystems - Bangalore India * translate source
d676c6678e0d7d3d3a700014d359b227edba0042phaniram rampura krishnamurthy - Sun Microsystems - Bangalore India * pathname
d676c6678e0d7d3d3a700014d359b227edba0042phaniram rampura krishnamurthy - Sun Microsystems - Bangalore India */
d676c6678e0d7d3d3a700014d359b227edba0042phaniram rampura krishnamurthy - Sun Microsystems - Bangalore India *srcp =
d676c6678e0d7d3d3a700014d359b227edba0042phaniram rampura krishnamurthy - Sun Microsystems - Bangalore India srcpath(instdir,
d676c6678e0d7d3d3a700014d359b227edba0042phaniram rampura krishnamurthy - Sun Microsystems - Bangalore India tmp_ptr,
d676c6678e0d7d3d3a700014d359b227edba0042phaniram rampura krishnamurthy - Sun Microsystems - Bangalore India part,
d676c6678e0d7d3d3a700014d359b227edba0042phaniram rampura krishnamurthy - Sun Microsystems - Bangalore India nparts);
d676c6678e0d7d3d3a700014d359b227edba0042phaniram rampura krishnamurthy - Sun Microsystems - Bangalore India } else {
d676c6678e0d7d3d3a700014d359b227edba0042phaniram rampura krishnamurthy - Sun Microsystems - Bangalore India /*
d676c6678e0d7d3d3a700014d359b227edba0042phaniram rampura krishnamurthy - Sun Microsystems - Bangalore India * instdir has the absolute path
d676c6678e0d7d3d3a700014d359b227edba0042phaniram rampura krishnamurthy - Sun Microsystems - Bangalore India * to saveSpoolInstallDir for
d676c6678e0d7d3d3a700014d359b227edba0042phaniram rampura krishnamurthy - Sun Microsystems - Bangalore India * the package. This is only
d676c6678e0d7d3d3a700014d359b227edba0042phaniram rampura krishnamurthy - Sun Microsystems - Bangalore India * useful for 'e','v' types.
d676c6678e0d7d3d3a700014d359b227edba0042phaniram rampura krishnamurthy - Sun Microsystems - Bangalore India *
d676c6678e0d7d3d3a700014d359b227edba0042phaniram rampura krishnamurthy - Sun Microsystems - Bangalore India * For 'f', we generate the
d676c6678e0d7d3d3a700014d359b227edba0042phaniram rampura krishnamurthy - Sun Microsystems - Bangalore India * absolute src path with the
d676c6678e0d7d3d3a700014d359b227edba0042phaniram rampura krishnamurthy - Sun Microsystems - Bangalore India * help of install root and the
d676c6678e0d7d3d3a700014d359b227edba0042phaniram rampura krishnamurthy - Sun Microsystems - Bangalore India * basedir.
d676c6678e0d7d3d3a700014d359b227edba0042phaniram rampura krishnamurthy - Sun Microsystems - Bangalore India */
d676c6678e0d7d3d3a700014d359b227edba0042phaniram rampura krishnamurthy - Sun Microsystems - Bangalore India *srcp = trans_srcp_pi(
d676c6678e0d7d3d3a700014d359b227edba0042phaniram rampura krishnamurthy - Sun Microsystems - Bangalore India ept->ainfo.local);
d676c6678e0d7d3d3a700014d359b227edba0042phaniram rampura krishnamurthy - Sun Microsystems - Bangalore India }
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* translate source pathname */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * At this point, we're returning a non-file
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * that couldn't be created in the standard
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * way. If it refers to a filesystem that is
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * not writeable by us, don't waste the
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * calling process's time.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* fix the attributes now for robustness sake */
6e1ae2a33c618c4c2b14aec7d2f21743ddea5837Gary Pennington * package object exists, or does not need updating:
6e1ae2a33c618c4c2b14aec7d2f21743ddea5837Gary Pennington * treat the object as if it were "updated"
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* LINTED warning: statement has no consequent: if */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland if ((stateFlag == B_FALSE) || (ept == (struct cfent *)NULL)) {
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * the object in question is a directory or special
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * file - the fact that this type of object already
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * exists or does not need updating must not trigger
6e1ae2a33c618c4c2b14aec7d2f21743ddea5837Gary Pennington * the object updated indication - that would cause
6e1ae2a33c618c4c2b14aec7d2f21743ddea5837Gary Pennington * class action scripts to be run when installing a
6e1ae2a33c618c4c2b14aec7d2f21743ddea5837Gary Pennington * new non-global zone
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland return (DMRG_DONE); /* no remaining entries on this volume */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Determine if the provided directory is populated. Return 0 if so and 1 if
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * not. This also returns 0 if the dirpath is not a directory or if it does
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * If we get here, there's a real file in the
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * This is the function that cleans up the installation of this class.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * This is where hard links get put in since the stuff they're linking
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * probably exists by now.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterlandendofclass(struct cfextra **extlist, int myclass, int ckflag,
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland struct cfent *ept; /* entry from the internal list */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland struct cfextra entry; /* entry from the package database */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* open the package database (contents) file */
62224350e5355e6834f7deb9d8a7d062a50cb7c2Casper H.S. Dik if (!ocfile(&pkgserver, a_cfTmpVfp, pkgmap_blks)) {
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland echo(MSG_VERIFYING_CLASS, cl_nam(myclass));
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* find next package object in this class */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland extlist[idx]->cf_ent.pkg_class_idx == myclass) {
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * At this point the only difference between the entry
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * in the contents file and the entry in extlist[] is
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * that the status indicator contains CONFIRM_CONT.
62224350e5355e6834f7deb9d8a7d062a50cb7c2Casper H.S. Dik * This function should return one or something is wrong.
62224350e5355e6834f7deb9d8a7d062a50cb7c2Casper H.S. Dik n = srchcfile(&(entry.cf_ent), temppath, pkgserver);
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland } else if (n != 1) {
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Check if path should be in the package
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * If merge was not appropriate for this object, now is the
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * time to choose one or the other.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * If installation was denied AFTER the package
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * database was updated, skip this. We've already
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * announced the discrepancy and the verifications
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * that follow will make faulty decisions based on
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * the ftype, which may not be correct.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * This replaces the old entry with the new
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * one. This should never happen in the new
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * DB since the entries are already identical.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Validate this entry and change the status flag in
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * the package database.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* check the hard link now. */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Don't install or verify objects for
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * remote, read-only filesystems. We need
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * only flag them as shared from some server.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Otherwise, ok to do final check.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* Find this package in the list. */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * If this package owns this file, then store
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * it in the database with the appropriate
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * status. Need to check pinfo in case it
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * points to NULL which could happen if
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * pinfo->next = NULL above.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * This is provided to
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * clients by a server.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * It's either there or it's
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * If not installing from a partially spooled package, the
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * "save/pspool" area, and the file contents can be
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * changed (type is 'e' or 'v'), and the class IS "none":
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * copy the installed volatile file into the appropriate
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * location in the packages destination "save/pspool" area.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland ((ept->ftype == 'e') || (ept->ftype == 'v')) &&
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland if (absolutepath(extlist[idx]->map_path) == B_TRUE &&
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland parametricpath(extlist[idx]->cf_ent.ainfo.local,
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland n = snprintf(scrpt_dst, PATH_MAX, "%s/%s/%s",
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland relocpath ? relocpath : extlist[idx]->map_path);
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* copy, preserve source file mode */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland if (cppath(MODE_SRC, ept->path, scrpt_dst, 0644)) {
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Now insert this potentially changed package database
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland if (putcvfpfile(&(entry.cf_ent), *a_cfTmpVfp)) {
62224350e5355e6834f7deb9d8a7d062a50cb7c2Casper H.S. Dik n = swapcfile(pkgserver, a_cfTmpVfp, pkginst, dbchg);
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland } else if (n == RESULT_ERR) {
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * This function goes through and fixes all the attributes. This is called
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * out by using DST_QKVERIFY=this_class in the pkginfo file. The primary
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * use for this is to fix up files installed by a class action script
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * which is time-critical and reliable enough to assume likely success.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * The first such format was for WOS compressed-cpio'd file sets.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * The second format is the Class Archive Format.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterlandfix_attributes(struct cfextra **extlist, int idx)
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland for (i = 0; extlist[i]; i++) {
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * We don't care about 'i'nfo files because, they
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * aren't laid down, 'e'ditable files can change
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * anyway, so who cares and 's'ymlinks were already
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * fixed in domerg(); however, certain old WOS
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * package symlinks depend on a bug in the old
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * pkgadd which has recently been expunged. For
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * those packages in 2.2, we repeat the verification
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * of symlinks.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * By 2.6 or so, ftype == 's' should be added to this.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland if (ept->ftype == 'i' || ept->ftype == 'e' ||
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland if (ept->pkg_class_idx < 0 || ept->pkg_class_idx > nc) {
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland (ept->path && *ept->path) ? ept->path : "unknown");
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* If this is the right class, do the fast verify. */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland } else /* We'll try full verify later */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Need to copy the installed volitale file back to the
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * partial spooled area if we are installing to a local zone
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * or similar installation method.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland ((ept->ftype == 'e') || (ept->ftype == 'v')) &&
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland if (absolutepath(ext->map_path) == B_TRUE &&
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland n = snprintf(scrpt_dst, PATH_MAX, "%s/%s/%s",
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* copy, preserve source file mode */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland if (cppath(MODE_SRC, ept->path, scrpt_dst, 0644)) {
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Check to see if first charcter in path is a '/'.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * B_TRUE - if path is prepended with '/'
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * B_FALSE - if not
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland return (path[0] == '/' ? B_TRUE : B_FALSE);
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Check to see if path contains a '$' which makes it
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * a parametric path and therefore relocatable.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Parameters:
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * path - The path to determine if it is absolute
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * relocpath - The value of the unconditioned path
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * B_TRUE - if path is a parametric path
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * B_FALSE - if not
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterlandparametricpath(char *path, char **relocpath)
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * If this is a valid parametric path then a '$' MUST occur at the
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * first or second character.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * If a parametric path exists then when copying the
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * path to the pspool directoy from the installing
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * pkgs reloc directory we want to use the uncononditional
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * varaiable path.